diff options
author | John Michelau <john.michelau@motorola.com> | 2010-12-10 12:09:53 -0600 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2011-11-30 21:38:09 -0800 |
commit | 276fddce6fe816ab7f6626fef1da0a88d2a65362 (patch) | |
tree | d061d27f7f24d356a05ecaaf4c4b87848554325e /drivers/usb/gadget/composite.c | |
parent | 1c03ba919481c5c476a42a0b515043bc96a34667 (diff) |
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>
Diffstat (limited to 'drivers/usb/gadget/composite.c')
-rw-r--r-- | drivers/usb/gadget/composite.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index a56322c33dff..ca59b68886e2 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -431,6 +431,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; @@ -491,6 +492,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; } |