projects
/
firefly-linux-kernel-4.4.55.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e2dc503
)
USB: composite: Add support for functions overriding USB_DT_STRING descriptors
author
Mike Lockwood
<lockwood@android.com>
Fri, 16 Apr 2010 19:32:15 +0000
(15:32 -0400)
committer
Colin Cross
<ccross@android.com>
Tue, 14 Jun 2011 16:09:07 +0000
(09:09 -0700)
Needed for MTP support.
Signed-off-by: Mike Lockwood <lockwood@android.com>
drivers/usb/gadget/composite.c
patch
|
blob
|
history
diff --git
a/drivers/usb/gadget/composite.c
b/drivers/usb/gadget/composite.c
index e15c0b6a5849a647c48c5f02fb70ce80b8a8998c..03b02876ba18dd22702c6fc190700bb0f4e44d37 100644
(file)
--- a/
drivers/usb/gadget/composite.c
+++ b/
drivers/usb/gadget/composite.c
@@
-931,6
+931,21
@@
composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
case USB_DT_STRING:
value = get_string(cdev, req->buf,
w_index, w_value & 0xff);
+
+ /* Allow functions to handle USB_DT_STRING.
+ * This is required for MTP.
+ */
+ if (value < 0) {
+ struct usb_configuration *cfg;
+ list_for_each_entry(cfg, &cdev->configs, list) {
+ if (cfg && cfg->setup) {
+ value = cfg->setup(cfg, ctrl);
+ if (value >= 0)
+ break;
+ }
+ }
+ }
+
if (value >= 0)
value = min(w_length, (u16) value);
break;