static int dev_close(struct sr_dev_inst *sdi)
{
- struct sr_serial_dev_inst *serial;
struct dev_context *devc;
- serial = sdi->conn;
- if (serial && serial->fd != -1) {
- serial_close(serial);
- sdi->status = SR_ST_INACTIVE;
- }
+ std_serial_dev_close(sdi);
sdi->status = SR_ST_INACTIVE;
/* 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;