GRUB: Don't spew "Unknown key 0xFF"

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>
This commit is contained in:
Leah Rowe 2024-01-13 00:56:49 +00:00 committed by Leah Rowe
parent 5dbd0e7f90
commit 3f9f58327e

View file

@ -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