diff options
author | Kaelan Mikowicz <eternity01033@gmail.com> | 2018-07-14 23:21:33 -0700 |
---|---|---|
committer | Kaelan Mikowicz <eternity01033@gmail.com> | 2018-07-14 23:21:33 -0700 |
commit | fca918defddae5ecd1dc48dba0894717e33f8903 (patch) | |
tree | 3b819ef49449cb1f3d6b8a6e16764a71bc81e909 | |
parent | 98c6a83f15ed79400a715086db115a81600c1b55 (diff) | |
download | pyserial-git-fca918defddae5ecd1dc48dba0894717e33f8903.tar.gz |
change break syscall number for bsd as well
-rw-r--r-- | serial/serialposix.py | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/serial/serialposix.py b/serial/serialposix.py index 43977e9..cea104c 100644 --- a/serial/serialposix.py +++ b/serial/serialposix.py @@ -202,11 +202,12 @@ 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('.') + 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): @@ -219,9 +220,9 @@ elif plat[:6] == 'darwin': # OS X Set break: Controls TXD. When active, no transmitting is possible. """ if self._break_state: - fcntl.ioctl(self.fd, TIOCSBRK) + fcntl.ioctl(self.fd, PlatformSpecific.TIOCSBRK) else: - fcntl.ioctl(self.fd, TIOCCBRK) + fcntl.ioctl(self.fd, PlatformSpecific.TIOCCBRK) elif plat[:3] == 'bsd' or \ plat[:7] == 'freebsd' or \ @@ -238,6 +239,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 |