]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/uni-t-dmm/api.c
Add helper function for scan completion
[libsigrok.git] / src / hardware / uni-t-dmm / api.c
index 8f1d83cdcee5c68a27ce1d5a3198766f69cbc2c5..02e301cc2a7841ab8d149adb8a63af6b84e2b901 100644 (file)
@@ -87,15 +87,13 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
                sdi->vendor = g_strdup(dmm->vendor);
                sdi->model = g_strdup(dmm->device);
                sdi->priv = devc;
-               sdi->driver = di;
                sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "P1");
                sdi->inst_type = SR_INST_USB;
                sdi->conn = usb;
-               drvc->instances = g_slist_append(drvc->instances, sdi);
                devices = g_slist_append(devices, sdi);
        }
 
-       return devices;
+       return std_scan_complete(di, devices);
 }
 
 static int dev_open(struct sr_dev_inst *sdi)
@@ -185,7 +183,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
 
 #define DMM(ID, CHIPSET, VENDOR, MODEL, BAUDRATE, PACKETSIZE, \
                        VALID, PARSE, DETAILS) \
-    &(struct dmm_info) { \
+    &((struct dmm_info) { \
                { \
                        .name = ID, \
                        .longname = VENDOR " " MODEL, \
@@ -205,9 +203,9 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
                }, \
                VENDOR, MODEL, BAUDRATE, PACKETSIZE, \
                VALID, PARSE, DETAILS, sizeof(struct CHIPSET##_info) \
-       }
+       }).di
 
-SR_PRIV const struct dmm_info *uni_t_dmm_drivers[] = {
+SR_REGISTER_DEV_DRIVER_LIST(uni_t_dmm_drivers,
        DMM(
                "tecpel-dmm-8061", fs9721,
                "Tecpel", "DMM-8061", 2400,
@@ -377,5 +375,4 @@ SR_PRIV const struct dmm_info *uni_t_dmm_drivers[] = {
                sr_es519xx_19200_11b_packet_valid, sr_es519xx_19200_11b_parse,
                NULL
        ),
-       NULL
-};
+);