grub2/0184-EFI-console-Implement-getkeystatus-support.patch
Javier Martinez Canillas 1f092caba7
Drop two efinet patches that were causing issues and a bunch of other fixes
Add comments and revert logic changes in 01_fallback_counting
Remove quotes when reading ID value from /etc/os-release
  Related: rhbz#1650706
blscfg: expand grub_users before passing to grub_normal_add_menu_entry()
  Resolves: rhbz#1650706
Drop buggy downstream patch "efinet: retransmit if our device is busy"
  Resolves: rhbz#1649048
Make the menu entry users option argument to be optional
  Related: rhbz#1652434
10_linux_bls: add missing menu entries options
  Resolves: rhbz#1652434
Drop "Be more aggro about actually using the *configured* network device."
  Resolves: rhbz#1654388
Fix menu entry selection based on title
  Resolves: rhbz#1654936

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
2018-12-01 03:28:36 +01:00

73 lines
2.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Wed, 6 Jun 2018 16:16:47 +0200
Subject: [PATCH] EFI: console: Implement getkeystatus() support
Implement getkeystatus() support.
Note that if a non-modifier key gets pressed and repeated calls to
getkeystatus() are made then it will return the modifier status at the
time of the non-modifier key, until that key-press gets consumed by a
getkey() call.
This is a side-effect of how the EFI simple-text-input protocol works
and cannot be avoided.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
grub-core/term/efi/console.c | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/grub-core/term/efi/console.c b/grub-core/term/efi/console.c
index 3d36c5c701b..92dd4996bb7 100644
--- a/grub-core/term/efi/console.c
+++ b/grub-core/term/efi/console.c
@@ -223,6 +223,39 @@ grub_console_getkey_ex(struct grub_term_input *term)
return key;
}
+static int
+grub_console_getkeystatus(struct grub_term_input *term)
+{
+ grub_efi_key_data_t key_data;
+ grub_efi_uint32_t kss;
+ int key, mods = 0;
+
+ if (grub_efi_is_finished)
+ return 0;
+
+ if (grub_console_read_key_stroke (term->data, &key_data, &key, 0))
+ return 0;
+
+ kss = key_data.key_state.key_shift_state;
+ if (kss & GRUB_EFI_SHIFT_STATE_VALID)
+ {
+ if (kss & GRUB_EFI_LEFT_SHIFT_PRESSED)
+ mods |= GRUB_TERM_STATUS_LSHIFT;
+ if (kss & GRUB_EFI_RIGHT_SHIFT_PRESSED)
+ mods |= GRUB_TERM_STATUS_RSHIFT;
+ if (kss & GRUB_EFI_LEFT_ALT_PRESSED)
+ mods |= GRUB_TERM_STATUS_LALT;
+ if (kss & GRUB_EFI_RIGHT_ALT_PRESSED)
+ mods |= GRUB_TERM_STATUS_RALT;
+ if (kss & GRUB_EFI_LEFT_CONTROL_PRESSED)
+ mods |= GRUB_TERM_STATUS_LCTRL;
+ if (kss & GRUB_EFI_RIGHT_CONTROL_PRESSED)
+ mods |= GRUB_TERM_STATUS_RCTRL;
+ }
+
+ return mods;
+}
+
static grub_err_t
grub_efi_console_input_init (struct grub_term_input *term)
{
@@ -403,6 +436,7 @@ static struct grub_term_input grub_console_term_input =
{
.name = "console",
.getkey = grub_console_getkey,
+ .getkeystatus = grub_console_getkeystatus,
.init = grub_efi_console_input_init,
};