Skip to content

Commit

Permalink
sys/console: Make echo of LF optional in silenced NLIP
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kasjer committed Mar 16, 2020
1 parent cc72b0f commit a4d5763
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
11 changes: 9 additions & 2 deletions sys/console/full/src/console.c
Original file line number Diff line number Diff line change
Expand Up @@ -1021,8 +1021,15 @@ handle_nlip(uint8_t byte)
} else if (byte == CONSOLE_NLIP_PKT_START1) {
nlip_state = NLIP_PKT_START1;
} else {
/* For old code compatibility end of lines characters pass through */
handled = g_console_ignore_non_nlip && byte != '\r' && byte != '\n';
if (!g_console_ignore_non_nlip) {
handled = 0;
} else if ((byte == '\r' || byte == '\n') && MYNEWT_VAL(CONSOLE_NLIP_ECHO_LF)) {
/* For old code compatibility end of lines characters pass through */
if (0 == console_lock(1000)) {
console_out_nolock(byte);
console_unlock();
}
}
}
break;
}
Expand Down
7 changes: 7 additions & 0 deletions sys/console/full/syscfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ syscfg.defs:
CONSOLE_NLIP:
description: 'Enable NLIP handling in console code'
value: 1
CONSOLE_NLIP_ECHO_LF:
description: >
Enable LF echo even if function console_ignore_non_nlip()
was called to ignore any non NLIP input. This allows for
simple check if application is running correctly
by using simple terminal.
value: 0
CONSOLE_COMPAT:
description: 'Console backward compatibility'
value: 1
Expand Down

0 comments on commit a4d5763

Please sign in to comment.