From 3ef4f7e2ef4a22ea1e2eccc72957d7bf3fe2f945 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Tue, 4 Jul 2023 14:31:07 +0100 Subject: [console] Avoid overlap between special keys and Unicode characters The special key range (from KEY_MIN upwards) currently overlaps with the valid range for Unicode characters, and therefore prohibits the use of Unicode key values outside the ASCII range. Create space for Unicode key values by moving the special keys to the range immediately above the maximum valid Unicode character. This allows the existing encoding of special keys as an efficiently packed representation of the equivalent ANSI escape sequence to be maintained almost as-is. Signed-off-by: Michael Brown --- src/drivers/usb/usbkbd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/drivers') diff --git a/src/drivers/usb/usbkbd.c b/src/drivers/usb/usbkbd.c index b284e584f..cf881ad1a 100644 --- a/src/drivers/usb/usbkbd.c +++ b/src/drivers/usb/usbkbd.c @@ -95,7 +95,7 @@ static unsigned int usbkbd_map ( unsigned int keycode, unsigned int modifiers, } } else if ( keycode <= USBKBD_KEY_UP ) { /* Special keys */ - static const uint16_t special[] = { + static const unsigned int special[] = { 0, 0, 0, 0, 0, KEY_F5, KEY_F6, KEY_F7, KEY_F8, KEY_F9, KEY_F10, KEY_F11, KEY_F12, 0, 0, 0, KEY_IC, KEY_HOME, KEY_PPAGE, KEY_DC, KEY_END, KEY_NPAGE, KEY_RIGHT, @@ -110,7 +110,7 @@ static unsigned int usbkbd_map ( unsigned int keycode, unsigned int modifiers, if ( leds & USBKBD_LED_NUM_LOCK ) { key = "1234567890." [ keycode - USBKBD_KEY_PAD_1 ]; } else { - static const uint16_t keypad[] = { + static const unsigned int keypad[] = { KEY_END, KEY_DOWN, KEY_NPAGE, KEY_LEFT, 0, KEY_RIGHT, KEY_HOME, KEY_UP, KEY_PPAGE, KEY_IC, KEY_DC -- cgit v1.2.3-55-g7522