mirror of
https://github.com/apache/nuttx.git
synced 2026-03-26 18:23:50 +08:00
usbdev-composite: ep0 submit should be send only once for the composite class
This commit is contained in:
committed by
Alan Carvalho de Assis
parent
d014b9d384
commit
50cf84c99a
@@ -658,7 +658,6 @@ static int composite_setup(FAR struct usbdevclass_driver_s *driver,
|
||||
outlen);
|
||||
}
|
||||
|
||||
dispatched = true;
|
||||
priv->config = value;
|
||||
}
|
||||
}
|
||||
@@ -1082,14 +1081,29 @@ void composite_uninitialize(FAR void *handle)
|
||||
|
||||
int composite_ep0submit(FAR struct usbdevclass_driver_s *driver,
|
||||
FAR struct usbdev_s *dev,
|
||||
FAR struct usbdev_req_s *ctrlreq)
|
||||
FAR struct usbdev_req_s *ctrlreq,
|
||||
FAR const struct usb_ctrlreq_s *ctrl)
|
||||
{
|
||||
/* This function is not really necessary in the current design. However,
|
||||
* keeping this will provide us a little flexibility in the future if
|
||||
* it becomes necessary to manage the completion callbacks.
|
||||
*/
|
||||
bool ep0submit = true;
|
||||
|
||||
return EP_SUBMIT(dev->ep0, ctrlreq);
|
||||
/* Some EP0 responses must be send only once from the composite class */
|
||||
|
||||
if ((ctrl->type & USB_REQ_TYPE_MASK) == USB_REQ_TYPE_STANDARD)
|
||||
{
|
||||
if (ctrl->req == USB_REQ_SETCONFIGURATION)
|
||||
{
|
||||
ep0submit = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (ep0submit)
|
||||
{
|
||||
return EP_SUBMIT(dev->ep0, ctrlreq);
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CONFIG_USBDEV_COMPOSITE */
|
||||
|
||||
Reference in New Issue
Block a user