mirror of
git://sigrok.org/libserialport
synced 2023-08-10 21:13:24 +03:00
Fix ERROR_SEM_TIMEOUT issue on Windows.
The sp_blocking_write() call was incorrectly returning an error upon ERROR_SEM_TIMEOUT. It now returns 0 instead.
This commit is contained in:
parent
888fb45d66
commit
aee7d69195
@ -764,8 +764,14 @@ SP_API enum sp_return sp_blocking_write(struct sp_port *port, const void *buf,
|
|||||||
RETURN_INT(count);
|
RETURN_INT(count);
|
||||||
} else if (GetLastError() == ERROR_IO_PENDING) {
|
} else if (GetLastError() == ERROR_IO_PENDING) {
|
||||||
DEBUG("Waiting for write to complete");
|
DEBUG("Waiting for write to complete");
|
||||||
if (GetOverlappedResult(port->hdl, &port->write_ovl, &bytes_written, TRUE) == 0)
|
if (GetOverlappedResult(port->hdl, &port->write_ovl, &bytes_written, TRUE) == 0) {
|
||||||
|
if (GetLastError() == ERROR_SEM_TIMEOUT) {
|
||||||
|
DEBUG("Write timed out");
|
||||||
|
RETURN_INT(0);
|
||||||
|
} else {
|
||||||
RETURN_FAIL("GetOverlappedResult() failed");
|
RETURN_FAIL("GetOverlappedResult() failed");
|
||||||
|
}
|
||||||
|
}
|
||||||
DEBUG_FMT("Write completed, %d/%d bytes written", bytes_written, count);
|
DEBUG_FMT("Write completed, %d/%d bytes written", bytes_written, count);
|
||||||
RETURN_INT(bytes_written);
|
RETURN_INT(bytes_written);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user