Handle Japanese special keys.

Reported by: Hiroyuki YAMAMORI.
	Codes supplied by: Hiroyuki YAMAMORI.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2013-04-12 22:26:38 +02:00
parent 8573d302fc
commit bbdd6305db
5 changed files with 36 additions and 8 deletions

View file

@ -1,3 +1,9 @@
2013-04-12 Vladimir Serbinenko <phcoder@gmail.com>
Handle Japanese special keys.
Reported by: Hiroyuki YAMAMORI.
Codes supplied by: Hiroyuki YAMAMORI.
2013-04-12 Vladimir Serbinenko <phcoder@gmail.com> 2013-04-12 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-mkimage.c: Document memdisk implying --prefix. * util/grub-mkimage.c: Document memdisk implying --prefix.

View file

@ -132,6 +132,9 @@ map_key_core (int code, int status, int *alt_gr_consumed)
{ {
*alt_gr_consumed = 0; *alt_gr_consumed = 0;
if (code >= GRUB_KEYBOARD_LAYOUTS_ARRAY_SIZE)
return 0;
if (status & GRUB_TERM_STATUS_RALT) if (status & GRUB_TERM_STATUS_RALT)
{ {
if (status & (GRUB_TERM_STATUS_LSHIFT | GRUB_TERM_STATUS_RSHIFT)) 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; 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"); grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid version");
goto fail; goto fail;

View file

@ -97,7 +97,17 @@ static const grub_uint8_t set1_mapping[128] =
/* OLPC keys. Just mapped to normal keys. */ /* OLPC keys. Just mapped to normal keys. */
/* 0x64 */ 0, GRUB_KEYBOARD_KEY_UP, /* 0x64 */ 0, GRUB_KEYBOARD_KEY_UP,
/* 0x66 */ GRUB_KEYBOARD_KEY_DOWN, GRUB_KEYBOARD_KEY_LEFT, /* 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 static const struct
@ -163,7 +173,7 @@ static const grub_uint8_t set2_mapping[256] =
/* 0x4a */ GRUB_KEYBOARD_KEY_SLASH, GRUB_KEYBOARD_KEY_L, /* 0x4a */ GRUB_KEYBOARD_KEY_SLASH, GRUB_KEYBOARD_KEY_L,
/* 0x4c */ GRUB_KEYBOARD_KEY_SEMICOLON, GRUB_KEYBOARD_KEY_P, /* 0x4c */ GRUB_KEYBOARD_KEY_SEMICOLON, GRUB_KEYBOARD_KEY_P,
/* 0x4e */ GRUB_KEYBOARD_KEY_DASH, 0, /* 0x4e */ GRUB_KEYBOARD_KEY_DASH, 0,
/* 0x50 */ 0, 0, /* 0x50 */ 0, GRUB_KEYBOARD_KEY_JP_RO,
/* 0x52 */ GRUB_KEYBOARD_KEY_DQUOTE, 0, /* 0x52 */ GRUB_KEYBOARD_KEY_DQUOTE, 0,
/* 0x54 */ GRUB_KEYBOARD_KEY_LBRACKET, GRUB_KEYBOARD_KEY_EQUAL, /* 0x54 */ GRUB_KEYBOARD_KEY_LBRACKET, GRUB_KEYBOARD_KEY_EQUAL,
/* 0x56 */ 0, 0, /* 0x56 */ 0, 0,
@ -176,7 +186,7 @@ static const grub_uint8_t set2_mapping[256] =
/* 0x64 */ 0, 0, /* 0x64 */ 0, 0,
/* 0x66 */ GRUB_KEYBOARD_KEY_BACKSPACE, 0, /* 0x66 */ GRUB_KEYBOARD_KEY_BACKSPACE, 0,
/* 0x68 */ 0, GRUB_KEYBOARD_KEY_NUM1, /* 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, /* 0x6c */ GRUB_KEYBOARD_KEY_NUM7, 0,
/* 0x6e */ 0, 0, /* 0x6e */ 0, 0,
/* 0x70 */ GRUB_KEYBOARD_KEY_NUMDOT, GRUB_KEYBOARD_KEY_NUM0, /* 0x70 */ GRUB_KEYBOARD_KEY_NUMDOT, GRUB_KEYBOARD_KEY_NUM0,

View file

@ -21,9 +21,9 @@
#define GRUB_KEYBOARD_LAYOUTS_FILEMAGIC "GRUBLAYO" #define GRUB_KEYBOARD_LAYOUTS_FILEMAGIC "GRUBLAYO"
#define GRUB_KEYBOARD_LAYOUTS_FILEMAGIC_SIZE (sizeof(GRUB_KEYBOARD_LAYOUTS_FILEMAGIC) - 1) #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 struct grub_keyboard_layout
{ {
@ -129,6 +129,8 @@ typedef enum grub_keyboard_key
GRUB_KEYBOARD_KEY_NUM0 = 0x62, GRUB_KEYBOARD_KEY_NUM0 = 0x62,
GRUB_KEYBOARD_KEY_NUMDOT = 0x63, GRUB_KEYBOARD_KEY_NUMDOT = 0x63,
GRUB_KEYBOARD_KEY_102ND = 0x64, 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_CTRL = 0xe0,
GRUB_KEYBOARD_KEY_LEFT_SHIFT = 0xe1, GRUB_KEYBOARD_KEY_LEFT_SHIFT = 0xe1,
GRUB_KEYBOARD_KEY_LEFT_ALT = 0xe2, GRUB_KEYBOARD_KEY_LEFT_ALT = 0xe2,

View file

@ -250,7 +250,7 @@ static grub_uint8_t linux_to_usb_map[128] = {
/* 0x52 */ GRUB_KEYBOARD_KEY_NUMDOT, GRUB_KEYBOARD_KEY_NUMDOT, /* 0x52 */ GRUB_KEYBOARD_KEY_NUMDOT, GRUB_KEYBOARD_KEY_NUMDOT,
/* 0x54 */ 0, 0, /* 0x54 */ 0, 0,
/* 0x56 */ GRUB_KEYBOARD_KEY_102ND, GRUB_KEYBOARD_KEY_F11, /* 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, /* 0x5a */ 0, 0,
/* 0x5c */ 0, 0, /* 0x5c */ 0, 0,
/* 0x5e */ 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, /* 0x68 */ GRUB_KEYBOARD_KEY_PPAGE, GRUB_KEYBOARD_KEY_LEFT,
/* 0x6a */ GRUB_KEYBOARD_KEY_RIGHT, GRUB_KEYBOARD_KEY_END, /* 0x6a */ GRUB_KEYBOARD_KEY_RIGHT, GRUB_KEYBOARD_KEY_END,
/* 0x6c */ GRUB_KEYBOARD_KEY_DOWN, GRUB_KEYBOARD_KEY_NPAGE, /* 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 static void