|
From: | Renaud Métrich |
Subject: | Re: [PATCH] at_keyboard: Fix keyboards that report IBM PC AT scan codes |
Date: | Fri, 4 Dec 2020 14:51:38 +0100 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 |
Hi,
Testing the proposed patch on my old Asus N53SN in Legacy failed: as soon as at_keyboard is selected, the keys are corrupted and it's impossible to do anything.
Digging into this, it appears that query_mode() returns 2 (so set2 needs to be used), but in fact internally the keycode are the ones expected by set1.
Then I tried always executing the set_scancodes() code querying the driver and it ended up working perfectly: for real set2 was then to be used.
Hence the new proposal below (Vladimir please review this, it may be "too dirty"):
commit 5e8d6963c50cd727bfb5614448f9c80743a59de1 (HEAD -> master) Author: Renaud Métrich <rmetrich@redhat.com> Date: Thu Dec 3 09:43:21 2020 +0100 Force using set_scancodes() code querying the driver. This solves issues when query_mode() returns 2 but the driver continues to send keycodes suitable for set 1 (seen on a Asus N53SN). Resolves: rhbz#1897587 Signed-off-by: Renaud Métrich <rmetrich@redhat.com> diff --git a/grub-core/term/at_keyboard.c b/grub-core/term/at_keyboard.c index 0df54d5..c026034 100644 --- a/grub-core/term/at_keyboard.c +++ b/grub-core/term/at_keyboard.c @@ -172,7 +172,14 @@ set_scancodes (void) return; } -#if !USE_SCANCODE_SET +/* + * Code removed: querying the driver seems to be more robust than just querying + * the mode being returned. This was tested on both: + * - a Lenovo T460s (query_mode() returning 2 and code below working) + * - a Asus N53SN (query_mode() returning 2 but code below now working: driver + * was expecting set1 keycodes) + */ +#if 0 && !USE_SCANCODE_SET
Renaud.
GRUB has support for both the IBM PC XT (Set 1) and IBM PC AT (Set 2) key scan code mappings. But the driver always hardcodes to Set 1, overwriting the mode that was queried in the grub_keyboard_controller_init() function. This breaks keyboard mapping on machines whose firmwares are not using the Set 1. For example, this is the case in Lenovo P71 and HP Elitebook 8770W laptops that report key scan codes using Set 2. Instead of hardcoding to Set 1, use the value that was queried before. Reported-by: Renaud Métrich <rmetrich@redhat.com> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com> --- 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 597111077bd..ed2ea0904c1 100644 --- a/grub-core/term/at_keyboard.c +++ b/grub-core/term/at_keyboard.c @@ -165,7 +165,7 @@ set_scancodes (void) } #if !USE_SCANCODE_SET - ps2_state.current_set = 1; + ps2_state.current_set = grub_keyboard_orig_set; return; #else
OpenPGP_0x5D129094FB6E4326.asc
Description: application/pgp-keys
OpenPGP_signature
Description: OpenPGP digital signature
[Prev in Thread] | Current Thread | [Next in Thread] |