aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Michelau <john.michelau@motorola.com>2010-12-10 12:09:53 -0600
committerMike Lockwood <lockwood@android.com>2010-12-11 11:01:03 -0800
commitd9d4cb3a406df016c94026b6c32935f7c4e85c09 (patch)
tree54430f7cf61479fdac9d254c3b0fc28b4ae55802
parentf861368d37ee84404fd35ea2f37e8f94aa134012 (diff)
downloadqemu-d9d4cb3a406df016c94026b6c32935f7c4e85c09.tar.gz
USB: gadget: composite: Dynamically set IAD bFirstInterface
bFirstInterface should be set equal to bInterfaceNumber of the first interface in a grouping. It's currently being set only when a composite device is bound, and it does not get updated when functions are enabled or disabled. Signed-off-by: Mike Lockwood <lockwood@android.com>
-rw-r--r--drivers/usb/gadget/composite.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 840c41e2f33..a664e299462 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -301,6 +301,7 @@ static int config_buf(struct usb_configuration *config,
{
struct usb_config_descriptor *c = buf;
struct usb_interface_descriptor *intf;
+ struct usb_interface_assoc_descriptor *iad = NULL;
void *next = buf + USB_DT_CONFIG_SIZE;
int len = USB_BUFSIZ - USB_DT_CONFIG_SIZE;
struct usb_function *f;
@@ -354,6 +355,20 @@ static int config_buf(struct usb_configuration *config,
intf->bInterfaceNumber = interfaceCount++;
else
intf->bInterfaceNumber = interfaceCount - 1;
+ if (iad) {
+ iad->bFirstInterface =
+ intf->bInterfaceNumber;
+ iad = NULL;
+ }
+ } else if (intf->bDescriptorType ==
+ USB_DT_INTERFACE_ASSOCIATION) {
+ /* This will be first if it exists. Save
+ * a pointer to it so we can properly set
+ * bFirstInterface when we process the first
+ * interface.
+ */
+ iad = (struct usb_interface_assoc_descriptor *)
+ dest;
}
dest += intf->bLength;
}