From: Martin Ling Date: Fri, 7 Feb 2020 11:16:32 +0000 (+0000) Subject: windows: Ignore fParity flag which is always 0 after GetCommState(). X-Git-Tag: libserialport-0.1.2~21 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=2913355f7e78de7bd79d673b0b46dbcfc9fa687c;p=libserialport.git windows: Ignore fParity flag which is always 0 after GetCommState(). This is a known bug in Windows: https://stackoverflow.com/a/36650872 Reported here: https://github.com/martinling/libserialport/issues/36 --- diff --git a/serialport.c b/serialport.c index 7201091..c22e94f 100644 --- a/serialport.c +++ b/serialport.c @@ -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: