From: Jeremy Kerr Date: Tue, 22 Apr 2014 02:41:59 +0000 (+0800) Subject: ui/ncurses: only cancel default boot on valid key events X-Git-Tag: v1.0.0~183 X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=commitdiff_plain;h=85421290c797c59320bf1e9f076f46195115ab92;hp=b6ee414890fcd582a96f4d89e648cff5dacb1cb9;ds=sidebyside ui/ncurses: only cancel default boot on valid key events We're seeing occasionaly failures to autoboot due to supirious key events (getch() returing -1) on an IPMI console. This change modifies the process_key logic to only abort the default if we see a valid key event. Signed-off-by: Jeremy Kerr --- diff --git a/ui/ncurses/nc-cui.c b/ui/ncurses/nc-cui.c index 5f56409..7200a81 100644 --- a/ui/ncurses/nc-cui.c +++ b/ui/ncurses/nc-cui.c @@ -327,10 +327,6 @@ static int cui_process_key(void *arg) assert(cui->current); - if (!cui->has_input) - discover_client_cancel_default(cui->client); - cui->has_input = true; - for (;;) { int c = getch(); @@ -339,6 +335,13 @@ static int cui_process_key(void *arg) if (c == ERR) break; + if (!cui->has_input) { + pb_log("UI input received (key = %d), aborting " + "default boot\n", c); + discover_client_cancel_default(cui->client); + cui->has_input = true; + } + if (process_global_keys(cui, c)) continue;