summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES.txt1
-rw-r--r--serial/serialposix.py7
2 files changed, 8 insertions, 0 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 2433647..c162253 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -479,6 +479,7 @@ Bugfixes (win32):
Version 2.8 2014-xx-xx
---------------------------
- [FTR pyserial:37] Support fileno() function in the socket protocol
+- Posix: [Patch pyserial:31] Mark/space parity on Linux
Bugfixes:
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