From 19e2a3e2bad18d2669adc8bd0e81b526a750a66e Mon Sep 17 00:00:00 2001 From: Joe Swantek Date: Tue, 15 Dec 2009 07:17:40 -0500 Subject: [PATCH] USB: composite: Allow configurations to handle unhandled setup requests Signed-off-by: Mike Lockwood --- drivers/usb/gadget/composite.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 1659a11dc18c..e69a0ac3bf6f 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -937,6 +937,25 @@ unknown: value = c->setup(c, ctrl); } + /* If the vendor request is not processed (value < 0), + * call all device registered configure setup callbacks + * to process it. + * This is used to handle the following cases: + * - vendor request is for the device and arrives before + * setconfiguration. + * - Some devices are required to handle vendor request before + * setconfiguration such as MTP, USBNET. + */ + + if (value < 0) { + struct usb_configuration *cfg; + + list_for_each_entry(cfg, &cdev->configs, list) { + if (cfg && cfg->setup) + value = cfg->setup(cfg, ctrl); + } + } + goto done; } -- 2.34.1