diff options
author | Bin Meng | 2023-07-23 12:40:37 +0800 |
---|---|---|
committer | Leo Yu-Chi Liang | 2023-08-02 16:32:31 +0800 |
commit | 6b343ab38d9665e5062134549323f998c60c35d6 (patch) | |
tree | 895bb990a5dc4afd439aaed1d10616e61c221c14 /common/console.c | |
parent | f30fd55e82ae82b720649cc67744308a8356a874 (diff) |
console: Print out complete stdio device list
At present if both CONSOLE_MUX and SYS_CONSOLE_IS_IN_ENV are on,
during boot, the printed out stdio devices are incomplete, e.g.:
with "stdout=serial,vidconsole", only "vidconsole" is printed.
For such case, we can print out the stdio device name from the
environment variables.
Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'common/console.c')
-rw-r--r-- | common/console.c | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/common/console.c b/common/console.c index af52897ec38..98c3ee6ca6b 100644 --- a/common/console.c +++ b/common/console.c @@ -1014,15 +1014,27 @@ static void stdio_print_current_devices(void) { char *stdinname, *stdoutname, *stderrname; - stdinname = stdio_devices[stdin] ? - stdio_devices[stdin]->name : - "No input devices available!"; - stdoutname = stdio_devices[stdout] ? - stdio_devices[stdout]->name : - "No output devices available!"; - stderrname = stdio_devices[stderr] ? - stdio_devices[stderr]->name : - "No error devices available!"; + if (CONFIG_IS_ENABLED(CONSOLE_MUX) && + CONFIG_IS_ENABLED(SYS_CONSOLE_IS_IN_ENV)) { + /* stdin stdout and stderr are in environment */ + stdinname = env_get("stdin"); + stdoutname = env_get("stdout"); + stderrname = env_get("stderr"); + + stdinname = stdinname ? : "No input devices available!"; + stdoutname = stdoutname ? : "No output devices available!"; + stderrname = stderrname ? : "No error devices available!"; + } else { + stdinname = stdio_devices[stdin] ? + stdio_devices[stdin]->name : + "No input devices available!"; + stdoutname = stdio_devices[stdout] ? + stdio_devices[stdout]->name : + "No output devices available!"; + stderrname = stdio_devices[stderr] ? + stdio_devices[stderr]->name : + "No error devices available!"; + } /* Print information */ puts("In: "); |