Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loss of parity setting under Windows OS. #36

Closed
brickpool opened this issue Jan 8, 2020 · 1 comment
Closed

Loss of parity setting under Windows OS. #36

brickpool opened this issue Jan 8, 2020 · 1 comment

Comments

@brickpool
Copy link

This problem only applies to Windows OS!

There are two parameters member of dcb structure that control the Parity settings: fParity and Parity. Windows OS should have a bug with the function GetCommState: fParity return always FALSE: (see https://stackoverflow.com/a/36650872/12342329).

Every call of get_config (file serialport.c) resets the parity setting of the config structure which have previously made.

static enum sp_return get_config(struct sp_port *port, struct port_data *data,
	struct sp_port_config *config)
{
...
#ifdef _WIN32
	if (!GetCommState(port->hdl, &data->dcb))
		RETURN_FAIL("GetCommState() failed");
...
	if (data->dcb.fParity)
		switch (data->dcb.Parity) {
...		
	}
	else
		config->parity = SP_PARITY_NONE;
...

if (!GetCommState(port->hdl, &data->dcb))

if (data->dcb.fParity)

config->parity = SP_PARITY_NONE;

martinling added a commit that referenced this issue Feb 7, 2020
@martinling
Copy link
Owner

Thanks for the heads up on this. Fixed in 42c7d87.

martinling added a commit that referenced this issue Feb 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants