From: Gregor Herburger <gregor.herburger@linutronix.de>
To: Quentin Schulz <quentin.schulz@cherry.de>
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>,
Tom Rini <trini@konsulko.com>
Subject: Re: [PATCH] cli: flush stdin before enabling cli
Date: Wed, 1 Apr 2026 12:46:32 +0200 [thread overview]
Message-ID: <acz3iNHpmDrcv2gT@gregor-framework> (raw)
In-Reply-To: <d65423f2-9dae-4bf6-a1d4-fcaed430ac7d@cherry.de>
> > 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.
> >
>
> Why does this need an option? I don't know enough (anything really) about
> the cli in general but the wording seems to indicate this fixes an issue or
> even a bug. Is there a case in which we wouldn't want to flush?
In our case the problem was in efi_console where query_console_serial
sent the escape sequence to stdout and stdin was set to nulldev and
therefore never received. In the bootcmd stdin was set to serial and the
response was seen on the cli. Thats how it was in our case. My first
approach was to check in efi_console to not send if stdin is nulldev.
But after more thoughts I implemented the current approach which flushes
stdin before starting cli. After all efi_console did exactly what was
configured in the environment.
I can think of two cases where stdin shouldn't be flushed:
* User typing commands before cli is reached.
* Some scripts sending commands before cli prompt is reached.
Imho there should be at least an option to let users decide on there
usecase. If the option is default or not I don't have a strong opinion on.
Gregor
next prev parent 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
2026-04-01 9:28 ` Quentin Schulz
2026-04-01 10:46 ` Gregor Herburger [this message]
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=acz3iNHpmDrcv2gT@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