[PATCH v5 07/17] bootmenu: flush input buffer before waiting user key input

Masahisa Kojima masahisa.kojima at linaro.org
Mon May 9 10:33:14 CEST 2022


Hi Heinrich,

On Sat, 30 Apr 2022 at 04:46, Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
>
> On 4/28/22 10:09, Masahisa Kojima wrote:
> > Before waiting user key input to stop autoboot, the input buffer
> > must be flushed.
>
> I am not sure if this is desirable.
>
> The default time for autoboot stopping is just 2 seconds. So it is nice
> to be able to type ahead.
>
> On the other hand I have seen boards not booting because after the
> serial driver was initialized it found some random byte in the input buffer.

OK, I agree. I drop this patch.

Thanks,
Masahisa Kojima

>
> I would prefer flushing of input in serial_init().
>
> Best regards
>
> Heinrich
>
> >
> > Signed-off-by: Masahisa Kojima <masahisa.kojima at linaro.org>
> > ---
> > Change in v5:
> > - newly created, split into separate patch
> >
> >   cmd/bootmenu.c | 4 ++++
> >   1 file changed, 4 insertions(+)
> >
> > diff --git a/cmd/bootmenu.c b/cmd/bootmenu.c
> > index d573487272..9a32a18b19 100644
> > --- a/cmd/bootmenu.c
> > +++ b/cmd/bootmenu.c
> > @@ -87,6 +87,10 @@ static void bootmenu_autoboot_loop(struct bootmenu_data *menu,
> >       int i, c;
> >
> >       if (menu->delay > 0) {
> > +             /* flush input */
> > +             while (tstc())
> > +                     getchar();
> > +
> >               printf(ANSI_CURSOR_POSITION, menu->count + 5, 1);
> >               printf("  Hit any key to stop autoboot: %2d ", menu->delay);
> >       }
>


More information about the U-Boot mailing list