- if (!(sdi = get_sigrok_device_instance(device_instances, device_index)))
- return NULL;
-
- libusb_get_device_list(usb_context, &devlist);
- if (sdi->status == 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);
- }
- } 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++) {
- /* TODO: Error handling. */
- err = opendev3(device_index, &sdi, devlist[i], &des);
- }
- } else {
- /* Status must be ST_ACTIVE, i.e. already in use... */
- sdi = NULL;