Skip to content
Commit 56bb73d7 authored by Jakub Michalski's avatar Jakub Michalski Committed by Anas Nashif
Browse files

console: fix '\r' and '\n' handling in uart_console_isr()



Receiving uart messages like: "\r*\n*\n" ('*' is a wildcard here) resulted
in invalid echo and invalid console_getline() output.
For example after receiving "\rabc\nd\n" uart_console_isr() echoes
"\r\nabcd\r\n" (note that "\r\n" before 'd' is missing) and after calling
console_getline() twice we received "" and "abcd".

uart_console_isr() changes single occurences of '\n' and '\r' to "\r\n" and
to avoid outputting "\r\n\r\n" after receiving "\r\n" it keeps track of the
last character. But it was tracking only the control characters not all
characters so in case of inputs like "\r*\n" the '\n' was omitted because
the last tracked character was '\r'.

Its fixed by tracking last character no matter of its type

Signed-off-by: default avatarJakub Michalski <jmichalski@internships.antmicro.com>
Signed-off-by: default avatarMateusz Sierszulski <msierszulski@antmicro.com>
parent f9c4ae6c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment