From: Martin Ling Date: Wed, 4 Dec 2013 13:03:23 +0000 (+0000) Subject: scpi_serial: Flush buffers after opening port. X-Git-Tag: libsigrok-0.3.0~487 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=9dfeb81b09377cd5413c7ccd448fca2e77615084;p=libsigrok.git scpi_serial: Flush buffers after opening port. --- diff --git a/hardware/common/scpi_serial.c b/hardware/common/scpi_serial.c index 3e149252..c56e524f 100644 --- a/hardware/common/scpi_serial.c +++ b/hardware/common/scpi_serial.c @@ -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,