]> sigrok.org Git - libserialport.git/commitdiff
windows: Ignore fParity flag which is always 0 after GetCommState().
authorMartin Ling <redacted>
Fri, 7 Feb 2020 11:16:32 +0000 (11:16 +0000)
committerMartin Ling <redacted>
Fri, 7 Feb 2020 14:00:35 +0000 (14:00 +0000)
This is a known bug in Windows: https://stackoverflow.com/a/36650872

Reported here: https://github.com/martinling/libserialport/issues/36

serialport.c

index 72010913ae4e7a2cc4772112afc857350e7a37f0..c22e94fa4bbbf52f988855378c0297585a5cd8dd 100644 (file)
@@ -1648,28 +1648,25 @@ static enum sp_return get_config(struct sp_port *port, struct port_data *data,
 
        config->bits = data->dcb.ByteSize;
 
-       if (data->dcb.fParity)
-               switch (data->dcb.Parity) {
-               case NOPARITY:
-                       config->parity = SP_PARITY_NONE;
-                       break;
-               case ODDPARITY:
-                       config->parity = SP_PARITY_ODD;
-                       break;
-               case EVENPARITY:
-                       config->parity = SP_PARITY_EVEN;
-                       break;
-               case MARKPARITY:
-                       config->parity = SP_PARITY_MARK;
-                       break;
-               case SPACEPARITY:
-                       config->parity = SP_PARITY_SPACE;
-                       break;
-               default:
-                       config->parity = -1;
-               }
-       else
+       switch (data->dcb.Parity) {
+       case NOPARITY:
                config->parity = SP_PARITY_NONE;
+               break;
+       case ODDPARITY:
+               config->parity = SP_PARITY_ODD;
+               break;
+       case EVENPARITY:
+               config->parity = SP_PARITY_EVEN;
+               break;
+       case MARKPARITY:
+               config->parity = SP_PARITY_MARK;
+               break;
+       case SPACEPARITY:
+               config->parity = SP_PARITY_SPACE;
+               break;
+       default:
+               config->parity = -1;
+       }
 
        switch (data->dcb.StopBits) {
        case ONESTOPBIT: