mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-08-17 14:02:49 +08:00
fix(systemcmds/nshterm): echo input and consume enter
Enable ICANON and ECHO, and map CR to NL (ICRNL) so the nshterm console echoes typed characters and processes the enter key. Co-authored-by: marinauterion <224611774+marinauterion@users.noreply.github.com> Signed-off-by: Peter van der Perk <peter.vanderperk@nxp.com>
This commit is contained in:
co-authored by
marinauterion
parent
21898b028e
commit
f4cc18b976
@@ -85,6 +85,8 @@ extern "C" __EXPORT int nshterm_main(int argc, char *argv[])
|
||||
|
||||
/* Set ONLCR flag (which appends a CR for every LF) */
|
||||
uart_config.c_oflag |= (ONLCR | OPOST);
|
||||
uart_config.c_iflag |= ICRNL;
|
||||
uart_config.c_lflag |= (ICANON | ECHO);
|
||||
|
||||
if ((termios_state = tcsetattr(fd, TCSANOW, &uart_config)) < 0) {
|
||||
PX4_ERR("set config %s\n", argv[1]);
|
||||
|
||||
Reference in New Issue
Block a user