summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaelan Mikowicz <Kaelan_Mikowicz@Trimble.com>2018-07-13 16:57:19 -0700
committerKaelan Mikowicz <Kaelan_Mikowicz@Trimble.com>2018-07-13 16:57:19 -0700
commit98c6a83f15ed79400a715086db115a81600c1b55 (patch)
treef7a42affb90050dc30f658cb047f9e27b440b456
parenta27715f322bb08b1fccffebab776c94df50057e9 (diff)
downloadpyserial-git-98c6a83f15ed79400a715086db115a81600c1b55.tar.gz
redefine TIOCXBRK to the correct syscall numbers for mac
-rw-r--r--serial/__init__.py2
-rw-r--r--serial/serialposix.py13
2 files changed, 13 insertions, 2 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..43977e9 100644
--- a/serial/serialposix.py
+++ b/serial/serialposix.py
@@ -53,7 +53,7 @@ class PlatformSpecificBase(object):
def set_low_latency_mode(self, low_latency_settings):
raise NotImplementedError('Low latency not supported on this platform')
-
+
# some systems support an extra flag to enable the two in POSIX unsupported
# paritiy settings for MARK and SPACE
@@ -202,6 +202,8 @@ elif plat == 'cygwin': # cygwin/win32 (confirmed)
elif plat[:6] == 'darwin': # OS X
import array
IOSSIOSPEED = 0x80045402 # _IOW('T', 2, speed_t)
+ TIOCSBRK = 0x2000747B # _IO('t', 123)
+ TIOCCBRK = 0x2000747A # _IO('t', 122)
class PlatformSpecific(PlatformSpecificBase):
osx_version = os.uname()[2].split('.')
@@ -212,6 +214,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, TIOCSBRK)
+ else:
+ fcntl.ioctl(self.fd, TIOCCBRK)
+
elif plat[:3] == 'bsd' or \
plat[:7] == 'freebsd' or \
plat[:6] == 'netbsd' or \