mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 16:50:55 +08:00
serial: Simplify the echo process
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
committed by
Alan Carvalho de Assis
parent
888b8e59dd
commit
82e76961cd
+10
-8
@@ -885,10 +885,19 @@ static ssize_t uart_read(FAR struct file *filep,
|
||||
|
||||
dev->escape = 0;
|
||||
}
|
||||
else if (dev->escape > 0)
|
||||
{
|
||||
/* Skipping character count down */
|
||||
|
||||
if (--dev->escape > 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* Echo if the character is not a control byte */
|
||||
|
||||
if ((!iscntrl(ch & 0xff) || (ch == '\n')) && dev->escape == 0)
|
||||
if (!iscntrl(ch & 0xff) || ch == '\n')
|
||||
{
|
||||
if (ch == '\n')
|
||||
{
|
||||
@@ -904,13 +913,6 @@ static ssize_t uart_read(FAR struct file *filep,
|
||||
|
||||
echoed = true;
|
||||
}
|
||||
|
||||
/* Skipping character count down */
|
||||
|
||||
if (dev->escape > 0)
|
||||
{
|
||||
dev->escape--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user