nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

Blame SOURCES/0491-at_keyboard-Fix-unreliable-key-presses.patch

f6e916
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
f6e916
From: Michael Bideau <mica.devel@gmail.com>
f6e916
Date: Wed, 2 Oct 2019 23:48:10 +0200
f6e916
Subject: [PATCH] at_keyboard: Fix unreliable key presses
f6e916
f6e916
This patch fixes an issue that prevented the at_keyboard module to work
f6e916
(for me). The cause was a bad/wrong return value in the
f6e916
grub_at_keyboard_getkey() function in grub-core/term/at_keyboard.c file
f6e916
at line 237. My symptoms were to have an unresponsive keyboard. Keys
f6e916
needed to be pressed 10x and more to effectively be printed sometimes
f6e916
generating multiple key presses (after 1 or 2 sec of no printing). It
f6e916
was very problematic when typing passphrase in early stage (with
f6e916
GRUB_ENABLE_CRYPTODISK). When switched to "console" terminal input
f6e916
keyboard worked perfectly. It also worked great with the GRUB 2.02
f6e916
packaged by Debian (2.02+dfsg1-20). It was not an output issue but an
f6e916
input one.
f6e916
f6e916
I've managed to analyze the issue and found that it came from the commit
f6e916
216950a4e (at_keyboard: Split protocol from controller code.). Three
f6e916
lines where moved from the fetch_key() function in
f6e916
grub-core/term/at_keyboard.c file to the beginning of
f6e916
grub_at_keyboard_getkey() function (same file). However, returning -1
f6e916
made sense when it happened in fetch_key() function but not anymore in
f6e916
grub_at_keyboard_getkey() function which should return GRUB_TERM_NO_KEY.
f6e916
I think it was just an incomplete cut-paste missing a small manual
f6e916
correction. Let's fix it.
f6e916
f6e916
Note: Commit message updated by Daniel Kiper.
f6e916
f6e916
Signed-off-by: Michael Bideau <mica.devel@gmail.com>
f6e916
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
f6e916
(cherry picked from commit 33203ca3484717712b54e199c46ae8a818374284)
f6e916
---
f6e916
 grub-core/term/at_keyboard.c | 2 +-
f6e916
 1 file changed, 1 insertion(+), 1 deletion(-)
f6e916
f6e916
diff --git a/grub-core/term/at_keyboard.c b/grub-core/term/at_keyboard.c
f6e916
index c805cccbd..dac0f946f 100644
f6e916
--- a/grub-core/term/at_keyboard.c
f6e916
+++ b/grub-core/term/at_keyboard.c
f6e916
@@ -318,7 +318,7 @@ grub_at_keyboard_getkey (struct grub_term_input *term __attribute__ ((unused)))
f6e916
     return GRUB_TERM_NO_KEY;
f6e916
 
f6e916
   if (! KEYBOARD_ISREADY (grub_inb (KEYBOARD_REG_STATUS)))
f6e916
-    return -1;
f6e916
+    return GRUB_TERM_NO_KEY;
f6e916
   at_key = grub_inb (KEYBOARD_REG_DATA);
f6e916
   old_led = ps2_state.led_status;
f6e916