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. I would prefer flushing of input in serial_init(). Best regards Heinrich
Signed-off-by: Masahisa Kojima <masahisa.koj...@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); }