From 947fd7a5af15d99c6ff31923453d37cccc7bc61b Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 7 May 2015 11:27:51 -0600 Subject: [PATCH] USB host CDC/ACM: Improve RX responsiveness --- drivers/usbhost/usbhost_cdcacm.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/usbhost/usbhost_cdcacm.c b/drivers/usbhost/usbhost_cdcacm.c index c1f1a53f6c2..1e9691fbbf3 100644 --- a/drivers/usbhost/usbhost_cdcacm.c +++ b/drivers/usbhost/usbhost_cdcacm.c @@ -1108,17 +1108,23 @@ static void usbhost_rxdata_work(FAR void *arg) nexthead = 0; } - /* Increment the index in the USB IN packet buffer. If the * index becomes equal to the number of bytes in the buffer, then - * we have consumed all of the RX data. In that case set the - * number of bytes in the buffer to zero. This will force re- - * reading on the next time through the loop. + * we have consumed all of the RX data. */ if (++rxndx >= priv->nrxbytes) { + /* In that case set the number of bytes in the buffer to zero. + * This will force re-reading on the next time through the loop. + */ + priv->nrxbytes = 0; + + /* Inform any waiters there there is new incoming data available. */ + + uart_datareceived(uartdev); + nxfrd = 0; } }