From: nickthetait Date: Mon, 30 Nov 2015 21:42:28 +0000 (-0700) Subject: Move this commit onto Mangrove branch X-Git-Tag: lulzbot-18.03~11 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=21bc8d3423998086e22248f12173e561a099ec97;hp=97a4808bf2e4e133ee610405508f5abd6330fed4;p=cura.git Move this commit onto Mangrove branch Revert "Add a wrapper around serial to monkey patch support for custom baudrates" This reverts commit 97a4808bf2e4e133ee610405508f5abd6330fed4. --- diff --git a/Cura/gui/firmwareInstall.py b/Cura/gui/firmwareInstall.py index 7c370cae..61894669 100644 --- a/Cura/gui/firmwareInstall.py +++ b/Cura/gui/firmwareInstall.py @@ -5,8 +5,7 @@ import wx import threading import sys import time - -from Cura.util import serialWrapper as serial +import serial from Cura.avr_isp import stk500v2 from Cura.avr_isp import ispBase diff --git a/Cura/util/machineCom.py b/Cura/util/machineCom.py index d01f233d..0178bfb9 100644 --- a/Cura/util/machineCom.py +++ b/Cura/util/machineCom.py @@ -15,7 +15,7 @@ import threading import platform import Queue as queue -from Cura.util import serialWrapper as serial +import serial from Cura.avr_isp import stk500v2 from Cura.avr_isp import ispBase diff --git a/Cura/util/serialWrapper.py b/Cura/util/serialWrapper.py deleted file mode 100644 index f41c686f..00000000 --- a/Cura/util/serialWrapper.py +++ /dev/null @@ -1,38 +0,0 @@ -# Serial wrapper around pyserial that adds support for custom baudrates (250000) -# on linux, when pyserial is < 2.7 - -from serial import * -import os -if os.name == 'posix': - import serial.serialposix - - if not hasattr(serial.serialposix, "TCGETS2") and \ - hasattr(serial.serialposix, "set_special_baudrate"): - # Detected pyserial < 2.7 which doesn't support custom baudrates - # Replacing set_special_baudrate with updated function from pyserial 2.7 - - TCGETS2 = 0x802C542A - TCSETS2 = 0x402C542B - BOTHER = 0o010000 - - def set_special_baudrate(port, baudrate): - # right size is 44 on x86_64, allow for some growth - import array - buf = array.array('i', [0] * 64) - - try: - # get serial_struct - FCNTL.ioctl(port.fd, TCGETS2, buf) - # set custom speed - buf[2] &= ~TERMIOS.CBAUD - buf[2] |= BOTHER - buf[9] = buf[10] = baudrate - - # set serial_struct - res = FCNTL.ioctl(port.fd, TCSETS2, buf) - except IOError, e: - raise ValueError('Failed to set custom baud rate (%s): %s' % (baudrate, e)) - - # We need to change the function inside the serialposix module otherwise, it won't - # be called by the code within that module - serial.serialposix.set_special_baudrate = set_special_baudrate