/* Poll every 100ms, or whenever some data comes in. */
serial = sdi->conn;
- sr_source_add(serial->fd, G_IO_IN, 100, agdmm_receive_data, (void *)sdi);
+ serial_source_add(serial, G_IO_IN, 100, agdmm_receive_data, (void *)sdi);
return SR_OK;
}
/* Poll every 50ms, or whenever some data comes in. */
serial = sdi->conn;
- sr_source_add(serial->fd, G_IO_IN, 50,
+ serial_source_add(serial, G_IO_IN, 50,
brymen_dmm_receive_data, (void *)sdi);
return SR_OK;
/* Poll every 100ms, or whenever some data comes in. */
serial = sdi->conn;
- sr_source_add(serial->fd, G_IO_IN, 150, cem_dt_885x_receive_data,
+ serial_source_add(serial, G_IO_IN, 150, cem_dt_885x_receive_data,
(void *)sdi);
return SR_OK;
/* Poll every 500ms, or whenever some data comes in. */
serial = sdi->conn;
- sr_source_add(serial->fd, G_IO_IN, 500,
+ serial_source_add(serial, G_IO_IN, 500,
center_devs[idx].receive_data, (void *)sdi);
return SR_OK;
/* Poll every 150ms, or whenever some data comes in. */
serial = sdi->conn;
- sr_source_add(serial->fd, G_IO_IN, 150, colead_slm_receive_data,
+ serial_source_add(serial, G_IO_IN, 150, colead_slm_receive_data,
(void *)sdi);
return SR_OK;
{
struct sr_serial_dev_inst *serial = priv;
- return sr_source_add(serial->fd, events, timeout, cb, cb_data);
+ return serial_source_add(serial, events, timeout, cb, cb_data);
}
SR_PRIV int scpi_serial_source_remove(void *priv)
return SR_OK;
}
+
+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)
+{
+ return sr_source_add(serial->fd, events, timeout, cb, cb_data);
+}
/* Poll every 100ms, or whenever some data comes in. */
serial = sdi->conn;
- sr_source_add(serial->fd, G_IO_IN, 50, fluke_receive_data, (void *)sdi);
+ serial_source_add(serial, G_IO_IN, 50, fluke_receive_data, (void *)sdi);
if (serial_write(serial, "QM\r", 3) == -1) {
sr_err("Unable to send QM: %s.", strerror(errno));
/* Poll every 40ms, or whenever some data comes in. */
serial = sdi->conn;
- sr_source_add(serial->fd, G_IO_IN, 40, gmc_mh_1x_2x_receive_data,
+ serial_source_add(serial, G_IO_IN, 40, gmc_mh_1x_2x_receive_data,
(void *)sdi);
return SR_OK;
/* Our first probe is analog, the other 8 are of type 'logic'. */
/* TODO. */
- sr_source_add(devc->serial->fd, G_IO_IN, -1, mso_receive_data, cb_data);
+ serial_source_add(devc->serial, G_IO_IN, -1, mso_receive_data, cb_data);
return SR_OK;
}
/* Poll every 100ms, or whenever some data comes in. */
serial = sdi->conn;
- sr_source_add(serial->fd, G_IO_IN, 100,
+ serial_source_add(serial, G_IO_IN, 100,
mic_devs[idx].receive_data, (void *)sdi);
return SR_OK;
/* Poll every 100ms, or whenever some data comes in. */
serial = sdi->conn;
- sr_source_add(serial->fd, G_IO_IN, 100, norma_dmm_receive_data,
+ serial_source_add(serial, G_IO_IN, 100, norma_dmm_receive_data,
(void *)sdi);
return SR_OK;
/* Send header packet to the session bus. */
std_session_send_df_header(cb_data, LOG_PREFIX);
- sr_source_add(serial->fd, G_IO_IN, -1, ols_receive_data, cb_data);
+ serial_source_add(serial, G_IO_IN, -1, ols_receive_data, cb_data);
return SR_OK;
}
/* Poll every 50ms, or whenever some data comes in. */
serial = sdi->conn;
- sr_source_add(serial->fd, G_IO_IN, 50,
+ serial_source_add(serial, G_IO_IN, 50,
dmms[dmm].receive_data, (void *)sdi);
return SR_OK;
std_session_send_df_header(cb_data, LOG_PREFIX);
/* Poll every 50ms, or whenever some data comes in. */
- sr_source_add(serial->fd, G_IO_IN, 50, teleinfo_receive_data, (void *)sdi);
+ serial_source_add(serial, G_IO_IN, 50, teleinfo_receive_data, (void *)sdi);
return SR_OK;
}
/* Poll every 500ms, or whenever some data comes in. */
serial = sdi->conn;
- sr_source_add(serial->fd, G_IO_IN, 500,
+ serial_source_add(serial, G_IO_IN, 500,
tondaj_sl_814_receive_data, (void *)sdi);
return SR_OK;
uint64_t timeout_ms, int baudrate);
SR_PRIV int sr_serial_extract_options(GSList *options, const char **serial_device,
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);
#endif
/*--- hardware/common/ezusb.c -----------------------------------------------*/