From 686d33a258c7f7e8c86ee55c1d7155f3586d1f55 Mon Sep 17 00:00:00 2001 From: Mike Lockwood Date: Wed, 7 Sep 2011 09:55:12 -0700 Subject: [PATCH] USB: gadget: android: pass ctrl requests to accessory function when disabled Signed-off-by: Mike Lockwood --- drivers/usb/gadget/android.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/android.c b/drivers/usb/gadget/android.c index b13633bb684a..b7e402921c65 100644 --- a/drivers/usb/gadget/android.c +++ b/drivers/usb/gadget/android.c @@ -87,8 +87,7 @@ struct android_usb_function { /* Optional: called when the configuration is removed */ void (*unbind_config)(struct android_usb_function *, struct usb_configuration *); - /* Optional: handle ctrl requests before the device is configured - * and/or before the function is enabled */ + /* Optional: handle ctrl requests before the device is configured */ int (*ctrlrequest)(struct android_usb_function *, struct usb_composite_dev *, const struct usb_ctrlrequest *); @@ -1057,6 +1056,12 @@ android_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *c) } } + /* Special case the accessory function. + * It needs to handle control requests before it is enabled. + */ + if (value < 0) + value = acc_ctrlrequest(cdev, c); + if (value < 0) value = composite_setup(gadget, c); -- 2.34.1