diff options
author | Vadim Bendebury <vbendeb@chromium.org> | 2016-04-16 13:59:11 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-04-18 11:30:19 -0700 |
commit | 1e7c280491232110e1006d545f9a61ca05d469d5 (patch) | |
tree | 582f53984a566840e43180e8d0d12e404ceffe64 | |
parent | b10d12f1c95fa6c13c83f1da34bbaf21063d9a2b (diff) | |
download | chrome-ec-1e7c280491232110e1006d545f9a61ca05d469d5.tar.gz |
g: fix usb console LF handling
It was observed that when connecting to the CR50 console over USB,
there the line feed (LF) characters are not supplemented by carriage
return (CR), which causes weird console output.
Detailed examination has shown that uart_putc() does not do the right
thing itself and also bypasses __tx_char() used by uart_puts(), which
does the right thing.
The simplest solution is to have uart_putc() re-use all the smarts of
uart_puts().
BRANCH=none
BUG=none
TEST=verified that usb console output does not suffer from the "lost
CR" syndrome any more.
Change-Id: I2a1f84b2524c41eb6e84186141b0b9ac55e87ee0
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/339217
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
-rw-r--r-- | chip/g/usb_console.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/chip/g/usb_console.c b/chip/g/usb_console.c index 8195b5b433..27a8d15b95 100644 --- a/chip/g/usb_console.c +++ b/chip/g/usb_console.c @@ -294,19 +294,6 @@ int usb_getc(void) return -1; } -int usb_putc(int c) -{ - int ret = usb_wait_console(); - - if (ret) - return ret; - - ret = QUEUE_ADD_UNITS(&tx_q, &c, 1); - if (ret) - handle_output(); - return ret ? EC_SUCCESS : EC_ERROR_OVERFLOW; -} - int usb_puts(const char *outstr) { int ret; @@ -330,6 +317,15 @@ int usb_puts(const char *outstr) return *outstr ? EC_ERROR_OVERFLOW : EC_SUCCESS; } +int usb_putc(int c) +{ + char string[2]; + + string[0] = c; + string[1] = '\0'; + return usb_puts(string); +} + int usb_vprintf(const char *format, va_list args) { int ret; |