+static int find_resuscitated_device(struct device_info* devinfo, uint8_t bInterfaceProtocol)
+{
+ int i,j,k,l;
+ struct usb_device *dev, *child;
+ struct usb_config_descriptor config;
+ struct usb_interface interface;
+ struct usb_interface_descriptor altsetting;
+
+ /* Using the base device, attempt to find the child with the
+ * matching bInterfaceProtocol */
+ dev = devinfo->dev;
+ for (i = 0; i < dev->num_children; i++) {
+ child = dev->children[i];
+ for (j = 0; j < child->descriptor.bNumConfigurations; j++) {
+ config = child->config[j];
+ for (k = 0; k < config.bNumInterfaces; k++) {
+ interface = config.interface[k];
+ for (l = 0; l < interface.num_altsetting; l++) {
+ altsetting = interface.altsetting[l];
+ if (altsetting.bInterfaceProtocol == bInterfaceProtocol) {
+ devinfo->dev = child;
+ return 1;
+ }
+ }
+ }
+ }
+ }
+ return 0;
+}
+