]> sigrok.org Git - libsigrok.git/blobdiff - hardware/gmc-mh-1x-2x/api.c
Use std_serial_dev_close() to replace matching dev_close functions.
[libsigrok.git] / hardware / gmc-mh-1x-2x / api.c
index 42969412025c7ebc7d1e8cdfe0f7d9c1142eff6d..acdf8413b078c18fc2fce0b01ce298806d6c984e 100644 (file)
@@ -234,14 +234,9 @@ static int dev_open(struct sr_dev_inst *sdi)
 
 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;
 
@@ -363,7 +358,7 @@ static int dev_acq_start_1x_2x_rs232(const struct sr_dev_inst *sdi,
 
        /* 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;