diff options
| author | Gregor Herburger <[email protected]> | 2026-04-13 17:24:54 +0200 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2026-04-22 14:23:49 -0600 |
| commit | e973fa5115e40f93bb1425db5b1cc1f3d9b8047d (patch) | |
| tree | dd802fea63d671edf6ae2bcd28d4fab68e15defa /common/cli.c | |
| parent | 2c8fdd7aea1d3c6c380ea5b5080147dc7fe9c38f (diff) | |
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 <[email protected]>
Reviewed-by: Simon Glass <[email protected]>
Diffstat (limited to 'common/cli.c')
| -rw-r--r-- | common/cli.c | 4 |
1 files changed, 4 insertions, 0 deletions
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(); |
