nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

Blame SOURCES/0295-Handle-Japanese-special-keys.patch

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