]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Simplify AT keyboards and support 102nd key
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Mon, 10 May 2010 18:57:01 +0000 (20:57 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Mon, 10 May 2010 18:57:01 +0000 (20:57 +0200)
commands/keylayouts.c
include/grub/term.h
term/at_keyboard.c

index 24da21364787d77aacf5fd9ecd19fa1ced2b096e..9b1d92c73f1ad5dd752e23f9482e38e17779aa26 100644 (file)
@@ -58,19 +58,12 @@ get_abstract_code (grub_term_input_t term, int in)
   unsigned flags = 0;
   switch (term->flags & GRUB_TERM_INPUT_FLAGS_TYPE_MASK)
     {
+    case GRUB_TERM_INPUT_FLAGS_TYPE_TERMCODES:
     default:
       return in;
     case GRUB_TERM_INPUT_FLAGS_TYPE_BIOS:
       {
        unsigned status = 0;
-       if (term->getkeystatus)
-         status = term->getkeystatus ();
-       if (status & GRUB_TERM_CAPS)
-         flags |= GRUB_TERM_CAPS;
-      }
-      /* Fall through.  */
-    case GRUB_TERM_INPUT_FLAGS_TYPE_AT:
-      {
        struct {
          int from, to; 
        } translations[] =
@@ -88,12 +81,16 @@ get_abstract_code (grub_term_input_t term, int in)
              {0x5600 | '|', GRUB_TERM_KEY_SHIFT_102},
            };
        unsigned i;
+
+       if (term->getkeystatus)
+         status = term->getkeystatus ();
+       if (status & GRUB_TERM_CAPS)
+         flags |= GRUB_TERM_CAPS;
+
        for (i = 0; i < ARRAY_SIZE (translations); i++)
          if (translations[i].from == (in & 0xffff))
            return translations[i].to | flags;
-       if ((term->flags & GRUB_TERM_INPUT_FLAGS_TYPE_MASK)
-           == GRUB_TERM_INPUT_FLAGS_TYPE_AT)
-         return in & ~0xff00;
+
        /* Detect CTRL'ed keys.  */
        if ((in & 0xff) > 0 && (in & 0xff) < 0x20
            && ((in & 0xffff) != (0x0100 | '\e'))
index b3db120df38d992dab77b5f4b94f29b6ccddf8cf..064093bc5fb26584cc07979f6965e55cc991436e 100644 (file)
@@ -152,9 +152,9 @@ struct grub_term_input
 };
 typedef struct grub_term_input *grub_term_input_t;
 
-#define GRUB_TERM_INPUT_FLAGS_TYPE_MASK    0xf
-#define GRUB_TERM_INPUT_FLAGS_TYPE_AT      0x1
-#define GRUB_TERM_INPUT_FLAGS_TYPE_BIOS    0x2
+#define GRUB_TERM_INPUT_FLAGS_TYPE_MASK      0xf
+#define GRUB_TERM_INPUT_FLAGS_TYPE_TERMCODES 0x0
+#define GRUB_TERM_INPUT_FLAGS_TYPE_BIOS      0x1
 
 struct grub_term_output
 {
index f1932f64e1a11fa7026103e701488eaa1f0d8326..bf94200cc094ccff3db1eaf457ca4fde33704b33 100644 (file)
@@ -53,13 +53,14 @@ static int keyboard_map[128] =
   '\0', ' ', '\0', '\0', '\0', '\0', '\0', '\0',
   '\0', '\0', '\0', '\0', '\0', '\0', '\0', GRUB_TERM_KEY_HOME,
   GRUB_TERM_KEY_UP, GRUB_TERM_KEY_NPAGE, '-', GRUB_TERM_KEY_LEFT, '\0', GRUB_TERM_KEY_RIGHT, '+', GRUB_TERM_KEY_END,
-  GRUB_TERM_KEY_DOWN, GRUB_TERM_KEY_PPAGE, '\0', GRUB_TERM_KEY_DC, '\0', '\0', '\0', '\0',
+  GRUB_TERM_KEY_DOWN, GRUB_TERM_KEY_PPAGE, '\0', GRUB_TERM_KEY_DC, '\0', '\0', 
+  GRUB_TERM_KEY_102, '\0',
   '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
   '\0', '\0', '\0', '\0', '\0', OLPC_UP, OLPC_DOWN, OLPC_LEFT,
   OLPC_RIGHT
 };
 
-static char keyboard_map_shift[128] =
+static int keyboard_map_shift[128] =
 {
   '\0', '\0', '!', '@', '#', '$', '%', '^',
   '&', '*', '(', ')', '_', '+', '\0', '\0',
@@ -67,7 +68,8 @@ static char keyboard_map_shift[128] =
   'O', 'P', '{', '}', '\n', '\0', 'A', 'S',
   'D', 'F', 'G', 'H', 'J', 'K', 'L', ':',
   '\"', '~', '\0', '|', 'Z', 'X', 'C', 'V',
-  'B', 'N', 'M', '<', '>', '?'
+  'B', 'N', 'M', '<', '>', '?',
+  [0x56] = GRUB_TERM_KEY_SHIFT_102
 };
 
 static grub_uint8_t grub_keyboard_controller_orig;
@@ -300,7 +302,7 @@ static struct grub_term_input grub_at_keyboard_term =
     .fini = grub_keyboard_controller_fini,
     .checkkey = grub_at_keyboard_checkkey,
     .getkey = grub_at_keyboard_getkey,
-    .flags = GRUB_TERM_INPUT_FLAGS_TYPE_AT
+    .flags = GRUB_TERM_INPUT_FLAGS_TYPE_TERMCODES
   };
 
 GRUB_MOD_INIT(at_keyboard)