diff options
author | ChandanaKishori Chiluveru <cchilu@codeaurora.org> | 2014-06-03 14:53:13 +0530 |
---|---|---|
committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-22 11:02:49 -0700 |
commit | d025d9d53023d9f411d3f1dcf72712ae8fa5a552 (patch) | |
tree | d801242b933acbb2b75c9e671c64bdf7a8858670 /drivers/usb/gadget | |
parent | 15d49a10511d64362bdbb597c44a3337e8f54ce7 (diff) |
usb: gadget: Ignore the second set_config from the host
Some USB hosts may send SET_CONFIGURATION with same value twice.
The current code implementation of android_work() issues disconnect
event to userspace if SetConfiguration with non-zero value is sent
twice. The Userspace application may disconnect USB and it causes
fail to connect to the USB host.
Fix this by ignoring the second time SET_CONFIGURATION request
from the host only for the same configuration value twice.
CRs-Fixed: 661220
Change-Id: Iec8dd7824fa9f371ea147784cf9137aa88a7128e
Signed-off-by: ChandanaKishori Chiluveru <cchilu@codeaurora.org>
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r-- | drivers/usb/gadget/composite.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index acb925be0482..9b1b43a80b14 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -737,6 +737,16 @@ static int set_config(struct usb_composite_dev *cdev, unsigned power = gadget_is_otg(gadget) ? 8 : 100; int tmp; + /* + * ignore 2nd time SET_CONFIGURATION + * only for same config value twice. + */ + if (cdev->config && (cdev->config->bConfigurationValue == number)) { + DBG(cdev, "already in the same config with value %d\n", + number); + return 0; + } + if (number) { list_for_each_entry(c, &cdev->configs, list) { if (c->bConfigurationValue == number) { |