
Hi Heinrich,
On Sun, Jul 23, 2023 at 8:48 PM Heinrich Schuchardt xypron.glpk@gmx.de wrote:
Am 23. Juli 2023 14:04:39 MESZ schrieb Bin Meng bmeng.cn@gmail.com:
Hi Heinrich,
On Sun, Jul 23, 2023 at 2:38 PM Heinrich Schuchardt xypron.glpk@gmx.de wrote:
On 7/23/23 06:40, Bin Meng wrote:
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
common/console.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-)
diff --git a/common/console.c b/common/console.c index af52897ec3..98c3ee6ca6 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!";
This string will never be printed as you have no output device.
This logic follows what it was before. Yes, without a stdout device, puts() or printf() is useless.
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!";
ditto
stderrname = stdio_devices[stderr] ?
stdio_devices[stderr]->name :
"No error devices available!";
}
do_coninfo() shows how to print all muxed devices irrespective of SYS_CONSOLE_IS_IN_ENV.
Are you suggesting we refactor the codes to follow the same logic used in do_coninfo()?
As the coninfo command is enabled on most devices, we could use a common output function to reduce code size.
Do we need this output at all if we hsve coninfo?
I think so. U-Boot has been displaying the stdio devices for quite a long time. The config option SYS_CONSOLE_INFO_QUIET was introduced for any board who does not want this.
config SYS_CONSOLE_INFO_QUIET bool "Don't display the console devices on boot" help Normally U-Boot displays the current settings for stdout, stdin and stderr on boot when the post-relocation console is set up. Enable this option to suppress this output. It can be obtained by calling stdio_print_current_devices() from board code.
Tom, what's your idea?
Regards, Bin