- if (sdi->status == SR_ST_INITIALIZING) {
- /*
- * This device was renumerating last time we touched it.
- * opendev() guarantees we've waited long enough for it to
- * have booted properly, so now we need to find it on
- * the bus and record its new address.
- */
- skip = 0;
- for (i = 0; devlist[i]; i++) {
- /* TODO: Error handling. */
- err = opendev2(device_index, &sdi, devlist[i], &des,
- &skip, USB_VENDOR, USB_PRODUCT,
- USB_INTERFACE);
- }
- } else if (sdi->status == SR_ST_INACTIVE) {
- /*
- * This device is fully enumerated, so we need to find this
- * device by vendor, product, bus and address.
- */
- libusb_get_device_list(usb_context, &devlist);
- for (i = 0; devlist[i]; i++) {
- /* TODO: Error handling. */
- err = opendev3(&sdi, devlist[i], &des, USB_VENDOR,
- USB_PRODUCT, USB_INTERFACE);
+ for (i = 0; devlist[i]; i++) {
+ if ((err = libusb_get_device_descriptor(devlist[i], &des))) {
+ sr_err("failed to get device descriptor: %d", err);
+ continue;