- /* Check for LA8 and/or LA16 devices with various VID/PIDs. */
- for (i = 0; i < ARRAY_SIZE(vid_pid); i++) {
- ret = ftdi_usb_open_desc(ftdic, vid_pid[i].vid,
- vid_pid[i].pid, vid_pid[i].iproduct, NULL);
- /* Show errors other than "device not found". */
- if (ret < 0 && ret != -3)
- sr_dbg("Error finding/opening device (%d): %s.",
- ret, ftdi_get_error_string(ftdic));
- if (ret < 0)
- continue; /* No device found, or not usable. */
-
- sr_dbg("Found %s device (%04x:%04x).",
- vid_pid[i].iproduct, vid_pid[i].vid, vid_pid[i].pid);
-
- if ((ret = add_device(i, vid_pid[i].model, &devices)) < 0)
- sr_dbg("Failed to add device: %d.", ret);
+ if ((ret = libusb_open(devlist[i], &hdl)) < 0)
+ continue;
+
+ if (des.iProduct == 0) {
+ product[0] = '\0';
+ } else if ((ret = libusb_get_string_descriptor_ascii(hdl,
+ des.iProduct, (unsigned char *)product,
+ sizeof(product))) < 0) {
+ sr_warn("Failed to get product string descriptor: %s.",
+ libusb_error_name(ret));
+ continue;
+ }
+
+ if (des.iSerialNumber == 0) {
+ serial_num[0] = '\0';
+ } else if ((ret = libusb_get_string_descriptor_ascii(hdl,
+ des.iSerialNumber, (unsigned char *)serial_num,
+ sizeof(serial_num))) < 0) {
+ sr_warn("Failed to get serial number string descriptor: %s.",
+ libusb_error_name(ret));
+ continue;
+ }
+
+ usb_get_port_path(devlist[i], connection_id, sizeof(connection_id));