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>
This commit is contained in:
Vadim Bendebury
2016-04-16 13:59:11 -07:00
committed by chrome-bot
parent b10d12f1c9
commit 1e7c280491

View File

@@ -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;