From: Martin Ling Date: Mon, 2 Dec 2013 13:06:08 +0000 (+0000) Subject: Route sr_source_remove for all serial devices through a wrapper. X-Git-Tag: libsigrok-0.3.0~461 X-Git-Url: http://sigrok.org/gitweb/?p=libsigrok.git;a=commitdiff_plain;h=7faa3e8821735e063e17fcad326c68aae14fe907 Route sr_source_remove for all serial devices through a wrapper. --- diff --git a/hardware/common/scpi_serial.c b/hardware/common/scpi_serial.c index 5c07c43c..6c5415c5 100644 --- a/hardware/common/scpi_serial.c +++ b/hardware/common/scpi_serial.c @@ -60,7 +60,7 @@ SR_PRIV int scpi_serial_source_remove(void *priv) { struct sr_serial_dev_inst *serial = priv; - return sr_source_remove(serial->fd); + return serial_source_remove(serial); } SR_PRIV int scpi_serial_send(void *priv, const char *command) diff --git a/hardware/common/serial.c b/hardware/common/serial.c index a0de0de5..af80356a 100644 --- a/hardware/common/serial.c +++ b/hardware/common/serial.c @@ -644,3 +644,8 @@ SR_PRIV int serial_source_add(struct sr_serial_dev_inst *serial, int events, { return sr_source_add(serial->fd, events, timeout, cb, cb_data); } + +SR_PRIV int serial_source_remove(struct sr_serial_dev_inst *serial) +{ + return sr_source_remove(serial->fd); +} diff --git a/hardware/link-mso19/protocol.c b/hardware/link-mso19/protocol.c index 19840efb..fbb50054 100644 --- a/hardware/link-mso19/protocol.c +++ b/hardware/link-mso19/protocol.c @@ -294,7 +294,7 @@ SR_PRIV void stop_acquisition(const struct sr_dev_inst *sdi) struct dev_context *devc; devc = sdi->priv; - sr_source_remove(devc->serial->fd); + serial_source_remove(devc->serial); /* Terminate session */ packet.type = SR_DF_END; diff --git a/hardware/openbench-logic-sniffer/protocol.c b/hardware/openbench-logic-sniffer/protocol.c index bd9e55bf..09306dbe 100644 --- a/hardware/openbench-logic-sniffer/protocol.c +++ b/hardware/openbench-logic-sniffer/protocol.c @@ -334,7 +334,7 @@ SR_PRIV void abort_acquisition(const struct sr_dev_inst *sdi) struct sr_serial_dev_inst *serial; serial = sdi->conn; - sr_source_remove(serial->fd); + serial_source_remove(serial); /* Terminate session */ packet.type = SR_DF_END; diff --git a/libsigrok-internal.h b/libsigrok-internal.h index e4eef91e..b9b92ebb 100644 --- a/libsigrok-internal.h +++ b/libsigrok-internal.h @@ -230,6 +230,7 @@ SR_PRIV int sr_serial_extract_options(GSList *options, const char **serial_devic const char **serial_options); SR_PRIV int serial_source_add(struct sr_serial_dev_inst *serial, int events, int timeout, sr_receive_data_callback_t cb, void *cb_data); +SR_PRIV int serial_source_remove(struct sr_serial_dev_inst *serial); #endif /*--- hardware/common/ezusb.c -----------------------------------------------*/ diff --git a/std.c b/std.c index ed37abea..7837d35a 100644 --- a/std.c +++ b/std.c @@ -143,7 +143,7 @@ SR_PRIV int std_dev_acquisition_stop_serial(struct sr_dev_inst *sdi, sr_dbg("%sStopping acquisition.", prefix); - if ((ret = sr_source_remove(serial->fd)) < 0) { + if ((ret = serial_source_remove(serial)) < 0) { sr_err("%sFailed to remove source: %d.", prefix, ret); return ret; }