mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 12:17:12 +09:00
USB: composite: Add support for functions overriding USB_DT_STRING descriptors
Needed for MTP support. Signed-off-by: Mike Lockwood <lockwood@android.com>
This commit is contained in:
committed by
Colin Cross
parent
e2dc503c42
commit
fb52b002c2
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user