libc/termios: Implement TCSADRAIN and TCSAFLUSH for tcsetattr

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: If87a4931cd5a55e064f58c19a22c7ce13f538000
This commit is contained in:
Xiang Xiao 2021-05-07 00:39:08 -07:00 committed by Gustavo Henrique Nihei
parent bf733f7213
commit b8ed17b9da
1 changed files with 8 additions and 3 deletions

View File

@ -83,10 +83,15 @@
int tcsetattr(int fd, int options, FAR const struct termios *termiosp)
{
if (options == TCSANOW)
if (options != TCSANOW)
{
return ioctl(fd, TCSETS, (unsigned long)termiosp);
tcdrain(fd);
}
return -ENOSYS;
if (options == TCSAFLUSH)
{
tcflush(fd, TCIFLUSH);
}
return ioctl(fd, TCSETS, (unsigned long)termiosp);
}