From 09f09daeab591f71cdca3dcf95356ec553740a64 Mon Sep 17 00:00:00 2001 From: masc Date: Fri, 23 Jan 2026 10:34:38 +0800 Subject: [PATCH] Author: shichunma Date: Thu Jan 15 07:24:08 2026 +0800 drivers/usbdev/rndis: after client send notication, host can't read msg timely rndis use intr ep to notify host to read RNDIS message from client, it should read all the messages cached. Need notify host to read again if there is msg left. Signed-off-by: Jerry Ma --- drivers/usbdev/rndis.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/usbdev/rndis.c b/drivers/usbdev/rndis.c index ab39b2ccff9..e8b7aa754d6 100644 --- a/drivers/usbdev/rndis.c +++ b/drivers/usbdev/rndis.c @@ -1845,6 +1845,7 @@ static void usbclass_ep0incomplete(FAR struct usbdev_ep_s *ep, priv->response_queue_words -= len_words; memcpy(priv->response_queue, priv->response_queue + len_words, priv->response_queue_words * sizeof(uint32_t)); + rndis_send_encapsulated_response(priv, 0); } } } @@ -2604,15 +2605,17 @@ static int usbclass_setup(FAR struct usbdevclass_driver_s *driver, } else { - /* Retrieve a single reply from the response queue to - * control request buffer. + /* Reply info as many as possible, if host read less than + * cached, just send one msg to avoid msg truncation */ FAR struct rndis_response_header *hdr = (struct rndis_response_header *)priv->response_queue; - memcpy(ctrlreq->buf, hdr, hdr->msglen); + ret = priv->response_queue_words * sizeof(uint32_t); + if (ret > len) + ret = hdr->msglen; + memcpy(ctrlreq->buf, hdr, ret); ctrlreq->priv = priv; - ret = hdr->msglen; } } }