serial: Simplify the echo process
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
888b8e59dd
commit
82e76961cd
@ -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--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user