Blob Blame History Raw
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Javier Martinez Canillas <javierm@redhat.com>
Date: Fri, 6 Nov 2020 14:14:24 +0100
Subject: [PATCH] at_keyboard: Fix keyboards that report IBM PC AT scan codes
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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 f0a986eb176..ff36b21932d 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