]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[efi] Support keyboard remapping via the EFI console
authorMichael Brown <mcb30@ipxe.org>
Thu, 10 Feb 2022 12:14:46 +0000 (12:14 +0000)
committerMichael Brown <mcb30@ipxe.org>
Thu, 10 Feb 2022 13:11:27 +0000 (13:11 +0000)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/interface/efi/efi_console.c

index 98ebbf3acd5d223b605ac73e0c44c177469365fa..874f54b6c4e2ddb23f706f5f7504a57048c8614e 100644 (file)
@@ -27,6 +27,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
 #include <ipxe/efi/Protocol/ConsoleControl/ConsoleControl.h>
 #include <ipxe/ansiesc.h>
 #include <ipxe/console.h>
+#include <ipxe/keymap.h>
 #include <ipxe/init.h>
 #include <config/console.h>
 
@@ -317,6 +318,13 @@ static int efi_getchar ( void ) {
               key.KeyState.KeyToggleState, key.Key.UnicodeChar,
               key.Key.ScanCode );
 
+       /* Remap key.  There is unfortunately no way to avoid
+        * remapping the numeric keypad, since EFI destroys the scan
+        * code information that would allow us to differentiate
+        * between main keyboard and numeric keypad.
+        */
+       key.Key.UnicodeChar = key_remap ( key.Key.UnicodeChar );
+
        /* Translate Ctrl-<key> */
        if ( ( key.KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID ) &&
             ( key.KeyState.KeyShiftState & ( EFI_LEFT_CONTROL_PRESSED |