mirror of
https://github.com/apache/nuttx.git
synced 2026-08-19 20:48:19 +00:00
serial: Simplify the echo process
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
888b8e59dd
commit
82e76961cd
1 changed files with 10 additions and 8 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue