To make putchar() work correctly in PBL we need to make sure that '\n' -> '\r\n' replacement is done in console_putc() instead of console_puts(). This also allows us to share a bit more code by moving console_putc() to lib/console.c. Signed-off-by: Andrey Smirnov <andrew.smirnov@xxxxxxxxx> --- common/console_simple.c | 6 ------ lib/console.c | 5 +++++ pbl/console.c | 8 -------- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/common/console_simple.c b/common/console_simple.c index 62b811b3f..d560f8534 100644 --- a/common/console_simple.c +++ b/common/console_simple.c @@ -26,12 +26,6 @@ int console_puts(unsigned int ch, const char *str) } EXPORT_SYMBOL(console_puts); -void console_putc(unsigned int ch, char c) -{ - __console_putc(__console_get_default(), c); -} -EXPORT_SYMBOL(console_putc); - int tstc(void) { if (!console) diff --git a/lib/console.c b/lib/console.c index d2d2ae775..94c20dada 100644 --- a/lib/console.c +++ b/lib/console.c @@ -128,3 +128,8 @@ void __console_putc(struct console_device *cdev, char c) if (c == '\n') __cdev_putc(cdev, '\r'); } + +__weak void console_putc(unsigned int ch, char c) +{ + __console_putc(__console_get_default(), c); +} diff --git a/pbl/console.c b/pbl/console.c index c1c3e1dde..b76c8cd75 100644 --- a/pbl/console.c +++ b/pbl/console.c @@ -17,19 +17,11 @@ void pbl_set_putc(putc_func_t putcf, void *ctx) __console_set_putc(&console_ll, putcf, ctx); } -void console_putc(unsigned int ch, char c) -{ - __cdev_putc(__console_get_default(), c); -} - int console_puts(unsigned int ch, const char *str) { int n = 0; while (*str) { - if (*str == '\n') - console_putc(CONSOLE_STDOUT, '\r'); - console_putc(CONSOLE_STDOUT, *str); str++; n++; -- 2.17.0 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox