serial.c: fix parity != none

The flag write was wrong
This commit is contained in:
Daniel Ribeiro 2011-01-10 15:05:14 -02:00
parent 43275b4712
commit ac4a2ea45a
1 changed files with 4 additions and 3 deletions

View File

@ -228,16 +228,17 @@ int serial_set_params(int fd, int speed, int bits, int parity, int stopbits,
return SIGROK_ERR;
}
term.c_iflag &= ~(IGNPAR | PARODD | PARENB);
term.c_iflag &= ~IGNPAR;
term.c_cflag &= ~(PARODD | PARENB);
switch (parity) {
case 0:
term.c_iflag |= IGNPAR;
break;
case 1:
term.c_iflag |= PARENB;
term.c_cflag |= PARENB;
break;
case 2:
term.c_iflag |= PARENB | PARODD;
term.c_cflag |= PARENB | PARODD;
break;
default:
return SIGROK_ERR;