diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2022-09-30 17:41:45 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2022-10-05 08:29:29 +0200 |
commit | f644f8d80a59407d44fcdd0ced7f3c956d24b849 (patch) | |
tree | e3e073ad074e5adab2610297b3fa8176d83e3d0a /pbl | |
parent | aa3a70a50b99d317e81ecebe9704e8174c5b45c4 (diff) | |
download | barebox-f644f8d80a59407d44fcdd0ced7f3c956d24b849.tar.gz barebox-f644f8d80a59407d44fcdd0ced7f3c956d24b849.tar.xz |
common: console_common: output log messages to CONSOLE_STDERR
Like U-Boot, barebox has two standard output streams:
CONSOLE_STDOUT and CONSOLE_STDERR in addition to the input stream
CONSOLE_STDIN.
>From a consumer view, the console.active device parameter allows
restricting which of these streams interact with a given console.
>From a provider view, only CONSOLE_STDOUT is ever used. dputs
dputc allow passing in CONSOLE_STDERR instead, but nothing in-tree
does so.
Change this by having all log messages (e.g. pr_debug or dev_err)
go to CONSOLE_STDERR. For nearly all systems that just use the default
of console.active="ioe" or "oe", there is no difference. But now
systems that use either "o" or "e" can use different console
devices for barebox log messages and for standard output by commands.
This is especially useful to debug interactive applications like edit
or for monitoring barebox debug messages during execution of payloads
when barebox acts as EFI loader.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20220930154145.754181-1-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'pbl')
-rw-r--r-- | pbl/console.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/pbl/console.c b/pbl/console.c index fc8e8cdf13..a147e2a19e 100644 --- a/pbl/console.c +++ b/pbl/console.c @@ -39,9 +39,9 @@ int console_puts(unsigned int ch, const char *str) while (*str) { if (*str == '\n') - console_putc(CONSOLE_STDOUT, '\r'); + console_putc(ch, '\r'); - console_putc(CONSOLE_STDOUT, *str); + console_putc(ch, *str); str++; n++; } @@ -74,7 +74,7 @@ int pr_print(int level, const char *fmt, ...) i = vsnprintf(printbuffer, sizeof(printbuffer), fmt, args); va_end(args); - console_puts(CONSOLE_STDOUT, printbuffer); + console_puts(CONSOLE_STDERR, printbuffer); return i; } |