sim/uart_ioctl: return -ENOTTY for cmd which don't support

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
This commit is contained in:
dongjiuzhu1 2023-03-16 15:10:21 +08:00 committed by Alan Carvalho de Assis
parent 7b807a8540
commit baa10ee047

View File

@ -29,6 +29,7 @@
#include <sys/types.h>
#include <fcntl.h>
#include <errno.h>
#include <assert.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 termios *termiosp = (struct termios *)(uintptr_t)arg;
if (!termiosp)
{
return -EINVAL;
}
switch (cmd)
{
case TCGETS:
DEBUGASSERT(termiosp != NULL);
return host_uart_getcflag(priv->fd, &termiosp->c_cflag);
case TCSETS:
DEBUGASSERT(termiosp != NULL);
return host_uart_setcflag(priv->fd, termiosp->c_cflag);
default:
break;
}
#endif