at_keyboard: fix unreliable key presses
PATCH 1/1 at_keyboard: fix unreliable key presses
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 <[email protected]>
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(-)
grub-core/term/at_keyboard.c +1 -1
@@ -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;
Signature · 1 line
2.20.1
Quoted 19 lines · Michael Bideau
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 <[email protected]>
Date: Mon May 8 21:41:22 2017 +0200
at_keyboard: Split protocol from controller code.
Quoted 8 lines
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.
Missing SOB. I can add it in behalf of you if it is not a problem for you. And I will tweak a commit message a bit before committing. Otherwise Reviewed-by: Daniel Kiper <[email protected]>
Daniel