mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 08:36:24 +08:00
Serial FIONREAD, FIONWRITE, and TERMIOS I/O processing from Mike Smith, Andrew Tridgell, and and Lorenz Meier
This commit is contained in:
+43
-4
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user