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; return SIGROK_ERR;
} }
term.c_iflag &= ~(IGNPAR | PARODD | PARENB); term.c_iflag &= ~IGNPAR;
term.c_cflag &= ~(PARODD | PARENB);
switch (parity) { switch (parity) {
case 0: case 0:
term.c_iflag |= IGNPAR; term.c_iflag |= IGNPAR;
break; break;
case 1: case 1:
term.c_iflag |= PARENB; term.c_cflag |= PARENB;
break; break;
case 2: case 2:
term.c_iflag |= PARENB | PARODD; term.c_cflag |= PARENB | PARODD;
break; break;
default: default:
return SIGROK_ERR; return SIGROK_ERR;