[PATCH v3 2/2] cli: flush stdin before enabling cli
Gregor Herburger
gregor.herburger at linutronix.de
Mon Apr 13 08:18:33 CEST 2026
Hi Simon,
On Sat, Apr 11, 2026 at 10:41:00AM -0600, Simon Glass wrote:
> Hi Gregor,
>
> On 2026-04-07T06:33:10, Gregor Herburger <gregor.herburger at linutronix.de> wrote:
> > 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 <gregor.herburger at linutronix.de>
> >
> > cmd/Kconfig | 8 ++++++++
> > common/cli.c | 4 ++++
> > 2 files changed, 12 insertions(+)
>
> > diff --git a/cmd/Kconfig b/cmd/Kconfig
> > @@ -47,6 +47,14 @@ config HUSH_SELECTABLE
> > +config CMDLINE_FLUSH_STDIN
> > + bool "Enable flushing input before starting cli"
> > + When this option is enabled the stdin buffer will be flushed before
> > + starting the CLI. This is useful when stdin is changed during boot
> > + (e.g. from nulldev to serial) and junk characters may be pending
> > + in the buffer.
>
> Thanks for expanding the help text!
>
> Reviewed-by: Simon Glass <sjg at chromium.org>
I just realized I didn't collected the Reviewed-by Tags from v2. Should
I send a v4 with these or does a maintainer add them?
Regards
Gregor
More information about the U-Boot
mailing list