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);
/* Free dynamically allocated resources. */
if ((devc = sdi->priv) && devc->version) {
/* 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;