From d7fb10cb74e2b9b34af099381a07d2ce0d7ff913 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 12 Apr 2013 22:26:38 +0200 Subject: [PATCH 295/471] Handle Japanese special keys. Reported by: Hiroyuki YAMAMORI. Codes supplied by: Hiroyuki YAMAMORI. --- ChangeLog | 6 ++++++ grub-core/commands/keylayouts.c | 5 ++++- grub-core/term/at_keyboard.c | 16 +++++++++++++--- include/grub/keyboard_layouts.h | 6 ++++-- util/grub-mklayout.c | 11 +++++++++-- 5 files changed, 36 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 92cb29d..7054441 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2013-04-12 Vladimir Serbinenko + Handle Japanese special keys. + Reported by: Hiroyuki YAMAMORI. + Codes supplied by: Hiroyuki YAMAMORI. + +2013-04-12 Vladimir Serbinenko + * util/grub-mkimage.c: Document memdisk implying --prefix. 2013-04-12 Vladimir Serbinenko diff --git a/grub-core/commands/keylayouts.c b/grub-core/commands/keylayouts.c index 6b5141c..b93ddf1 100644 --- a/grub-core/commands/keylayouts.c +++ b/grub-core/commands/keylayouts.c @@ -132,6 +132,9 @@ map_key_core (int code, int status, int *alt_gr_consumed) { *alt_gr_consumed = 0; + if (code >= GRUB_KEYBOARD_LAYOUTS_ARRAY_SIZE) + return 0; + if (status & GRUB_TERM_STATUS_RALT) { if (status & (GRUB_TERM_STATUS_LSHIFT | GRUB_TERM_STATUS_RSHIFT)) @@ -242,7 +245,7 @@ grub_cmd_keymap (struct grub_command *cmd __attribute__ ((unused)), goto fail; } - if (grub_le_to_cpu32 (version) != GRUB_KEYBOARD_LAYOUTS_VERSION) + if (version != grub_cpu_to_le32_compile_time (GRUB_KEYBOARD_LAYOUTS_VERSION)) { grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid version"); goto fail; diff --git a/grub-core/term/at_keyboard.c b/grub-core/term/at_keyboard.c index b2f328f..e255d40 100644 --- a/grub-core/term/at_keyboard.c +++ b/grub-core/term/at_keyboard.c @@ -97,7 +97,17 @@ static const grub_uint8_t set1_mapping[128] = /* OLPC keys. Just mapped to normal keys. */ /* 0x64 */ 0, GRUB_KEYBOARD_KEY_UP, /* 0x66 */ GRUB_KEYBOARD_KEY_DOWN, GRUB_KEYBOARD_KEY_LEFT, - /* 0x68 */ GRUB_KEYBOARD_KEY_RIGHT + /* 0x68 */ GRUB_KEYBOARD_KEY_RIGHT, 0, + /* 0x6a */ 0, 0, + /* 0x6c */ 0, 0, + /* 0x6e */ 0, 0, + /* 0x70 */ 0, 0, + /* 0x72 */ 0, GRUB_KEYBOARD_KEY_JP_RO, + /* 0x74 */ 0, 0, + /* 0x76 */ 0, 0, + /* 0x78 */ 0, 0, + /* 0x7a */ 0, 0, + /* 0x7c */ 0, GRUB_KEYBOARD_KEY_JP_YEN, }; static const struct @@ -163,7 +173,7 @@ static const grub_uint8_t set2_mapping[256] = /* 0x4a */ GRUB_KEYBOARD_KEY_SLASH, GRUB_KEYBOARD_KEY_L, /* 0x4c */ GRUB_KEYBOARD_KEY_SEMICOLON, GRUB_KEYBOARD_KEY_P, /* 0x4e */ GRUB_KEYBOARD_KEY_DASH, 0, - /* 0x50 */ 0, 0, + /* 0x50 */ 0, GRUB_KEYBOARD_KEY_JP_RO, /* 0x52 */ GRUB_KEYBOARD_KEY_DQUOTE, 0, /* 0x54 */ GRUB_KEYBOARD_KEY_LBRACKET, GRUB_KEYBOARD_KEY_EQUAL, /* 0x56 */ 0, 0, @@ -176,7 +186,7 @@ static const grub_uint8_t set2_mapping[256] = /* 0x64 */ 0, 0, /* 0x66 */ GRUB_KEYBOARD_KEY_BACKSPACE, 0, /* 0x68 */ 0, GRUB_KEYBOARD_KEY_NUM1, - /* 0x6a */ 0, GRUB_KEYBOARD_KEY_NUM4, + /* 0x6a */ GRUB_KEYBOARD_KEY_JP_YEN, GRUB_KEYBOARD_KEY_NUM4, /* 0x6c */ GRUB_KEYBOARD_KEY_NUM7, 0, /* 0x6e */ 0, 0, /* 0x70 */ GRUB_KEYBOARD_KEY_NUMDOT, GRUB_KEYBOARD_KEY_NUM0, diff --git a/include/grub/keyboard_layouts.h b/include/grub/keyboard_layouts.h index 1f7213c..8d94490 100644 --- a/include/grub/keyboard_layouts.h +++ b/include/grub/keyboard_layouts.h @@ -21,9 +21,9 @@ #define GRUB_KEYBOARD_LAYOUTS_FILEMAGIC "GRUBLAYO" #define GRUB_KEYBOARD_LAYOUTS_FILEMAGIC_SIZE (sizeof(GRUB_KEYBOARD_LAYOUTS_FILEMAGIC) - 1) -#define GRUB_KEYBOARD_LAYOUTS_VERSION 8 +#define GRUB_KEYBOARD_LAYOUTS_VERSION 10 -#define GRUB_KEYBOARD_LAYOUTS_ARRAY_SIZE 128 +#define GRUB_KEYBOARD_LAYOUTS_ARRAY_SIZE 160 struct grub_keyboard_layout { @@ -129,6 +129,8 @@ typedef enum grub_keyboard_key GRUB_KEYBOARD_KEY_NUM0 = 0x62, GRUB_KEYBOARD_KEY_NUMDOT = 0x63, GRUB_KEYBOARD_KEY_102ND = 0x64, + GRUB_KEYBOARD_KEY_JP_RO = 0x87, + GRUB_KEYBOARD_KEY_JP_YEN = 0x89, GRUB_KEYBOARD_KEY_LEFT_CTRL = 0xe0, GRUB_KEYBOARD_KEY_LEFT_SHIFT = 0xe1, GRUB_KEYBOARD_KEY_LEFT_ALT = 0xe2, diff --git a/util/grub-mklayout.c b/util/grub-mklayout.c index bff4dd6..e53d710 100644 --- a/util/grub-mklayout.c +++ b/util/grub-mklayout.c @@ -250,7 +250,7 @@ static grub_uint8_t linux_to_usb_map[128] = { /* 0x52 */ GRUB_KEYBOARD_KEY_NUMDOT, GRUB_KEYBOARD_KEY_NUMDOT, /* 0x54 */ 0, 0, /* 0x56 */ GRUB_KEYBOARD_KEY_102ND, GRUB_KEYBOARD_KEY_F11, - /* 0x58 */ GRUB_KEYBOARD_KEY_F12, 0, + /* 0x58 */ GRUB_KEYBOARD_KEY_F12, GRUB_KEYBOARD_KEY_JP_RO, /* 0x5a */ 0, 0, /* 0x5c */ 0, 0, /* 0x5e */ 0, 0, @@ -261,7 +261,14 @@ static grub_uint8_t linux_to_usb_map[128] = { /* 0x68 */ GRUB_KEYBOARD_KEY_PPAGE, GRUB_KEYBOARD_KEY_LEFT, /* 0x6a */ GRUB_KEYBOARD_KEY_RIGHT, GRUB_KEYBOARD_KEY_END, /* 0x6c */ GRUB_KEYBOARD_KEY_DOWN, GRUB_KEYBOARD_KEY_NPAGE, - /* 0x6e */ GRUB_KEYBOARD_KEY_INSERT, GRUB_KEYBOARD_KEY_DELETE + /* 0x6e */ GRUB_KEYBOARD_KEY_INSERT, GRUB_KEYBOARD_KEY_DELETE, + /* 0x70 */ 0, 0, + /* 0x72 */ 0, GRUB_KEYBOARD_KEY_JP_RO, + /* 0x74 */ 0, 0, + /* 0x76 */ 0, 0, + /* 0x78 */ 0, 0, + /* 0x7a */ 0, 0, + /* 0x7c */ GRUB_KEYBOARD_KEY_JP_YEN, }; static void -- 1.8.2.1