usb: gadget: composite: let USB functions process ctrl reqs in cfg0
It can sometimes be necessary for gadget drivers to process non-standard control requests, which host devices can send without having sent USB_REQ_SET_CONFIGURATION. Therefore, the req_match() usb_function method is enhanced with the new parameter "config0". When a USB configuration is active, this parameter is false. When a non-core control request is processed in composite_setup(), without an active configuration, req_match() of the USB functions of all available configurations which implement this function, is called with config0=true. Then the control request gets processed by the first usb_function instance whose req_match() returns true. Signed-off-by: Felix Hädicke <felixhaedicke@web.de> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
This commit is contained in:

committed by
Felipe Balbi

parent
54dfce6d07
commit
1a00b457a5
@@ -889,13 +889,17 @@ static void printer_soft_reset(struct printer_dev *dev)
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
static bool gprinter_req_match(struct usb_function *f,
|
||||
const struct usb_ctrlrequest *ctrl)
|
||||
const struct usb_ctrlrequest *ctrl,
|
||||
bool config0)
|
||||
{
|
||||
struct printer_dev *dev = func_to_printer(f);
|
||||
u16 w_index = le16_to_cpu(ctrl->wIndex);
|
||||
u16 w_value = le16_to_cpu(ctrl->wValue);
|
||||
u16 w_length = le16_to_cpu(ctrl->wLength);
|
||||
|
||||
if (config0)
|
||||
return false;
|
||||
|
||||
if ((ctrl->bRequestType & USB_RECIP_MASK) != USB_RECIP_INTERFACE ||
|
||||
(ctrl->bRequestType & USB_TYPE_MASK) != USB_TYPE_CLASS)
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user