From 0bbd8967830097b9141945ba960e90339c230ccb Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Wed, 9 Feb 2022 15:43:42 +0000 Subject: [console] Handle remapping of scancode 86 The key with scancode 86 appears in the position between left shift and Z on a US keyboard, where it typically fails to exist entirely. Most US keyboard maps define this nonexistent key as generating "\|", with the notable exception of "loadkeys" which instead reports it as generating "<>". Both of these mapping choices duplicate keys that exist elsewhere in the map, which causes problems for our ASCII-based remapping mechanism. Work around these quirks by treating the key as generating "\|" with the high bit set, and making it subject to remapping. Where the BIOS generates "\|" as expected, this allows us to remap to the correct ASCII value. Signed-off-by: Michael Brown --- src/arch/x86/interface/pcbios/bios_console.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/arch') diff --git a/src/arch/x86/interface/pcbios/bios_console.c b/src/arch/x86/interface/pcbios/bios_console.c index 443513e9e..438a01d07 100644 --- a/src/arch/x86/interface/pcbios/bios_console.c +++ b/src/arch/x86/interface/pcbios/bios_console.c @@ -68,6 +68,13 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); */ #define SCANCODE_RSHIFT 0x36 +/** Scancode for the "non-US \ and |" key + * + * This is the key that appears between Left Shift and Z on non-US + * keyboards. + */ +#define SCANCODE_NON_US 0x56 + /* Set default console usage if applicable */ #if ! ( defined ( CONSOLE_PCBIOS ) && CONSOLE_EXPLICIT ( CONSOLE_PCBIOS ) ) #undef CONSOLE_PCBIOS @@ -383,6 +390,8 @@ static int bios_getchar ( void ) { if ( character && ( character < 0x80 ) ) { if ( scancode < SCANCODE_RSHIFT ) { return key_remap ( character ); + } else if ( scancode == SCANCODE_NON_US ) { + return key_remap ( character | KEYMAP_PSEUDO ); } else { return character; } -- cgit v1.2.3-55-g7522