mirror of
https://github.com/apache/nuttx.git
synced 2026-08-01 20:28:58 +00:00
drivers/serial: Modify serial/pty to allow NSH/Telnet line edit
Both the UART and PTY serial drivers previously assumed all VT100/ANSI escape sequences were fixed 3-byte CSI sequences, causing longer CSI and SS3 key sequences (such as Home, End, Delete, and modified keys) to leak stray characters into the terminal when local echo was enabled. This patch replaces the fixed-length logic with a state machine that correctly recognizes and suppresses escape sequences of any length, while preserving the data delivered to applications. The change only affects local echo behavior, is fully backward compatible, and has been validated with both interactive NSH sessions and automated PTY tests. Signed-off-by: Alan C. Assis <acassis@gmail.com> Assisted-by: Claude Code
This commit is contained in:
parent
7df7c6ee50
commit
375462322e
3 changed files with 134 additions and 26 deletions
|
|
@ -326,7 +326,11 @@ struct uart_dev_s
|
|||
/* State data */
|
||||
|
||||
uint8_t open_count; /* Number of times the device has been opened */
|
||||
uint8_t escape; /* Number of the character to be escaped */
|
||||
uint8_t escape; /* VT100/ANSI escape sequence echo-
|
||||
* suppression state (see the
|
||||
* UART_ESCAPE_* values used in
|
||||
* uart_readv())
|
||||
*/
|
||||
#ifdef CONFIG_SERIAL_REMOVABLE
|
||||
volatile bool disconnected; /* true: Removable device is not connected */
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue