]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
some additional key sequences for arc
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Fri, 13 May 2011 14:38:23 +0000 (16:38 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Fri, 13 May 2011 14:38:23 +0000 (16:38 +0200)
grub-core/term/terminfo.c
include/grub/terminfo.h

index 3ba630b333126a86c256ab363bcafeef54581b54..3419a5117e5a9cd4c90653dcafb091765fc7968d 100644 (file)
@@ -445,7 +445,8 @@ grub_terminfo_readkey (struct grub_term_input *term, int *keys, int *len,
        {'K', GRUB_TERM_KEY_END},
        {'P', GRUB_TERM_KEY_DC},
        {'?', GRUB_TERM_KEY_PPAGE},
-       {'/', GRUB_TERM_KEY_NPAGE}
+       {'/', GRUB_TERM_KEY_NPAGE},
+       {'@', GRUB_TERM_KEY_INSERT},
       };
 
     static struct
@@ -460,6 +461,14 @@ grub_terminfo_readkey (struct grub_term_input *term, int *keys, int *len,
        {'5', GRUB_TERM_KEY_PPAGE},
        {'6', GRUB_TERM_KEY_NPAGE}
       };
+    char fx_key[] = 
+      { 'P', 'Q', 'w', 'x', 't', 'u',
+        'q', 'r', 'p', 'M', 'A', 'B' };
+    unsigned fx_code[] = 
+       { GRUB_TERM_KEY_F1, GRUB_TERM_KEY_F2, GRUB_TERM_KEY_F3,
+         GRUB_TERM_KEY_F4, GRUB_TERM_KEY_F5, GRUB_TERM_KEY_F6,
+         GRUB_TERM_KEY_F7, GRUB_TERM_KEY_F8, GRUB_TERM_KEY_F9,
+         GRUB_TERM_KEY_F10, GRUB_TERM_KEY_F11, GRUB_TERM_KEY_F12 };
     unsigned i;
 
     if (c == '\e')
@@ -480,17 +489,53 @@ grub_terminfo_readkey (struct grub_term_input *term, int *keys, int *len,
          return;
        }
 
-    for (i = 0; i < ARRAY_SIZE (four_code_table); i++)
-      if (four_code_table[i].key == c)
+    switch (c)
+      {
+      case 'O':
+       CONTINUE_READ;
+       for (i = 0; i < ARRAY_SIZE (fx_key); i++)
+         if (fx_key[i] == c)
+           {
+             keys[0] = fx_code[i];
+             *len = 1;
+             return;
+           }
+       return;
+
+      case '0':
        {
+         int num = 0;
          CONTINUE_READ;
-         if (c != '~')
+         if (c != '0' && c != '1')
            return;
-         keys[0] = three_code_table[i].ascii;
+         num = (c - '0') * 10;
+         CONTINUE_READ;
+         if (c < '0' || c > '9')
+           return;
+         num += (c - '0');
+         if (num == 0 || num > 12)
+           return;
+         CONTINUE_READ;
+         if (c != 'q')
+           return;
+         keys[0] = fx_code[num - 1];
          *len = 1;
          return;
-       }
-    return;
+       }         
+
+      default:
+       for (i = 0; i < ARRAY_SIZE (four_code_table); i++)
+         if (four_code_table[i].key == c)
+           {
+             CONTINUE_READ;
+             if (c != '~')
+               return;
+             keys[0] = three_code_table[i].ascii;
+             *len = 1;
+             return;
+           }
+       return;
+      }
   }
 #undef CONTINUE_READ
 }
index 5a552b3277541a7b4a1e32a8eb073f943949772c..e3b28ce88ab8b89f7bc69e333ecab9a7cbe09e16 100644 (file)
@@ -27,7 +27,7 @@ char *EXPORT_FUNC(grub_terminfo_get_current) (struct grub_term_output *term);
 grub_err_t EXPORT_FUNC(grub_terminfo_set_current) (struct grub_term_output *term,
                                                                                                const char *);
 
-#define GRUB_TERMINFO_READKEY_MAX_LEN 4
+#define GRUB_TERMINFO_READKEY_MAX_LEN 6
 struct grub_terminfo_input_state
 {
   int input_buf[GRUB_TERMINFO_READKEY_MAX_LEN];