4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-19 04:49:25 +08:00

fhandler_serial.cc: MARK and SPACE parity for serial port

This commit is contained in:
Marek Smetana 2021-02-01 22:02:14 +01:00 committed by Corinna Vinschen
parent 05e2751665
commit d4a756f13a
2 changed files with 11 additions and 1 deletions

View File

@ -727,7 +727,12 @@ fhandler_serial::tcsetattr (int action, const struct termios *t)
/* -------------- Set parity ------------------ */
if (t->c_cflag & PARENB)
state.Parity = (t->c_cflag & PARODD) ? ODDPARITY : EVENPARITY;
{
if(t->c_cflag & CMSPAR)
state.Parity = (t->c_cflag & PARODD) ? MARKPARITY : SPACEPARITY;
else
state.Parity = (t->c_cflag & PARODD) ? ODDPARITY : EVENPARITY;
}
else
state.Parity = NOPARITY;
@ -1068,6 +1073,10 @@ fhandler_serial::tcgetattr (struct termios *t)
t->c_cflag |= (PARENB | PARODD);
if (state.Parity == EVENPARITY)
t->c_cflag |= PARENB;
if (state.Parity == MARKPARITY)
t->c_cflag |= (PARENB | PARODD | CMSPAR);
if (state.Parity == SPACEPARITY)
t->c_cflag |= (PARENB | CMSPAR);
/* -------------- Parity errors ------------------ */

View File

@ -206,6 +206,7 @@ POSIX commands */
#define CRTSXOFF 0x04000
#define CRTSCTS 0x08000
#define CMSPAR 0x40000000 /* Mark or space (stick) parity. */
/* lflag bits */
#define ISIG 0x0001