Support odd parity.

This commit is contained in:
Nebojsa Sabovic
2024-10-24 16:13:31 +02:00
committed by Kim Woelders
parent 2c090f3721
commit 4223a4b92a
+11 -5
View File
@@ -691,10 +691,12 @@ static unsigned int _tio_parity(const struct termios2 *tio)
{ {
unsigned int par; unsigned int par;
if ((tio->c_cflag & PARENB) && (tio->c_iflag & IGNPAR)) if (!(tio->c_cflag & PARENB))
{
par = 1; par = 1;
}
#ifdef CMSPAR #ifdef CMSPAR
else if ((tio->c_cflag & PARENB) && (tio->c_iflag & CMSPAR)) else if (tio->c_iflag & CMSPAR)
{ {
if (tio->c_cflag & PARODD) if (tio->c_cflag & PARODD)
par = 4; par = 4;
@@ -702,10 +704,14 @@ static unsigned int _tio_parity(const struct termios2 *tio)
par = 5; par = 5;
} }
#endif #endif
else if (tio->c_cflag & PARENB) else if (tio->c_cflag & PARODD)
par = 3; {
par = 2;
}
else else
par = 1; {
par = 3;
}
return par; return par;
} }