diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2013-08-10 19:14:05 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2013-08-10 19:14:05 -0600 |
commit | 3c5fcd7ca22c13071fc85c89036adf43f92ebaf2 (patch) | |
tree | 622e43facf3bd417459d2681c47bab360d4a33e1 /nuttx/drivers/usbdev | |
parent | 9a16be559048f93c3396183b1dc1261781d54b01 (diff) | |
download | px4-nuttx-3c5fcd7ca22c13071fc85c89036adf43f92ebaf2.tar.gz px4-nuttx-3c5fcd7ca22c13071fc85c89036adf43f92ebaf2.tar.bz2 px4-nuttx-3c5fcd7ca22c13071fc85c89036adf43f92ebaf2.zip |
Serial FIONREAD, FIONWRITE, and TERMIOS I/O processing from Mike Smith, Andrew Tridgell, and and Lorenz Meier
Diffstat (limited to 'nuttx/drivers/usbdev')
-rw-r--r-- | nuttx/drivers/usbdev/cdcacm.c | 47 |
1 files changed, 43 insertions, 4 deletions
diff --git a/nuttx/drivers/usbdev/cdcacm.c b/nuttx/drivers/usbdev/cdcacm.c index 289e1cd10..441ac907e 100644 --- a/nuttx/drivers/usbdev/cdcacm.c +++ b/nuttx/drivers/usbdev/cdcacm.c @@ -941,7 +941,7 @@ static int cdcacm_bind(FAR struct usbdevclass_driver_s *driver, priv->usbdev = dev; /* Save the reference to our private data structure in EP0 so that it - * can be recovered in ep0 completion events (Unless we are part of + * can be recovered in ep0 completion events (Unless we are part of * a composite device and, in that case, the composite device owns * EP0). */ @@ -1804,9 +1804,10 @@ static void cdcuart_detach(FAR struct uart_dev_s *dev) static int cdcuart_ioctl(FAR struct file *filep,int cmd,unsigned long arg) { - struct inode *inode = filep->f_inode; - struct cdcacm_dev_s *priv = inode->i_private; - int ret = OK; + struct inode *inode = filep->f_inode; + struct cdcacm_dev_s *priv = inode->i_private; + FAR uart_dev_t *serdev = &priv->serdev; + int ret = OK; switch (cmd) { @@ -1898,6 +1899,44 @@ static int cdcuart_ioctl(FAR struct file *filep,int cmd,unsigned long arg) } break; +#ifdef CONFIG_SERIAL_TERMIOS + case TCGETS: + { + struct termios *termiosp = (struct termios*)arg; + + if (!termiosp) + { + ret = -EINVAL; + break; + } + + /* And update with flags from this layer */ + + termiosp->c_iflag = serdev->tc_iflag; + termiosp->c_oflag = serdev->tc_oflag; + termiosp->c_lflag = serdev->tc_lflag; + } + break; + + case TCSETS: + { + struct termios *termiosp = (struct termios*)arg; + + if (!termiosp) + { + ret = -EINVAL; + break; + } + + /* Update the flags we keep at this layer */ + + serdev->tc_iflag = termiosp->c_iflag; + serdev->tc_oflag = termiosp->c_oflag; + serdev->tc_lflag = termiosp->c_lflag; + } + break; +#endif + default: ret = -ENOTTY; break; |