1
0
mirror of git://sigrok.org/libserialport synced 2023-08-10 21:13:24 +03:00

windows: Always check and set ReadTotalTimeoutMultiplier.

This is not currently touched, but will be by the upcoming
sp_blocking_read_next() function.
This commit is contained in:
Martin Ling 2015-05-07 10:06:33 +01:00 committed by Uwe Hermann
parent 76222ee578
commit 0188a545c7

View File

@ -970,8 +970,10 @@ SP_API enum sp_return sp_blocking_read(struct sp_port *port, void *buf,
/* Set timeout. */ /* Set timeout. */
if (port->timeouts.ReadIntervalTimeout != 0 || if (port->timeouts.ReadIntervalTimeout != 0 ||
port->timeouts.ReadTotalTimeoutMultiplier != 0 ||
port->timeouts.ReadTotalTimeoutConstant != timeout_ms) { port->timeouts.ReadTotalTimeoutConstant != timeout_ms) {
port->timeouts.ReadIntervalTimeout = 0; port->timeouts.ReadIntervalTimeout = 0;
port->timeouts.ReadTotalTimeoutMultiplier = 0;
port->timeouts.ReadTotalTimeoutConstant = timeout_ms; port->timeouts.ReadTotalTimeoutConstant = timeout_ms;
if (SetCommTimeouts(port->hdl, &port->timeouts) == 0) if (SetCommTimeouts(port->hdl, &port->timeouts) == 0)
RETURN_FAIL("SetCommTimeouts() failed"); RETURN_FAIL("SetCommTimeouts() failed");
@ -1086,8 +1088,10 @@ SP_API enum sp_return sp_nonblocking_read(struct sp_port *port, void *buf,
/* Set timeout. */ /* Set timeout. */
if (port->timeouts.ReadIntervalTimeout != MAXDWORD || if (port->timeouts.ReadIntervalTimeout != MAXDWORD ||
port->timeouts.ReadTotalTimeoutMultiplier != 0 ||
port->timeouts.ReadTotalTimeoutConstant != 0) { port->timeouts.ReadTotalTimeoutConstant != 0) {
port->timeouts.ReadIntervalTimeout = MAXDWORD; port->timeouts.ReadIntervalTimeout = MAXDWORD;
port->timeouts.ReadTotalTimeoutMultiplier = 0;
port->timeouts.ReadTotalTimeoutConstant = 0; port->timeouts.ReadTotalTimeoutConstant = 0;
if (SetCommTimeouts(port->hdl, &port->timeouts) == 0) if (SetCommTimeouts(port->hdl, &port->timeouts) == 0)
RETURN_FAIL("SetCommTimeouts() failed"); RETURN_FAIL("SetCommTimeouts() failed");