mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-22 23:32:39 +00:00
Make USB the main keylayout for simplicity
This commit is contained in:
1 parent
49c822bc42
commit
c32f26bce8
7 files changed
+321
-239
No files matched your search
+5
-1
@@ -23,6 +23,7 @@
|
||||
#include <grub/misc.h>
|
||||
#include <grub/term.h>
|
||||
#include <grub/keyboard_layouts.h>
|
||||
#include <grub/atkeymap.h>
|
||||
|
||||
static short at_keyboard_status = 0;
|
||||
static int extended_pending = 0;
|
||||
@@ -123,6 +124,8 @@ grub_keyboard_getkey (void)
|
||||
key = grub_inb (KEYBOARD_REG_DATA);
|
||||
/* FIXME */ grub_keyboard_isr (key);
|
||||
ret = KEYBOARD_SCANCODE (key);
|
||||
if (ret == SHIFT_L || ret == SHIFT_R || ret == ALT || ret == CTRL)
|
||||
return -1;
|
||||
if (extended_pending)
|
||||
ret |= 0x80;
|
||||
extended_pending = (key == 0xe0);
|
||||
@@ -175,7 +178,8 @@ grub_at_keyboard_getkey_noblock (void)
|
||||
keyboard_controller_led (led_status);
|
||||
return -1;
|
||||
default:
|
||||
return grub_term_map_key (code, at_keyboard_status);
|
||||
return grub_term_map_key (grub_at_map_to_usb (code),
|
||||
at_keyboard_status);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-80
@@ -29,76 +29,6 @@
|
||||
|
||||
|
||||
|
||||
static grub_uint8_t usb_to_at_map[128] =
|
||||
{
|
||||
/* 0x00 */ 0x00, 0x00,
|
||||
/* 0x02 */ 0x00, 0x00,
|
||||
/* 0x04 */ 0x1e /* a */, 0x30 /* b */,
|
||||
/* 0x06 */ 0x2e /* c */, 0x20 /* d */,
|
||||
/* 0x08 */ 0x12 /* e */, 0x21 /* f */,
|
||||
/* 0x0a */ 0x22 /* g */, 0x23 /* h */,
|
||||
/* 0x0c */ 0x17 /* i */, 0x24 /* j */,
|
||||
/* 0x0e */ 0x25 /* k */, 0x26 /* l */,
|
||||
/* 0x10 */ 0x32 /* m */, 0x31 /* n */,
|
||||
/* 0x12 */ 0x18 /* o */, 0x19 /* p */,
|
||||
/* 0x14 */ 0x10 /* q */, 0x13 /* r */,
|
||||
/* 0x16 */ 0x1f /* s */, 0x14 /* t */,
|
||||
/* 0x18 */ 0x16 /* u */, 0x2f /* v */,
|
||||
/* 0x1a */ 0x11 /* w */, 0x2d /* x */,
|
||||
/* 0x1c */ 0x15 /* y */, 0x2c /* z */,
|
||||
/* 0x1e */ 0x02 /* 1 */, 0x03 /* 2 */,
|
||||
/* 0x20 */ 0x04 /* 3 */, 0x05 /* 4 */,
|
||||
/* 0x22 */ 0x06 /* 5 */, 0x07 /* 6 */,
|
||||
/* 0x24 */ 0x08 /* 7 */, 0x09 /* 8 */,
|
||||
/* 0x26 */ 0x0a /* 9 */, 0x0b /* 0 */,
|
||||
/* 0x28 */ 0x1c /* Enter */, 0x01 /* Escape */,
|
||||
/* 0x2a */ 0x0e /* \b */, 0x0f /* \t */,
|
||||
/* 0x2c */ 0x39 /* Space */, 0x0c /* - */,
|
||||
/* 0x2e */ 0x0d /* = */, 0x1a /* [ */,
|
||||
/* According to usage table 0x31 should be remapped to 0x2b
|
||||
but testing with real keyboard shows that 0x32 is remapped to 0x2b. */
|
||||
/* 0x30 */ 0x1b /* ] */, 0x00,
|
||||
/* 0x32 */ 0x2b /* \ */, 0x27 /* ; */,
|
||||
/* 0x34 */ 0x28 /* " */, 0x29 /* ` */,
|
||||
/* 0x36 */ 0x33 /* , */, 0x34 /* . */,
|
||||
/* 0x38 */ 0x35 /* / */, 0x00,
|
||||
/* 0x3a */ 0x3b /* F1 */, 0x3c /* F2 */,
|
||||
/* 0x3c */ 0x3d /* F3 */, 0x3e /* F4 */,
|
||||
/* 0x3e */ 0x3f /* F5 */, 0x40 /* F6 */,
|
||||
/* 0x40 */ 0x41 /* F7 */, 0x42 /* F8 */,
|
||||
/* 0x42 */ 0x43 /* F9 */, 0x44 /* F10 */,
|
||||
/* 0x44 */ 0x57 /* F11 */, 0x58 /* F12 */,
|
||||
/* 0x46 */ 0x00, 0x00,
|
||||
/* 0x48 */ 0x00, 0xd2 /* Insert */,
|
||||
/* 0x4a */ 0xc7 /* HOME */, 0xd1 /* PPAGE */,
|
||||
/* 0x4c */ 0xd3 /* DC */, 0xcf /* END */,
|
||||
/* 0x4e */ 0xc9 /* NPAGE */, 0xcd /* RIGHT */,
|
||||
/* 0x50 */ 0xcb /* LEFT */, 0xd0 /* DOWN */,
|
||||
/* 0x52 */ 0xc8 /* UP */, 0x00,
|
||||
/* 0x54 */ 0xb5 /* Num / */, 0xb7 /* Num * */,
|
||||
/* 0x56 */ 0x4a /* Num - */, 0x4e /* Num + */,
|
||||
/* 0x58 */ 0x9c /* Num \n */, 0x4f /* Num 1 */,
|
||||
/* 0x5a */ 0x50 /* Num 2 */, 0x51 /* Num 3 */,
|
||||
/* 0x5c */ 0x4b /* Num 4 */, 0x4c /* Num 5 */,
|
||||
/* 0x5e */ 0x4d /* Num 6 */, 0x47 /* Num 7 */,
|
||||
/* 0x60 */ 0x48 /* Num 8 */, 0x49 /* Num 9 */,
|
||||
/* 0x62 */ 0x52 /* Num 0 */, 0x53 /* Num . */,
|
||||
/* 0x64 */ 0x56 /* 102nd key. */, 0x00,
|
||||
/* 0x66 */ 0x00, 0x00,
|
||||
/* 0x68 */ 0x00, 0x00,
|
||||
/* 0x6a */ 0x00, 0x00,
|
||||
/* 0x6c */ 0x00, 0x00,
|
||||
/* 0x6e */ 0x00, 0x00,
|
||||
/* 0x70 */ 0x00, 0x00,
|
||||
/* 0x72 */ 0x00, 0x00,
|
||||
/* 0x74 */ 0x00, 0x00,
|
||||
/* 0x76 */ 0x00, 0x00,
|
||||
/* 0x78 */ 0x00, 0x00,
|
||||
/* 0x7a */ 0x00, 0x00,
|
||||
/* 0x7c */ 0x00, 0x00,
|
||||
/* 0x7e */ 0x00, 0x00,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
KEY_NO_KEY = 0x00,
|
||||
@@ -428,16 +358,9 @@ grub_usb_keyboard_checkkey (struct grub_term_input *term)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (data[2] >= ARRAY_SIZE (usb_to_at_map) || usb_to_at_map[data[2]] == 0)
|
||||
grub_printf ("Unknown key 0x%02x detected\n", data[2]);
|
||||
else
|
||||
{
|
||||
termdata->last_key = termdata->key
|
||||
= grub_term_map_key (usb_to_at_map[data[2]],
|
||||
interpret_status (data[0]) | termdata->mods);
|
||||
termdata->repeat_time = grub_get_time_ms ()
|
||||
+ GRUB_TERM_REPEAT_PRE_INTERVAL;
|
||||
}
|
||||
termdata->last_key = termdata->key
|
||||
= grub_term_map_key (data[2], interpret_status (data[0]) | termdata->mods);
|
||||
termdata->repeat_time = grub_get_time_ms () + GRUB_TERM_REPEAT_PRE_INTERVAL;
|
||||
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
|
||||
|
||||
Reference in new issue
Block a user