USB: gadget: composite: Don't increment interface number for alt settings.
authorMike Lockwood <lockwood@android.com>
Fri, 26 Feb 2010 14:34:19 +0000 (09:34 -0500)
committerColin Cross <ccross@android.com>
Tue, 14 Jun 2011 16:09:05 +0000 (09:09 -0700)
Signed-off-by: Mike Lockwood <lockwood@android.com>
drivers/usb/gadget/composite.c

index cf7a5cf8503e25ba5ff0054ace23eff2b252d96b..fa785c6cfd618c8fe217038b0d7344f0309cb61a 100644 (file)
@@ -326,8 +326,13 @@ static int config_buf(struct usb_configuration *config,
                dest = next;
                while ((descriptor = *descriptors++) != NULL) {
                        intf = (struct usb_interface_descriptor *)dest;
-                       if (intf->bDescriptorType == USB_DT_INTERFACE)
-                               intf->bInterfaceNumber = interfaceCount++;
+                       if (intf->bDescriptorType == USB_DT_INTERFACE) {
+                               /* don't increment bInterfaceNumber for alternate settings */
+                               if (intf->bAlternateSetting == 0)
+                                       intf->bInterfaceNumber = interfaceCount++;
+                               else
+                                       intf->bInterfaceNumber = interfaceCount - 1;
+                       }
                        dest += intf->bLength;
                }