Skip to content

Commit 3c88a94

Browse files
committed
sys/console: Make echo of LF optional in silenced NLIP
Code was echoing back LF character even when application requested to silence non-NLIP data on input. Now this behaviour is still possible but require explicit setting CONSOLE_NLIP_ECHO_LF which is disabled by default.
1 parent 8a017bc commit 3c88a94

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

sys/console/full/src/console.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,8 +1021,8 @@ handle_nlip(uint8_t byte)
10211021
} else if (byte == CONSOLE_NLIP_PKT_START1) {
10221022
nlip_state = NLIP_PKT_START1;
10231023
} else {
1024-
/* For old code compatibility end of lines characters pass through */
1025-
handled = g_console_ignore_non_nlip && byte != '\r' && byte != '\n';
1024+
handled = g_console_ignore_non_nlip &&
1025+
!MYNEWT_VAL(CONSOLE_NLIP_ECHO_LF) && byte != '\r' && byte != '\n';
10261026
}
10271027
break;
10281028
}

sys/console/full/syscfg.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ syscfg.defs:
3838
CONSOLE_NLIP:
3939
description: 'Enable NLIP handling in console code'
4040
value: 1
41+
CONSOLE_NLIP_ECHO_LF:
42+
description: >
43+
Enable LF echo even if function console_ignore_non_nlip()
44+
was called to ignore any non NLIP input. This allows for
45+
simple check if application is running correctly
46+
by using simple terminal.
47+
value: 0
4148
CONSOLE_COMPAT:
4249
description: 'Console backward compatibility'
4350
value: 1

0 commit comments

Comments
 (0)