From: Joe Swantek Date: Tue, 15 Dec 2009 12:17:40 +0000 (-0500) Subject: USB: composite: Allow configurations to handle unhandled setup requests X-Git-Tag: firefly_0821_release~7613^2~831 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=292b1bcfc8ef95451f4e6ed6f4cb4c20b24dca94;p=firefly-linux-kernel-4.4.55.git USB: composite: Allow configurations to handle unhandled setup requests Signed-off-by: Mike Lockwood --- diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 134d3d50e350..3b210de14bbc 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -983,6 +983,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; }