usbdev-composite: ep0 submit should be send only once for the composite class
This commit is contained in:
parent
d014b9d384
commit
50cf84c99a
@ -1982,7 +1982,7 @@ static int cdcacm_setup(FAR struct usbdevclass_driver_s *driver,
|
|||||||
#ifndef CONFIG_CDCACM_COMPOSITE
|
#ifndef CONFIG_CDCACM_COMPOSITE
|
||||||
ret = EP_SUBMIT(dev->ep0, ctrlreq);
|
ret = EP_SUBMIT(dev->ep0, ctrlreq);
|
||||||
#else
|
#else
|
||||||
ret = composite_ep0submit(driver, dev, ctrlreq);
|
ret = composite_ep0submit(driver, dev, ctrlreq, ctrl);
|
||||||
#endif
|
#endif
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
|
@ -658,7 +658,6 @@ static int composite_setup(FAR struct usbdevclass_driver_s *driver,
|
|||||||
outlen);
|
outlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
dispatched = true;
|
|
||||||
priv->config = value;
|
priv->config = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1082,14 +1081,29 @@ void composite_uninitialize(FAR void *handle)
|
|||||||
|
|
||||||
int composite_ep0submit(FAR struct usbdevclass_driver_s *driver,
|
int composite_ep0submit(FAR struct usbdevclass_driver_s *driver,
|
||||||
FAR struct usbdev_s *dev,
|
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,
|
bool ep0submit = true;
|
||||||
* keeping this will provide us a little flexibility in the future if
|
|
||||||
* it becomes necessary to manage the completion callbacks.
|
|
||||||
*/
|
|
||||||
|
|
||||||
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 */
|
#endif /* CONFIG_USBDEV_COMPOSITE */
|
||||||
|
@ -424,7 +424,7 @@ static int usbclass_setup(FAR struct usbdevclass_driver_s *driver,
|
|||||||
{
|
{
|
||||||
ctrlreq->len = (len < ret) ? len : ret;
|
ctrlreq->len = (len < ret) ? len : ret;
|
||||||
ctrlreq->flags = USBDEV_REQFLAGS_NULLPKT;
|
ctrlreq->flags = USBDEV_REQFLAGS_NULLPKT;
|
||||||
ret = composite_ep0submit(driver, dev, ctrlreq);
|
ret = composite_ep0submit(driver, dev, ctrlreq, ctrl);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_EPRESPQ), (uint16_t)-ret);
|
usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_EPRESPQ), (uint16_t)-ret);
|
||||||
|
@ -2586,7 +2586,7 @@ static int usbclass_setup(FAR struct usbdevclass_driver_s *driver,
|
|||||||
#ifndef CONFIG_RNDIS_COMPOSITE
|
#ifndef CONFIG_RNDIS_COMPOSITE
|
||||||
ret = EP_SUBMIT(dev->ep0, ctrlreq);
|
ret = EP_SUBMIT(dev->ep0, ctrlreq);
|
||||||
#else
|
#else
|
||||||
ret = composite_ep0submit(driver, dev, ctrlreq);
|
ret = composite_ep0submit(driver, dev, ctrlreq, ctrl);
|
||||||
#endif
|
#endif
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
|
@ -816,7 +816,7 @@ static int usbmsc_setup(FAR struct usbdevclass_driver_s *driver,
|
|||||||
#ifndef CONFIG_USBMSC_COMPOSITE
|
#ifndef CONFIG_USBMSC_COMPOSITE
|
||||||
ret = EP_SUBMIT(dev->ep0, ctrlreq);
|
ret = EP_SUBMIT(dev->ep0, ctrlreq);
|
||||||
#else
|
#else
|
||||||
ret = composite_ep0submit(driver, dev, ctrlreq);
|
ret = composite_ep0submit(driver, dev, ctrlreq, ctrl);
|
||||||
#endif
|
#endif
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
|
@ -130,10 +130,12 @@ void composite_uninitialize(FAR void *handle);
|
|||||||
struct usbdevclass_driver_s;
|
struct usbdevclass_driver_s;
|
||||||
struct usbdev_s;
|
struct usbdev_s;
|
||||||
struct usbdev_req_s;
|
struct usbdev_req_s;
|
||||||
|
struct usb_ctrlreq_s;
|
||||||
|
|
||||||
int composite_ep0submit(FAR struct usbdevclass_driver_s *driver,
|
int composite_ep0submit(FAR struct usbdevclass_driver_s *driver,
|
||||||
FAR struct usbdev_s *dev,
|
FAR struct usbdev_s *dev,
|
||||||
FAR struct usbdev_req_s *ctrlreq);
|
FAR struct usbdev_req_s *ctrlreq,
|
||||||
|
FAR const struct usb_ctrlreq_s *ctrl);
|
||||||
|
|
||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
|
Loading…
Reference in New Issue
Block a user