diff options
author | Xinyu Chen <xinyu.chen@freescale.com> | 2011-12-20 18:01:45 +0800 |
---|---|---|
committer | Xinyu Chen <xinyu.chen@freescale.com> | 2011-12-20 18:01:45 +0800 |
commit | 60b14c68aac6f1e7be89dcec571d5e0a7695ad91 (patch) | |
tree | 21c53e317c04e92a2a4a4239f972e9b8184b608c | |
parent | c90af831abe736ceae8ab8bb5547fd667008438f (diff) |
ENGR00170633-1 usb composite: Fix the interface count in DT CONFIG
The previous patch lost one fix to interface count, which cause
only one interface in the gadget device, and adb can not
work. Here fix the count issue, and add AlternateSetting logic.
Signed-off-by: Xinyu Chen <Xinyu.chen@freescale.com>
-rw-r--r-- | drivers/usb/gadget/composite.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 1d8e654629ec..7b154f529972 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -323,6 +323,7 @@ static int config_buf(struct usb_configuration *config, struct usb_function *f; int status; int interfaceCount = 0; + int lastIf = 0; u8 *dest; /* write the config descriptor */ @@ -368,9 +369,17 @@ static int config_buf(struct usb_configuration *config, if (intf->bDescriptorType == USB_DT_INTERFACE) { int i; /* assign the correct interface number */ - for (i = 0; i < MAX_CONFIG_INTERFACES; i++) - if (config->interface[i] == f) - intf->bInterfaceNumber = i; + if (intf->bAlternateSetting != 0) + intf->bInterfaceNumber = lastIf; + else { + for (i = 0; i < MAX_CONFIG_INTERFACES; i++) + if (config->interface[i] == f) { + intf->bInterfaceNumber = i; + lastIf = i; + break; + } + interfaceCount++; + } } dest += intf->bLength; } |