mirror of
git://sigrok.org/libserialport
synced 2023-08-10 21:13:24 +03:00
win32: Add missing ClearCommError() error handling/reporting.
This commit is contained in:
parent
537942c9ed
commit
1a2a1544d7
@ -729,7 +729,8 @@ enum sp_return sp_open(struct sp_port *port, enum sp_mode flags)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
ClearCommError(port->hdl, &errors, &status);
|
if (ClearCommError(port->hdl, &errors, &status) == 0)
|
||||||
|
RETURN_FAIL("ClearCommError() failed");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ret = set_config(port, &data, &config);
|
ret = set_config(port, &data, &config);
|
||||||
@ -1200,7 +1201,7 @@ enum sp_return sp_input_waiting(struct sp_port *port)
|
|||||||
COMSTAT comstat;
|
COMSTAT comstat;
|
||||||
|
|
||||||
if (ClearCommError(port->hdl, &errors, &comstat) == 0)
|
if (ClearCommError(port->hdl, &errors, &comstat) == 0)
|
||||||
RETURN_FAIL("ClearComError() failed");
|
RETURN_FAIL("ClearCommError() failed");
|
||||||
RETURN_VALUE("%d", comstat.cbInQue);
|
RETURN_VALUE("%d", comstat.cbInQue);
|
||||||
#else
|
#else
|
||||||
int bytes_waiting;
|
int bytes_waiting;
|
||||||
@ -1223,7 +1224,7 @@ enum sp_return sp_output_waiting(struct sp_port *port)
|
|||||||
COMSTAT comstat;
|
COMSTAT comstat;
|
||||||
|
|
||||||
if (ClearCommError(port->hdl, &errors, &comstat) == 0)
|
if (ClearCommError(port->hdl, &errors, &comstat) == 0)
|
||||||
RETURN_FAIL("ClearComError() failed");
|
RETURN_FAIL("ClearCommError() failed");
|
||||||
RETURN_VALUE("%d", comstat.cbOutQue);
|
RETURN_VALUE("%d", comstat.cbOutQue);
|
||||||
#else
|
#else
|
||||||
int bytes_waiting;
|
int bytes_waiting;
|
||||||
|
Loading…
Reference in New Issue
Block a user