summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXinyu Chen <xinyu.chen@freescale.com>2011-12-15 14:00:10 +0800
committerXinyu Chen <xinyu.chen@freescale.com>2011-12-15 14:13:03 +0800
commitc90af831abe736ceae8ab8bb5547fd667008438f (patch)
treecad8078470110a036083ca568ae80ba3d2eb3e17
parent24c626651fe698c938e8b73584554e25dbde5167 (diff)
ENGR00170042 ums: max lun number is not reported to PC.
When there's a ctrl request of USB_DT_CONFIG, we must return a correct interface number of function(UMS here) in the interface descriptor. Otherwise the later UMS request from PC will be filtered by incorrect interface number. The old code ignore the disabled function, and assign the interface number from 0, so it's not matching index of the android config interface list. We enum all the interfaces, if it matches the function, get it's index to interface number. Signed-off-by: Xinyu Chen <xinyu.chen@freescale.com>
-rw-r--r--drivers/usb/gadget/composite.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 4ba4f8afcac2..1d8e654629ec 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -366,11 +366,11 @@ static int config_buf(struct usb_configuration *config,
while ((descriptor = *descriptors++) != NULL) {
intf = (struct usb_interface_descriptor *)dest;
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;
+ int i;
+ /* assign the correct interface number */
+ for (i = 0; i < MAX_CONFIG_INTERFACES; i++)
+ if (config->interface[i] == f)
+ intf->bInterfaceNumber = i;
}
dest += intf->bLength;
}