]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/ikalogic-scanalogic2/api.c
fx2lafw: Publish driver options.
[libsigrok.git] / src / hardware / ikalogic-scanalogic2 / api.c
index e9b7327ce5b34db3b9ce667a2d545d61249fe0ed..d459210f12a0cfcfbc7682d7c6ec2a68e9b7691e 100644 (file)
@@ -70,8 +70,6 @@ static GSList *scan(GSList *options)
        struct sr_usb_dev_inst *usb;
        struct device_info dev_info;
        int ret, i;
-       char *fw_ver_str;
-       char connection_id[64];
 
        (void)options;
 
@@ -114,38 +112,16 @@ static GSList *scan(GSList *options)
                        continue;
                }
 
-               fw_ver_str = g_strdup_printf("%u.%u", dev_info.fw_ver_major,
-                       dev_info.fw_ver_minor);
-               if (!fw_ver_str) {
-                       sr_err("Firmware string malloc failed.");
-                       sr_usb_dev_inst_free(usb);
-                       libusb_free_transfer(devc->xfer_in);
-                       libusb_free_transfer(devc->xfer_out);
-                       g_free(devc);
-                       continue;
-               }
-
-               sdi = sr_dev_inst_new(SR_ST_INACTIVE, VENDOR_NAME,
-                       MODEL_NAME, fw_ver_str);
-               g_free(fw_ver_str);
-               if (!sdi) {
-                       sr_err("sr_dev_inst_new failed.");
-                       sr_usb_dev_inst_free(usb);
-                       libusb_free_transfer(devc->xfer_in);
-                       libusb_free_transfer(devc->xfer_out);
-                       g_free(devc);
-                       continue;
-               }
-
-               usb_get_port_path(libusb_get_device(usb->devhdl),
-                               connection_id, sizeof(connection_id));
-
+               sdi = sr_dev_inst_new();
+               sdi->status = SR_ST_INACTIVE;
+               sdi->vendor = g_strdup(VENDOR_NAME);
+               sdi->model = g_strdup(MODEL_NAME);
+               sdi->version = g_strdup_printf("%u.%u", dev_info.fw_ver_major, dev_info.fw_ver_minor);
+               sdi->serial_num = g_strdup_printf("%d", dev_info.serial);
                sdi->priv = devc;
                sdi->driver = di;
                sdi->inst_type = SR_INST_USB;
                sdi->conn = usb;
-               sdi->serial_num = g_strdup_printf("%d", dev_info.serial);
-               sdi->connection_id = g_strdup(connection_id);
 
                for (i = 0; channel_names[i]; i++) {
                        ch = sr_channel_new(i, SR_CHANNEL_LOGIC, TRUE,