diff options
author | cliechti <cliechti@f19166aa-fa4f-0410-85c2-fa1106f25c8a> | 2014-07-31 22:21:24 +0000 |
---|---|---|
committer | cliechti <cliechti@f19166aa-fa4f-0410-85c2-fa1106f25c8a> | 2014-07-31 22:21:24 +0000 |
commit | d5069fea2418f668d7e83cf3fafe78bf1379f528 (patch) | |
tree | 65a067d0d2937306774dfb853fd44fce0e11501a /serial | |
parent | 497c1d804a4203a7c06998804b25fe1c56553b45 (diff) | |
download | pyserial-d5069fea2418f668d7e83cf3fafe78bf1379f528.tar.gz |
[Patch pyserial:31] Mark/space parity on Linux
git-svn-id: http://svn.code.sf.net/p/pyserial/code/trunk/pyserial@497 f19166aa-fa4f-0410-85c2-fa1106f25c8a
Diffstat (limited to 'serial')
-rw-r--r-- | serial/serialposix.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/serial/serialposix.py b/serial/serialposix.py index b9b4b28..cf40490 100644 --- a/serial/serialposix.py +++ b/serial/serialposix.py @@ -270,6 +270,8 @@ TIOCM_DTR_str = struct.pack('I', TIOCM_DTR) TIOCSBRK = hasattr(TERMIOS, 'TIOCSBRK') and TERMIOS.TIOCSBRK or 0x5427 TIOCCBRK = hasattr(TERMIOS, 'TIOCCBRK') and TERMIOS.TIOCCBRK or 0x5428 +CMSPAR = 010000000000 # Use "stick" (mark/space) parity + class PosixSerial(SerialBase): """Serial port class POSIX implementation. Serial port configuration is @@ -386,6 +388,11 @@ class PosixSerial(SerialBase): cflag |= (TERMIOS.PARENB) elif self._parity == PARITY_ODD: cflag |= (TERMIOS.PARENB|TERMIOS.PARODD) + elif self._parity == PARITY_MARK and plat[:5] == 'linux': + cflag |= (TERMIOS.PARENB|CMSPAR|TERMIOS.PARODD) + elif self._parity == PARITY_SPACE and plat[:5] == 'linux': + cflag |= (TERMIOS.PARENB|CMSPAR) + cflag &= ~(TERMIOS.PARODD) else: raise ValueError('Invalid parity: %r' % self._parity) # setup flow control |