diff options
author | Michael Brown <mcb30@ipxe.org> | 2022-02-09 15:43:42 +0000 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2022-02-10 13:59:32 +0000 |
commit | 0bbd8967830097b9141945ba960e90339c230ccb (patch) | |
tree | eca6637c24625b3ca50663d8f5e833f6e4f009b5 /src/drivers | |
parent | 3f05a82fec6223a49df300a9cbf80c6245c3f99e (diff) | |
download | ipxe-0bbd8967830097b9141945ba960e90339c230ccb.tar.gz |
[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 <mcb30@ipxe.org>
Diffstat (limited to 'src/drivers')
-rw-r--r-- | src/drivers/usb/usbkbd.c | 8 | ||||
-rw-r--r-- | src/drivers/usb/usbkbd.h | 1 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/drivers/usb/usbkbd.c b/src/drivers/usb/usbkbd.c index ba4b2d4d7..6954cd69b 100644 --- a/src/drivers/usb/usbkbd.c +++ b/src/drivers/usb/usbkbd.c @@ -114,13 +114,19 @@ static unsigned int usbkbd_map ( unsigned int keycode, unsigned int modifiers, }; key = keypad[ keycode - USBKBD_KEY_PAD_1 ]; }; + } else if ( keycode == USBKBD_KEY_NON_US ) { + /* Non-US \ and | */ + key = ( ( modifiers & USBKBD_SHIFT ) ? + ( KEYMAP_PSEUDO | '|' ) : ( KEYMAP_PSEUDO | '\\' ) ); } else { key = 0; } /* Remap key if applicable */ - if ( keycode < USBKBD_KEY_CAPS_LOCK ) + if ( ( keycode < USBKBD_KEY_CAPS_LOCK ) || + ( keycode == USBKBD_KEY_NON_US ) ) { key = key_remap ( key ); + } /* Handle upper/lower case and Ctrl-<key> */ if ( islower ( key ) ) { diff --git a/src/drivers/usb/usbkbd.h b/src/drivers/usb/usbkbd.h index cedebfe71..1a3fea1ba 100644 --- a/src/drivers/usb/usbkbd.h +++ b/src/drivers/usb/usbkbd.h @@ -75,6 +75,7 @@ enum usb_keycode { USBKBD_KEY_PAD_ENTER = 0x58, USBKBD_KEY_PAD_1 = 0x59, USBKBD_KEY_PAD_DOT = 0x63, + USBKBD_KEY_NON_US = 0x64, }; /** USB keyboard LEDs */ |