gnuboot-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[for 0.1 release 08/11] GRUB: Don't spew "Unknown key 0xFF"


From: Leah Rowe
Subject: [for 0.1 release 08/11] GRUB: Don't spew "Unknown key 0xFF"
Date: Tue, 16 Jan 2024 01:24:48 +0000

From: Leah Rowe <leah@libreboot.org>

If the user has a stuck key, this can cause invalid scancodes
to be sent out repeatedly to GRUB, which is currently programmed
to spew an error message when that happens, by detecting bad
scancode input.

However, when the keyboard is electrically faulty in such a way
as to repeatedly send such scancodes, GRUB repeatedly prints
the error message. When this happens, GRUB is no longer
responsive. The user loses all control, and the system is
effectively bricked. Without this patch, the user's keyboard
is a ticking timebomb. On desktops, this is not a problem, but
many laptop users will not want to (or know how to) replace
their keyboards easily, but the system may still boot and they
may still be able to use the keyboard.

With this patch, the same errno value is set in GRUB, but the
error message is no longer printed. This will permit the user
to boot the system normally. No more error spew. No more brick.

Signed-off-by: Leah Rowe <leah@libreboot.org>
---
 ...outs-don-t-print-Unknown-key-message.patch | 38 +++++++++++++++++++
 1 file changed, 38 insertions(+)
 create mode 100644 
resources/grub/patches/0005-keylayouts-don-t-print-Unknown-key-message.patch

diff --git 
a/resources/grub/patches/0005-keylayouts-don-t-print-Unknown-key-message.patch 
b/resources/grub/patches/0005-keylayouts-don-t-print-Unknown-key-message.patch
new file mode 100644
index 0000000..ecd4711
--- /dev/null
+++ 
b/resources/grub/patches/0005-keylayouts-don-t-print-Unknown-key-message.patch
@@ -0,0 +1,38 @@
+From 2e4195c41a0b1b33afcaad58adb85499b284f0c4 Mon Sep 17 00:00:00 2001
+From: Leah Rowe <leah@libreboot.org>
+Date: Tue, 31 Oct 2023 10:33:28 +0000
+Subject: [PATCH 2/2] keylayouts: don't print "Unknown key" message
+
+on keyboards with stuck keys, this results in GRUB just
+spewing it repeatedly, preventing use of GRUB.
+
+in such cases, it's still possible to use the keyboard,
+and we should let the user at least boot.
+
+it often appears when people plug in faulty usb keyboards,
+but can appear for laptop keyboards too; one of my e6400
+has stuck keys.
+
+with this patch, grub should be a bit more reliable in
+terms of user experience, when the keyboard is faulty.
+
+Signed-off-by: Leah Rowe <leah@libreboot.org>
+---
+ grub-core/commands/keylayouts.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/grub-core/commands/keylayouts.c b/grub-core/commands/keylayouts.c
+index c05d6128a..916d58e1e 100644
+--- a/grub-core/commands/keylayouts.c
++++ b/grub-core/commands/keylayouts.c
+@@ -174,7 +174,6 @@ grub_term_map_key (grub_keyboard_key_t code, int status)
+   key = map_key_core (code, status, &alt_gr_consumed);
+   
+   if (key == 0 || key == GRUB_TERM_SHIFT) {
+-    grub_printf ("Unknown key 0x%x detected\n", code);
+     return GRUB_TERM_NO_KEY;
+   }
+   
+-- 
+2.43.0
+
-- 
2.39.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]