public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Gregor Herburger <gregor.herburger@linutronix.de>
To: Tom Rini <trini@konsulko.com>
Cc: u-boot@lists.denx.de,
	Andrew Goodbody <andrew.goodbody@linaro.org>,
	Heiko Schocher <hs@nabladev.com>,
	Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Ilias Apalodimas <ilias.apalodimas@linaro.org>,
	"Kory Maincent (TI.com)" <kory.maincent@bootlin.com>,
	Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>,
	Quentin Schulz <quentin.schulz@cherry.de>
Subject: Re: [PATCH] cli: flush stdin before enabling cli
Date: Wed, 1 Apr 2026 07:32:55 +0200	[thread overview]
Message-ID: <acyuBzOBAmAM5uz_@gregor-framework> (raw)
In-Reply-To: <20260331181124.GD41863@bill-the-cat>

Hi Tom,

> Conceptually, good idea, thanks for doing it.

> > 
> > ---
> > 
> >  cmd/Kconfig  | 7 +++++++
> >  common/cli.c | 6 ++++++
> >  2 files changed, 13 insertions(+)
> > 
> > diff --git a/cmd/Kconfig b/cmd/Kconfig
> > index 322ebe600c5..e08fbf27358 100644
> > --- a/cmd/Kconfig
> > +++ b/cmd/Kconfig
> > @@ -47,6 +47,13 @@ config HUSH_SELECTABLE
> >  	default y if HUSH_OLD_PARSER && HUSH_MODERN_PARSER
> >  endmenu
> >  
> > +config CMDLINE_FLUSH_STDIN
> > +	bool "Enable flushing input before starting cli"
> > +	default n
> 
> We don't need default n as that's the default.
> > +	if (IS_ENABLED(CONFIG_CMDLINE_FLUSH_STDIN)) {
> > +		while (tstc())
> > +			(void)getchar();
> > +	}
> > +
> >  #if CONFIG_IS_ENABLED(HUSH_PARSER)
> >  	if (gd->flags & GD_FLG_HUSH_MODERN_PARSER)
> >  		parse_and_run_file();
> 
> This is flush_stdin() from common/autoboot.c, but that's a static
> function. We should find a better spot for that perhaps and then call it
> when required.


Thanks for the review. I will send a v2 to change this.
Gregor

  reply	other threads:[~2026-04-01 12:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-31 11:03 [PATCH] cli: flush stdin before enabling cli Gregor Herburger
2026-03-31 18:11 ` Tom Rini
2026-04-01  5:32   ` Gregor Herburger [this message]
2026-04-01  9:28 ` Quentin Schulz
2026-04-01 10:46   ` Gregor Herburger
2026-04-01 11:18     ` Quentin Schulz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=acyuBzOBAmAM5uz_@gregor-framework \
    --to=gregor.herburger@linutronix.de \
    --cc=andrew.goodbody@linaro.org \
    --cc=hs@nabladev.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=kory.maincent@bootlin.com \
    --cc=mikhail.kshevetskiy@iopsys.eu \
    --cc=quentin.schulz@cherry.de \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox