[efi] Support keyboard remapping via the EFI console

Signed-off-by: Michael Brown <mcb30@ipxe.org>
pull/576/head
Michael Brown 2022-02-10 12:14:46 +00:00
parent eb92ba0a4f
commit 0979b3a11d
1 changed files with 8 additions and 0 deletions

View 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 |