]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2010-02-20 Manoel Rebelo Abranches <mrabran@br.ibm.com>
authorManoel Rebelo Abranches <mrabran@br.ibm.com>
Sat, 20 Feb 2010 10:23:13 +0000 (11:23 +0100)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sat, 20 Feb 2010 10:23:13 +0000 (11:23 +0100)
* term/ieee1275/ofconsole.c (grub_ofconsole_readkey): Add delete and
backspace keys.

ChangeLog
term/ieee1275/ofconsole.c

index ca8e3c3fdd2dfeaf040aba1d1baa0c1838b3d1c2..95dcd51a7077832329d9f361c2d23fc5f7dd6a14 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-02-20  Manoel Rebelo Abranches <mrabran@br.ibm.com>
+
+       * term/ieee1275/ofconsole.c (grub_ofconsole_readkey): Add delete and
+       backspace keys.
+
 2010-02-20  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * video/fb/video_fb.c (grub_video_fb_scroll): Fix a pixel size bug.
index 82108022a219da3c620d78393a22166ce41b8ce5..a4ffdcd23e099f82f589d992e6a9af630b474c13 100644 (file)
@@ -202,53 +202,82 @@ grub_ofconsole_readkey (int *key)
 
   grub_ieee1275_read (stdin_ihandle, &c, 1, &actual);
 
-  if (actual > 0 && c == '\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 (actual > 0)
+    switch(c)
+      {
+      case 0x7f:
+        /* Backspace: Ctrl-h.  */
+        c = '\b'; 
+        break;
+      case '\e':
        {
-         *key = '\e';
-         return 1;
-       }
-
-      if (c != '[')
-       return 0;
-
-      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)
-       return 0;
-
-      switch (c)
-       {
-       case 'A':
-         /* Up: Ctrl-p.  */
-         c = GRUB_TERM_UP;
-         break;
-       case 'B':
-         /* Down: Ctrl-n.  */
-         c = GRUB_TERM_DOWN;
-         break;
-       case 'C':
-         /* Right: Ctrl-f.  */
-         c = GRUB_TERM_RIGHT;
-         break;
-       case 'D':
-         /* Left: Ctrl-b.  */
-         c = GRUB_TERM_LEFT;
-         break;
+         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)
+           {
+             *key = '\e';
+             return 1;
+           }
+
+         if (c != '[')
+           return 0;
+         
+         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)
+           return 0;
+
+         switch (c)
+           {
+           case 'A':
+             /* Up: Ctrl-p.  */
+             c = GRUB_TERM_UP;
+             break;
+           case 'B':
+             /* Down: Ctrl-n.  */
+             c = GRUB_TERM_DOWN;
+             break;
+           case 'C':
+             /* Right: Ctrl-f.  */
+             c = GRUB_TERM_RIGHT;
+             break;
+           case 'D':
+             /* Left: Ctrl-b.  */
+             c = GRUB_TERM_LEFT;
+             break;
+           case '3':
+             {
+               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)
+                 return 0;
+           
+               /* Delete: Ctrl-d.  */
+               if (c == '~')
+                 c = GRUB_TERM_DC;
+               else
+                 return 0;
+               break;
+             }
+             break;
+           }
        }
-    }
+      }
 
   *key = c;
   return actual > 0;