]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* term/ieee1275/ofconsole.c (grub_ofconsole_readkey): Support C0 code.
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Wed, 5 May 2010 16:42:33 +0000 (18:42 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Wed, 5 May 2010 16:42:33 +0000 (18:42 +0200)
ChangeLog
term/ieee1275/ofconsole.c

index 2a6d5e12a0a80e84b5cd45ece985a9f6da21ce38..2cfed5f1ef55506a1d7fa664b392d2de28450505 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-05-05  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * term/ieee1275/ofconsole.c (grub_ofconsole_readkey): Support C0 code.
+
 2010-05-03  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * commands/parttool.c (grub_cmd_parttool): Fix #if !GRUB_NO_MODULES
index c0f895a15d130dfde3e9061f93e4fa0bea312040..26a43bdf4f8bbd0c91dfe5fc8687c6c3ce804113 100644 (file)
@@ -194,14 +194,15 @@ grub_ofconsole_getcolor (grub_uint8_t *normal_color, grub_uint8_t *highlight_col
   *highlight_color = grub_ofconsole_highlight_color;
 }
 
+#define ANSI_C0 0x9b
+
 static int
 grub_ofconsole_readkey (int *key)
 {
-  char c;
+  grub_uint8_t c;
   grub_ssize_t actual = 0;
 
   grub_ieee1275_read (stdin_ihandle, &c, 1, &actual);
-
   if (actual > 0)
     switch(c)
       {
@@ -209,25 +210,30 @@ grub_ofconsole_readkey (int *key)
         /* Backspace: Ctrl-h.  */
         c = '\b'; 
         break;
+      case ANSI_C0:
       case '\e':
        {
          grub_uint64_t start;
-         grub_ieee1275_read (stdin_ihandle, &c, 1, &actual);
-
-         /* On 9600 we have to wait up to 12 milliseconds.  */
-         start = grub_get_time_ms ();
-         while (actual <= 0 && grub_get_time_ms () - start < 12)
-           grub_ieee1275_read (stdin_ihandle, &c, 1, &actual);
 
-         if (actual <= 0)
+         if (c == '\e')
            {
-             *key = '\e';
-             return 1;
+             grub_ieee1275_read (stdin_ihandle, &c, 1, &actual);
+
+             /* On 9600 we have to wait up to 12 milliseconds.  */
+             start = grub_get_time_ms ();
+             while (actual <= 0 && grub_get_time_ms () - start < 12)
+               grub_ieee1275_read (stdin_ihandle, &c, 1, &actual);
+
+             if (actual <= 0)
+               {
+                 *key = '\e';
+                 return 1;
+               }
+
+             if (c != '[')
+               return 0;
            }
 
-         if (c != '[')
-           return 0;
-         
          grub_ieee1275_read (stdin_ihandle, &c, 1, &actual);
 
          /* On 9600 we have to wait up to 12 milliseconds.  */