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
This commit is contained in:
Martin Ling 2020-02-07 11:16:32 +00:00
parent 6711e43e9b
commit 2913355f7e
1 changed files with 18 additions and 21 deletions

View 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: