summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--serial/__init__.py2
-rw-r--r--serial/serialposix.py43
2 files changed, 35 insertions, 10 deletions
diff --git a/serial/__init__.py b/serial/__init__.py
index dcd7c12..afd63a6 100644
--- a/serial/__init__.py
+++ b/serial/__init__.py
@@ -15,7 +15,7 @@ import importlib
from serial.serialutil import *
#~ SerialBase, SerialException, to_bytes, iterbytes
-__version__ = '3.4'
+__version__ = '3.4.1'
VERSION = __version__
diff --git a/serial/serialposix.py b/serial/serialposix.py
index 507e2fe..334ba9f 100644
--- a/serial/serialposix.py
+++ b/serial/serialposix.py
@@ -54,6 +54,15 @@ class PlatformSpecificBase(object):
def set_low_latency_mode(self, low_latency_settings):
raise NotImplementedError('Low latency not supported on this platform')
+ def _update_break_state(self):
+ """\
+ Set break: Controls TXD. When active, no transmitting is possible.
+ """
+ if self._break_state:
+ fcntl.ioctl(self.fd, TIOCSBRK)
+ else:
+ fcntl.ioctl(self.fd, TIOCCBRK)
+
# some systems support an extra flag to enable the two in POSIX unsupported
# paritiy settings for MARK and SPACE
@@ -205,6 +214,9 @@ elif plat[:6] == 'darwin': # OS X
class PlatformSpecific(PlatformSpecificBase):
osx_version = os.uname()[2].split('.')
+ TIOCSBRK = 0x2000747B # _IO('t', 123)
+ TIOCCBRK = 0x2000747A # _IO('t', 122)
+
# Tiger or above can support arbitrary serial speeds
if int(osx_version[0]) >= 8:
def _set_special_baudrate(self, baudrate):
@@ -212,6 +224,15 @@ elif plat[:6] == 'darwin': # OS X
buf = array.array('i', [baudrate])
fcntl.ioctl(self.fd, IOSSIOSPEED, buf, 1)
+ def _update_break_state(self):
+ """\
+ Set break: Controls TXD. When active, no transmitting is possible.
+ """
+ if self._break_state:
+ fcntl.ioctl(self.fd, PlatformSpecific.TIOCSBRK)
+ else:
+ fcntl.ioctl(self.fd, PlatformSpecific.TIOCCBRK)
+
elif plat[:3] == 'bsd' or \
plat[:7] == 'freebsd' or \
plat[:6] == 'netbsd' or \
@@ -227,6 +248,19 @@ elif plat[:3] == 'bsd' or \
# a literal value.
BAUDRATE_CONSTANTS = ReturnBaudrate()
+ TIOCSBRK = 0x2000747B # _IO('t', 123)
+ TIOCCBRK = 0x2000747A # _IO('t', 122)
+
+
+ def _update_break_state(self):
+ """\
+ Set break: Controls TXD. When active, no transmitting is possible.
+ """
+ if self._break_state:
+ fcntl.ioctl(self.fd, PlatformSpecific.TIOCSBRK)
+ else:
+ fcntl.ioctl(self.fd, PlatformSpecific.TIOCCBRK)
+
else:
class PlatformSpecific(PlatformSpecificBase):
pass
@@ -635,15 +669,6 @@ class Serial(SerialBase, PlatformSpecific):
raise portNotOpenError
termios.tcsendbreak(self.fd, int(duration / 0.25))
- def _update_break_state(self):
- """\
- Set break: Controls TXD. When active, no transmitting is possible.
- """
- if self._break_state:
- fcntl.ioctl(self.fd, TIOCSBRK)
- else:
- fcntl.ioctl(self.fd, TIOCCBRK)
-
def _update_rts_state(self):
"""Set terminal status line: Request To Send"""
if self._rts_state: