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

Masahisa Kojima masahisa.kojima at linaro.org
Thu Apr 28 10:09:40 CEST 2022


Before waiting user key input to stop autoboot, the input buffer
must be flushed.

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);
 	}
-- 
2.17.1



More information about the U-Boot mailing list