Route sr_source_remove for all serial devices through a wrapper.

This commit is contained in:
Martin Ling 2013-12-02 13:06:08 +00:00
parent abc4b3356d
commit 7faa3e8821
6 changed files with 10 additions and 4 deletions

View File

@ -60,7 +60,7 @@ SR_PRIV int scpi_serial_source_remove(void *priv)
{ {
struct sr_serial_dev_inst *serial = 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) SR_PRIV int scpi_serial_send(void *priv, const char *command)

View File

@ -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); 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);
}

View File

@ -294,7 +294,7 @@ SR_PRIV void stop_acquisition(const struct sr_dev_inst *sdi)
struct dev_context *devc; struct dev_context *devc;
devc = sdi->priv; devc = sdi->priv;
sr_source_remove(devc->serial->fd); serial_source_remove(devc->serial);
/* Terminate session */ /* Terminate session */
packet.type = SR_DF_END; packet.type = SR_DF_END;

View File

@ -334,7 +334,7 @@ SR_PRIV void abort_acquisition(const struct sr_dev_inst *sdi)
struct sr_serial_dev_inst *serial; struct sr_serial_dev_inst *serial;
serial = sdi->conn; serial = sdi->conn;
sr_source_remove(serial->fd); serial_source_remove(serial);
/* Terminate session */ /* Terminate session */
packet.type = SR_DF_END; packet.type = SR_DF_END;

View File

@ -230,6 +230,7 @@ SR_PRIV int sr_serial_extract_options(GSList *options, const char **serial_devic
const char **serial_options); const char **serial_options);
SR_PRIV int serial_source_add(struct sr_serial_dev_inst *serial, int events, 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); int timeout, sr_receive_data_callback_t cb, void *cb_data);
SR_PRIV int serial_source_remove(struct sr_serial_dev_inst *serial);
#endif #endif
/*--- hardware/common/ezusb.c -----------------------------------------------*/ /*--- hardware/common/ezusb.c -----------------------------------------------*/

2
std.c
View File

@ -143,7 +143,7 @@ SR_PRIV int std_dev_acquisition_stop_serial(struct sr_dev_inst *sdi,
sr_dbg("%sStopping acquisition.", prefix); 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); sr_err("%sFailed to remove source: %d.", prefix, ret);
return ret; return ret;
} }