On systems with multiple consoles, the first console is usually activated via device trees and the others later via board code.
The later consoles don't get previous log replayed and it can thus be hard to determine when the log starts when the console remains open between reboots. Improve upon this by printing out the barebox prompt whenever a console is switching from deactivated to ioe. We don't actually require input, but checking for input allows users to disable this by first switching to oe, then ioe. Signed-off-by: Ahmad Fatoum <[email protected]> --- common/console.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common/console.c b/common/console.c index 95e5fb4df33c..aa2013c51522 100644 --- a/common/console.c +++ b/common/console.c @@ -83,6 +83,7 @@ int console_close(struct console_device *cdev) int console_set_active(struct console_device *cdev, unsigned flag) { + unsigned flag_new = flag & ~cdev->f_active; int ret; if (!cdev->getc) @@ -117,6 +118,10 @@ int console_set_active(struct console_device *cdev, unsigned flag) barebox_banner(); while (kfifo_getc(console_output_fifo, &ch) == 0) console_putc(CONSOLE_STDOUT, ch); + } else if (IS_ENABLED(CONFIG_BANNER) && cdev->puts && + flag_new == CONSOLE_STDIOE) { + cdev->puts(cdev, version_string, strlen(version_string)); + cdev->puts(cdev, "\n\n", 2); } return 0; -- 2.47.3
