Add support for space parity

This commit is contained in:
Martin Lund 2022-07-11 14:55:54 +02:00
parent bf972bd2f9
commit 360deb3c72
2 changed files with 10 additions and 2 deletions

View file

@ -34,9 +34,11 @@ Set flow control (default: none).
Set stop bits (default: 1).
.TP
.BR \-p ", " "\-\-parity odd" | even | none | mark
.BR \-p ", " "\-\-parity odd" | even | none | mark | space
Set parity (default: none).
Note: With mark parity the parity bit is always 0. With space parity the parity bit is always 1. Not all platforms support mark and space parity.
.TP
.BR \-o ", " "\-\-output\-delay " \fI<ms>

View file

@ -625,10 +625,16 @@ void tty_configure(void)
}
else if ( strcmp("mark", option.parity) == 0)
{
tio.c_cflag &= ~PARENB;
tio.c_cflag |= PARENB;
tio.c_cflag |= PARODD;
tio.c_cflag |= CMSPAR;
}
else if ( strcmp("space", option.parity) == 0)
{
tio.c_cflag |= PARENB;
tio.c_cflag &= ~PARODD;
tio.c_cflag |= CMSPAR;
}
else
{
error_printf("Invalid parity");