scpi_serial: Flush buffers after opening port.

This commit is contained in:
Martin Ling 2013-12-04 13:03:23 +00:00
parent 0dc7b43eb7
commit 9dfeb81b09
1 changed files with 7 additions and 1 deletions

View File

@ -39,7 +39,13 @@ SR_PRIV int scpi_serial_open(void *priv)
{
struct sr_serial_dev_inst *serial = priv;
return serial_open(serial, SERIAL_RDWR | SERIAL_NONBLOCK);
if (serial_open(serial, SERIAL_RDWR | SERIAL_NONBLOCK) != SR_OK)
return SR_ERR;
if (serial_flush(serial) != SR_OK)
return SR_ERR;
return SR_OK;
}
SR_PRIV int scpi_serial_source_add(void *priv, int events, int timeout,