]> sigrok.org Git - libsigrok.git/blobdiff - hardware/common/serial.c
serial.c: fix parity != none
[libsigrok.git] / hardware / common / serial.c
index cebca29e418dd833007c37572a747d2c84d85cbc..18b62d0c048ba1ddff72ee4596c15a23d118fad0 100644 (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;