]> sigrok.org Git - libsigrok.git/blobdiff - hardware/genericdmm/api.c
genericdmm: allow for default options in DMM profiles
[libsigrok.git] / hardware / genericdmm / api.c
index 8f33226329895810c1b1fd380f9c18c357131ba9..eae25f02fe33c2bc32f62a41f22a225c12291a93 100644 (file)
 
 extern SR_PRIV struct dmmchip dmmchip_fs9922;
 
+static struct sr_hwopt victor_70c_vidpid[] = {
+       { SR_HWOPT_CONN, "1244.d237" },
+       { 0, NULL }
+};
 static struct dev_profile dev_profiles[] = {
        { "victor-70c", "Victor", "70C", &dmmchip_fs9922,
-               0x1244, 0xd237, DMM_TRANSPORT_USBHID },
-       { "mastech-va18b", "Mastech", "VA18B", NULL, 0, 0, DMM_TRANSPORT_SERIAL},
+               DMM_TRANSPORT_USBHID, victor_70c_vidpid
+       },
+       { "mastech-va18b", "Mastech", "VA18B", NULL, DMM_TRANSPORT_SERIAL, NULL},
+       { NULL, NULL, NULL, NULL, 0, NULL }
 };
 
 static const int hwcaps[] = {
@@ -56,20 +62,24 @@ SR_PRIV GSList *genericdmm_dev_insts = NULL;
 SR_PRIV libusb_context *genericdmm_usb_context = NULL;
 
 
-static int hw_init(const char *devinfo)
+static int hw_init(void)
 {
-       struct sr_dev_inst *sdi;
-       struct context *ctx;
-       int devcnt = 0;
-
-       /* Avoid compiler warnings. */
-       (void)devinfo;
 
        if (libusb_init(&genericdmm_usb_context) != 0) {
                sr_err("genericdmm: Failed to initialize USB.");
-               return 0;
+               return SR_ERR;
        }
 
+
+       return SR_OK;
+}
+
+static int hw_scan(void)
+{
+       struct sr_dev_inst *sdi;
+       struct context *ctx;
+       int devcnt = 0;
+
        if (!(ctx = g_try_malloc0(sizeof(struct context)))) {
                sr_err("genericdmm: ctx malloc failed.");
                return 0;
@@ -613,6 +623,7 @@ SR_PRIV struct sr_dev_driver genericdmm_driver_info = {
        .api_version = 1,
        .init = hw_init,
        .cleanup = hw_cleanup,
+       .scan = hw_scan,
        .dev_open = hw_dev_open,
        .dev_close = hw_dev_close,
        .dev_info_get = hw_dev_info_get,