aboutsummaryrefslogtreecommitdiffstats
path: root/src/boot.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2015-03-12 18:12:23 +0100
committerKevin O'Connor <kevin@koconnor.net>2015-03-16 10:34:55 -0400
commit80aae26c9ef060bde15aebd84d0cc79a978706a9 (patch)
treecba22692fc01245c91e24bb9d28251da9cd3ed90 /src/boot.c
parent5ae3dd6f74e17a7cd06165a75214798b0c606115 (diff)
downloadseabios-80aae26c9ef060bde15aebd84d0cc79a978706a9.tar.gz
boot.c: delay exiting boot if menu key is ESC
If the menu key is ESC, do not restart boot unless 1.5 seconds have passed. Otherwise users (trained by years of repeatedly hitting keys to enter the BIOS) will end up hitting ESC multiple times and immediately booting the primary boot device. Suggested-by: Matt DeVillier <matt.devillier@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'src/boot.c')
-rw-r--r--src/boot.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/boot.c b/src/boot.c
index f23e9e15..3aab8d42 100644
--- a/src/boot.c
+++ b/src/boot.c
@@ -486,9 +486,15 @@ interactive_bootmenu(void)
, strtcpy(desc, pos->description, ARRAY_SIZE(desc)));
}
- // Get key press
+ // Get key press. If the menu key is ESC, do not restart boot unless
+ // 1.5 seconds have passed. Otherwise users (trained by years of
+ // repeatedly hitting keys to enter the BIOS) will end up hitting ESC
+ // multiple times and immediately booting the primary boot device.
+ int esc_accepted_time = irqtimer_calc(menukey == 1 ? 1500 : 0);
for (;;) {
scan_code = get_keystroke(1000);
+ if (scan_code == 1 && !irqtimer_check(esc_accepted_time))
+ continue;
if (scan_code >= 1 && scan_code <= maxmenu+1)
break;
}