mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 11:56:10 +08:00
sim/uart_ioctl: return -ENOTTY for cmd which don't support
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
This commit is contained in:
committed by
Alan Carvalho de Assis
parent
7b807a8540
commit
baa10ee047
@@ -29,6 +29,7 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
#include "sim_internal.h"
|
#include "sim_internal.h"
|
||||||
|
|
||||||
@@ -363,18 +364,18 @@ static int tty_ioctl(struct file *filep, int cmd, unsigned long arg)
|
|||||||
struct tty_priv_s *priv = dev->priv;
|
struct tty_priv_s *priv = dev->priv;
|
||||||
struct termios *termiosp = (struct termios *)(uintptr_t)arg;
|
struct termios *termiosp = (struct termios *)(uintptr_t)arg;
|
||||||
|
|
||||||
if (!termiosp)
|
|
||||||
{
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (cmd)
|
switch (cmd)
|
||||||
{
|
{
|
||||||
case TCGETS:
|
case TCGETS:
|
||||||
|
DEBUGASSERT(termiosp != NULL);
|
||||||
return host_uart_getcflag(priv->fd, &termiosp->c_cflag);
|
return host_uart_getcflag(priv->fd, &termiosp->c_cflag);
|
||||||
|
|
||||||
case TCSETS:
|
case TCSETS:
|
||||||
|
DEBUGASSERT(termiosp != NULL);
|
||||||
return host_uart_setcflag(priv->fd, termiosp->c_cflag);
|
return host_uart_setcflag(priv->fd, termiosp->c_cflag);
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user