All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: grub-devel@gnu.org
Cc: Daniel Kiper <daniel.kiper@oracle.com>,
	Hans de Goede <hdegoede@redhat.com>
Subject: [PATCH 2/4] Accept Both ESC and F8 as user interrupt keys
Date: Wed, 28 Mar 2018 16:50:26 +0200	[thread overview]
Message-ID: <20180328145028.21555-3-hdegoede@redhat.com> (raw)
In-Reply-To: <20180328145028.21555-1-hdegoede@redhat.com>

On most Bay Trail, Cherry Trail and Apollo Lake devices the ESC key is
the hotkey to enter the BIOS/EFI setup screen.

This makes it hard for the user to show the grub-menu when it is hidden
and a short timeout is used, because pressing ESC too early leads to the
user entering the BIOS/EFI setup screen.

F8 is (almost?) always free (on X86/PC platforms) as Windows uses this for
its boot menu, so also accept F8 as interrupt/show-menu key. As an added
advantage this is also more discoverable / easier for users coming from
Windows.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 grub-core/commands/sleep.c | 8 ++++++--
 grub-core/normal/menu.c    | 7 ++++---
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/grub-core/commands/sleep.c b/grub-core/commands/sleep.c
index e77e7900f..9f16956e0 100644
--- a/grub-core/commands/sleep.c
+++ b/grub-core/commands/sleep.c
@@ -51,12 +51,16 @@ static int
 grub_interruptible_millisleep (grub_uint32_t ms)
 {
   grub_uint64_t start;
+  int key;
 
   start = grub_get_time_ms ();
 
-  while (grub_get_time_ms () - start < ms)
-    if (grub_getkey_noblock () == GRUB_TERM_ESC)
+  while (grub_get_time_ms () - start < ms) {
+    key = grub_getkey_noblock ();
+    /* ESC sometimes is the BIOS setup hotkey, also allow F8 as intr. */
+    if (key == GRUB_TERM_ESC || key == GRUB_TERM_KEY_F8)
       return 1;
+  }
 
   return 0;
 }
diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c
index e7a83c2d6..d813fade1 100644
--- a/grub-core/normal/menu.c
+++ b/grub-core/normal/menu.c
@@ -610,8 +610,8 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot)
 	  print_countdown (pos, timeout);
 	}
 
-      /* Enter interruptible sleep until Escape or a menu hotkey is pressed,
-         or the timeout expires.  */
+      /* Sleep until a menu hotkey is pressed, we are interrupted by an ESC/F8
+         keypress, or the timeout expires. */
       saved_time = grub_get_time_ms ();
       while (1)
 	{
@@ -624,7 +624,8 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot)
 	      if (entry >= 0)
 		break;
 	    }
-	  if (key == GRUB_TERM_ESC)
+	  /* ESC sometimes is the BIOS setup hotkey, also allow F8 as intr. */
+	  if (key == GRUB_TERM_ESC || key == GRUB_TERM_KEY_F8)
 	    {
 	      timeout = -1;
 	      break;
-- 
2.17.0.rc1



  parent reply	other threads:[~2018-03-28 14:50 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-28 14:50 [PATCH 0/4] Make hidden menu really hidden Hans de Goede
2018-03-28 14:50 ` [PATCH 1/4] Add new "version" command Hans de Goede
2018-03-29  7:53   ` Olaf Hering
2018-03-29  8:37     ` Thomas Schmitt
2018-03-29 14:57     ` Hans de Goede
2018-03-29 15:02       ` Olaf Hering
2018-04-05 11:41   ` Daniel Kiper
2018-03-28 14:50 ` Hans de Goede [this message]
2018-03-28 14:56   ` [PATCH 2/4] Accept Both ESC and F8 as user interrupt keys Lennart Sorensen
2018-03-28 15:06     ` Hans de Goede
2018-03-28 15:11       ` Lennart Sorensen
2018-03-28 15:58         ` Hans de Goede
2018-04-05 11:47           ` Daniel Kiper
2018-03-28 14:50 ` [PATCH 3/4] Optionally print less messages at boot Hans de Goede
2018-04-05 12:12   ` Daniel Kiper
2018-04-05 17:53     ` Hans de Goede
2018-04-06 11:41       ` Daniel Kiper
2018-03-28 14:50 ` [PATCH 4/4] EFI: Do not set text-mode until we actually need it Hans de Goede
2018-04-05 12:34   ` Daniel Kiper
2018-04-05 18:05     ` Hans de Goede
2018-04-06 11:44       ` Daniel Kiper
2018-03-28 15:04 ` [PATCH 0/4] Make hidden menu really hidden Daniel Kiper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180328145028.21555-3-hdegoede@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=daniel.kiper@oracle.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.