grub-devel
[Top][All Lists]
Advanced

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

[PATCH] at_keyboard: fix unreliable key presses


From: Michael Bideau
Subject: [PATCH] at_keyboard: fix unreliable key presses
Date: Wed, 2 Oct 2019 23:48:10 +0200

This patch fixes an issue that prevented the 'at_keyboard' module to work (for 
me).

The cause is a bad/wrong return value in the function 
'grub_at_keyboard_getkey()' in file 'grub-core/term/at_keyboard.c' at line 237.

My symptoms were to have an unresponsive keyboard: keys needed to be pressed 
10x and more to
effectively be printed, sometimes generating multiple key presses (after 1 or 2 
sec of no printing).
Very problematic for typing passphrase in early stage (with 
GRUB_ENABLE_CRYPTODISK).
When switching to 'console' terminal input, keyboard works perfectly.
It also worked great with grub 2.02 packaged by Debian (2.02+dfsg1-20).
It was not an output issue, but an input one.

I've managed to analyse the issue and found where it came from: the following 
commit:
///////// commit /////////
Commit: 216950a4eea1a1ead1c28eaca94e34ea2ef2ad19
Author: Vladimir Serbinenko <address@hidden>
Date: Mon May 8 21:41:22 2017 +0200

at_keyboard: Split protocol from controller code.

On vexpress controller is different but protocol is the same, so reuse the code.
///////// end of commit /////////

3 lines where moved from the function 'fetch_key()' in file 
'grub-core/term/at_keyboard.c', to the begining of function 
'grub_at_keyboard_getkey()' (same file).
But returning '-1' made sense when in function 'fetch_key()' but not anymore in 
function 'grub_at_keyboard_getkey()', which should return 'GRUB_TERM_NO_KEY'.

I think it was just an incomplete cut-paste, missing a small manual correction.
Better fix it.
---
 grub-core/term/at_keyboard.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/grub-core/term/at_keyboard.c b/grub-core/term/at_keyboard.c
index f0a986eb1..597111077 100644
--- a/grub-core/term/at_keyboard.c
+++ b/grub-core/term/at_keyboard.c
@@ -234,7 +234,7 @@ grub_at_keyboard_getkey (struct grub_term_input *term 
__attribute__ ((unused)))
     return GRUB_TERM_NO_KEY;
 
   if (! KEYBOARD_ISREADY (grub_inb (KEYBOARD_REG_STATUS)))
-    return -1;
+    return GRUB_TERM_NO_KEY;
   at_key = grub_inb (KEYBOARD_REG_DATA);
   old_led = ps2_state.led_status;
 
-- 
2.20.1




reply via email to

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