- /*
- * Should check the bus here, since we know
- * that already... but what are we going to do
- * if it doesn't match after the right number
- * of skips?
- */
- if (!(err = libusb_open(devlist[i],
- &(sdi->usb->devhdl)))) {
- sdi->usb->address = libusb_get_device_address(devlist [i]);
- sdi->status = ST_ACTIVE;
- g_message("opened device %d on %d.%d "
- "interface %d",
- sdi->index, sdi->usb->bus,
- sdi->usb->address, USB_INTERFACE);
- } else {
- g_warning("failed to open device: %d",
- err);
- sdi = NULL;
- }
- }
- }
- } else if (sdi->status == 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++) {
- if ((err =
- libusb_get_device_descriptor(devlist[i], &des))) {
- g_warning("failed to get device descriptor: %d",
- err);
+ if (sdi->status == SR_ST_INITIALIZING) {
+ if (skip != device_index) {
+ /* Skip devices of this type that aren't the one we want. */
+ skip += 1;