fhandler_serial.cc: MARK and SPACE parity for serial port
This commit is contained in:
parent
05e2751665
commit
d4a756f13a
|
@ -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 ------------------ */
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue