From 2e69e22af37a0649ea84691ea502651870d9175b Mon Sep 17 00:00:00 2001 From: Gregory Nutt <gnutt@nuttx.org> Date: Sat, 23 Sep 2017 12:37:57 -0600 Subject: [PATCH] drivers/usbdev: CDC/ACM should reset all 'irregular' notifications to zero after sending the SerialState packet. --- drivers/usbdev/cdcacm.c | 6 +++++- include/nuttx/usb/cdc.h | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/usbdev/cdcacm.c b/drivers/usbdev/cdcacm.c index a76ae8f1b0..82fc2b6461 100644 --- a/drivers/usbdev/cdcacm.c +++ b/drivers/usbdev/cdcacm.c @@ -703,6 +703,10 @@ static int cdcacm_serialstate(FAR struct cdcacm_dev_s *priv) } errout_with_flags: + /* Reset all of the "irregular" notification */ + + priv->serialstate &= CDC_UART_CONSISTENT; + leave_critical_section(flags); return ret; } @@ -2117,7 +2121,7 @@ static int cdcuart_ioctl(FAR struct file *filep, int cmd, unsigned long arg) #ifdef CONFIG_CDCACM_IFLOWCONTROL /* Report state of input flow control */ - termiosp->c_lflag = (priv->iflow) ? CRTS_IFLOW : 0; + termiosp->c_cflag |= (priv->iflow) ? CRTS_IFLOW : 0; #endif } break; diff --git a/include/nuttx/usb/cdc.h b/include/nuttx/usb/cdc.h index 65d15d8dce..b4a88add86 100644 --- a/include/nuttx/usb/cdc.h +++ b/include/nuttx/usb/cdc.h @@ -419,6 +419,8 @@ * 105 and RS-232 signal RTS. */ +/* CDC/ACM friendly naming */ + #define CDCACM_UART_DTR CDC_DTE_PRESENT #define CDCACM_UART_RTS CDC_ACTIVATE_CARRIER @@ -547,9 +549,21 @@ * overrun in the device. */ +/* CDC/ACM friendly naming */ + #define CDCACM_UART_DCD CDC_UART_RXCARRIER #define CDCACM_UART_DSR CDC_UART_TXCARRIER +/* "SerialState is used like a real interrupt status register. Once a notification has been + * sent, the device will reset and reevaluate the different signals. For the consistent + * signals like carrier detect or transmission carrier, this will mean another notification + * will not be generated until there is a state change. For the irregular signals like + * break, the incoming ring signal, or the overrun error state, this will reset their values + * to zero and again will not send another notification until their state changes." + */ + +#define CDC_UART_CONSISTENT (CDC_UART_RXCARRIER | CDC_UART_TXCARRIER) + /* Table 70: Call State Change Value Definitions */ #define CDC_CALLST_IDLE 0x01 /* Call has become idle */ -- GitLab