From e973fa5115e40f93bb1425db5b1cc1f3d9b8047d Mon Sep 17 00:00:00 2001 From: Gregor Herburger Date: Mon, 13 Apr 2026 17:24:54 +0200 Subject: cli: flush stdin before enabling cli Currently there is no possibility to flush stdin after autocommands are executed. If in the bootcmd the stdin is changed, e.g. from nulldev to serial, it could happen that junk characters sit in the fifo and appear on the cli. Add a option to clear stdin before starting the CLI. Signed-off-by: Gregor Herburger Reviewed-by: Simon Glass --- common/cli.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'common/cli.c') diff --git a/common/cli.c b/common/cli.c index 4694a35cd0e..bcc7264d51a 100644 --- a/common/cli.c +++ b/common/cli.c @@ -295,6 +295,10 @@ err: void cli_loop(void) { bootstage_mark(BOOTSTAGE_ID_ENTER_CLI_LOOP); + + if (IS_ENABLED(CONFIG_CMDLINE_FLUSH_STDIN)) + console_flush_stdin(); + #if CONFIG_IS_ENABLED(HUSH_PARSER) if (gd->flags & GD_FLG_HUSH_MODERN_PARSER) parse_and_run_file(); -- cgit v1.2.3