You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2020/11/19 13:28:23 UTC

[GitHub] [incubator-nuttx] tidklaas commented on a change in pull request #2343: serial: Prevent RX stall

tidklaas commented on a change in pull request #2343:
URL: https://github.com/apache/incubator-nuttx/pull/2343#discussion_r526879103



##########
File path: drivers/serial/serial.c
##########
@@ -924,6 +924,20 @@ static ssize_t uart_read(FAR struct file *filep, FAR char *buffer, size_t buflen
               /* Re-enable UART Rx interrupts */
 
               uart_enablerxint(dev);
+
+              /* Check again if the RX buffer is empty.  The UART driver

Review comment:
       `uart_disablerxint()` is called in line 898. For cdcacm this just sets a flag that will prevent it from copying data into the RX buffer, but it will still accept new data from the USB layer and put it into its completion queue. So if a USB packet arrives between `uart_disablerxint()` at line 898 and `enter_critical_section()` at line 922, there will be data waiting in cdcacm's queue. When `uart_enablerxint()` is called at line 926, [cdcuart_rxint](https://github.com/apache/incubator-nuttx/blob/6ee7fdf874d802f7853db1f7a382b6e4bce708fb/drivers/usbdev/cdcacm.c#L2582) will call [cdcacm_release_rxpending](https://github.com/apache/incubator-nuttx/blob/6ee7fdf874d802f7853db1f7a382b6e4bce708fb/drivers/usbdev/cdcacm.c#L667), which will copy the queued data unto the RX buffer.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org