Non-POSIX parity (mark/space) with Python-Serial on Linux.

Nizamov Shawkat nizamov.shawkat at gmail.com
Mon Nov 21 09:26:48 EST 2011


2011/11/21  <mlenz at nocturnal.org>:
> I'm working on a project where I need to communicate with some devices via modem which have the possibility of using MARK and SPACE parity.  These are not defined by POSIX and therefore are not directly supported under Linux.
>
> I've found the following discussion on the topic:
>
> http://www.lothosoft.ch/thomas/libmip/markspaceparity.php
>
> and I have been trying to use this information (since the TERMIOS module is available) to proceed with the communication.
>
> I was able to use minicom to determine that the first device I started testing with uses 7M1 but cannot figure out how to implement the solution described by the author above.
>


"The modes 7M1 (7 data bits, MARK parity, 1 stop bit) and 7S1 (7 data
bits, SPACE parity, 1 stop bit) can easily be emulated using 8N1 (0
data bits, NO parity, 1 stop bit) and setting the 8th data bit to 1
resp. 0. This is relatively simple to implement and cannot be
distinguished by the receiver."

It means that 7M1 === 8N1. Set 8N1 mode on your side and 7M1 on the
other side. I really do not understand what is the reason to have
dedicated 7M1 or 7S1 mode - it is no different from regular 8 bit mode
from the hardware point of view. From the software point of view it is
just the matter of the definition of the highest bit. In other words,
7M1/7S1 are two complementary subsets of a single 8N1 set.

HTH



More information about the Python-list mailing list