Patch 1 applies a small improvement to user experience, as suggested by Matt DeVillier. Then patch 2 makes the switch.
v3->v4: also update docs/Runtime_config.md.
Paolo Bonzini (2): boot.c: delay exiting boot if menu key is ESC boot: switch default menu key to ESC
docs/Runtime_config.md | 4 ++-- src/boot.c | 12 +++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-)
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 ---
src/boot.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/boot.c b/src/boot.c index f23e9e1..3aab8d4 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; }
On some platforms, F12 may be hard to access; for example, on OS X machines F9-F12 have been intercepted by the OS for a long time, and on newer OS X releases function keys are basically gone for good.
Which keys are and are not available depends on the client, not on the server, but only function keys are usually trapped by terminals. Hence, using ESC for the boot menu avoids the problems associated with F12.
Signed-off-by: Paolo Bonzini pbonzini@redhat.com --- docs/Runtime_config.md | 4 ++-- src/boot.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/docs/Runtime_config.md b/docs/Runtime_config.md index bb8ebed..65bd26a 100644 --- a/docs/Runtime_config.md +++ b/docs/Runtime_config.md @@ -88,7 +88,7 @@ be displayed.
SeaBIOS will show the image during the wait for the boot menu (if the boot menu has been disabled, users will not see the image). The image -should probably have "Press F12 for boot menu" embedded in it so users +should probably have "Press ESC for boot menu" embedded in it so users know they can enter the normal SeaBIOS boot menu. By default, the boot menu prompt (and thus graphical image) is shown for 2.5 seconds. This can be customized via a [configuration @@ -174,7 +174,7 @@ There are several additional configuration options available in the | Filename | Description |---------------------|--------------------------------------------------- | show-boot-menu | Controls the display of the boot menu. Set to 0 to disable the boot menu. -| boot-menu-message | Customize the text boot menu message. Normally, when in text mode SeaBIOS will report the string "\nPress F12 for boot menu.\n\n". This field allows the string to be changed. (This is a string field, and is added as a file containing the raw string.) +| boot-menu-message | Customize the text boot menu message. Normally, when in text mode SeaBIOS will report the string "\nPress ESC for boot menu.\n\n". This field allows the string to be changed. (This is a string field, and is added as a file containing the raw string.) | boot-menu-key | Controls which key activates the boot menu. The value stored is the DOS scan code (eg, 0x86 for F12, 0x01 for Esc). If this field is set, be sure to also customize the **boot-menu-message** field above. | boot-menu-wait | Amount of time (in milliseconds) to wait at the boot menu prompt before selecting the default boot. | boot-fail-wait | If no boot devices are found SeaBIOS will reboot after 60 seconds. Set this to the amount of time (in milliseconds) to customize the reboot delay or set to -1 to disable rebooting when no boot devices are found diff --git a/src/boot.c b/src/boot.c index 3aab8d4..d6b1fb7 100644 --- a/src/boot.c +++ b/src/boot.c @@ -459,8 +459,8 @@ interactive_bootmenu(void) ;
char *bootmsg = romfile_loadfile("etc/boot-menu-message", NULL); - int menukey = romfile_loadint("etc/boot-menu-key", 0x86); - printf("%s", bootmsg ?: "\nPress F12 for boot menu.\n\n"); + int menukey = romfile_loadint("etc/boot-menu-key", 1); + printf("%s", bootmsg ?: "\nPress ESC for boot menu.\n\n"); free(bootmsg);
u32 menutime = romfile_loadint("etc/boot-menu-wait", DEFAULT_BOOTMENU_WAIT);
On Thu, Mar 12, 2015 at 06:12:22PM +0100, Paolo Bonzini wrote:
Patch 1 applies a small improvement to user experience, as suggested by Matt DeVillier. Then patch 2 makes the switch.
v3->v4: also update docs/Runtime_config.md.
Paolo Bonzini (2): boot.c: delay exiting boot if menu key is ESC boot: switch default menu key to ESC
Thanks, I applied both patches.
-Kevin