From bed53538e87453c329d4f62cd25dfea548b354d4 Mon Sep 17 00:00:00 2001 From: raiden00pl Date: Thu, 23 Mar 2023 12:55:29 +0100 Subject: [PATCH] rndis: EP0 belongs to composite class if composite enabled --- drivers/usbdev/rndis.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/usbdev/rndis.c b/drivers/usbdev/rndis.c index d260e9a7a7..6e38074ae4 100644 --- a/drivers/usbdev/rndis.c +++ b/drivers/usbdev/rndis.c @@ -1728,14 +1728,19 @@ static void rndis_wrcomplete(FAR struct usbdev_ep_s *ep, static void usbclass_ep0incomplete(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s *req) { - struct rndis_dev_s *priv = (FAR struct rndis_dev_s *)ep->priv; + FAR struct rndis_dev_s *priv; + if (req->result || req->xfrd != req->len) { usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_REQRESULT), (uint16_t)-req->result); } - else if (req->len > 0 && req->priv == priv->response_queue) + else if (req->len > 0 && req->priv) { + /* Get EP0 request private data */ + + priv = (FAR struct rndis_dev_s *)req->priv; + /* This transfer was from the response queue, * subtract remaining byte count. */ @@ -1761,7 +1766,7 @@ static void usbclass_ep0incomplete(FAR struct usbdev_ep_s *ep, } /**************************************************************************** - * Name: usbclass_ep0incomplete + * Name: usbclass_epintin_complete * * Description: * Handle completion of interrupt IN endpoint operations @@ -2122,7 +2127,9 @@ static int usbclass_bind(FAR struct usbdevclass_driver_s *driver, * EP0). */ +#ifndef CONFIG_RNDIS_COMPOSITE dev->ep0->priv = priv; +#endif /* Preallocate control request */ @@ -2581,7 +2588,7 @@ static int usbclass_setup(FAR struct usbdevclass_driver_s *driver, FAR struct rndis_response_header *hdr = (struct rndis_response_header *)priv->response_queue; memcpy(ctrlreq->buf, hdr, hdr->msglen); - ctrlreq->priv = priv->response_queue; + ctrlreq->priv = priv; ret = hdr->msglen; } }