X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fgenericdmm%2Fapi.c;h=eae25f02fe33c2bc32f62a41f22a225c12291a93;hb=7fc754a0db73b473fb5c70f59165b43dc682bf1a;hp=8f33226329895810c1b1fd380f9c18c357131ba9;hpb=45c59c8bdd01954f9214fe7b869d92c55415d109;p=libsigrok.git diff --git a/hardware/genericdmm/api.c b/hardware/genericdmm/api.c index 8f332263..eae25f02 100644 --- a/hardware/genericdmm/api.c +++ b/hardware/genericdmm/api.c @@ -29,10 +29,16 @@ 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,