2010-02-20 Manoel Rebelo Abranches <mrabran@br.ibm.com>

* term/ieee1275/ofconsole.c (grub_ofconsole_readkey): Add delete and
	backspace keys.
This commit is contained in:
Manoel Rebelo Abranches 2010-02-20 11:23:13 +01:00 committed by Vladimir 'phcoder' Serbinenko
parent 42b1d18685
commit d1484a422e
2 changed files with 79 additions and 45 deletions

View file

@ -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> 2010-02-20 Vladimir Serbinenko <phcoder@gmail.com>
* video/fb/video_fb.c (grub_video_fb_scroll): Fix a pixel size bug. * video/fb/video_fb.c (grub_video_fb_scroll): Fix a pixel size bug.

View file

@ -202,7 +202,14 @@ grub_ofconsole_readkey (int *key)
grub_ieee1275_read (stdin_ihandle, &c, 1, &actual); grub_ieee1275_read (stdin_ihandle, &c, 1, &actual);
if (actual > 0 && c == '\e') if (actual > 0)
switch(c)
{
case 0x7f:
/* Backspace: Ctrl-h. */
c = '\b';
break;
case '\e':
{ {
grub_uint64_t start; grub_uint64_t start;
grub_ieee1275_read (stdin_ihandle, &c, 1, &actual); grub_ieee1275_read (stdin_ihandle, &c, 1, &actual);
@ -222,6 +229,7 @@ grub_ofconsole_readkey (int *key)
return 0; return 0;
grub_ieee1275_read (stdin_ihandle, &c, 1, &actual); grub_ieee1275_read (stdin_ihandle, &c, 1, &actual);
/* On 9600 we have to wait up to 12 milliseconds. */ /* On 9600 we have to wait up to 12 milliseconds. */
start = grub_get_time_ms (); start = grub_get_time_ms ();
while (actual <= 0 && grub_get_time_ms () - start < 12) while (actual <= 0 && grub_get_time_ms () - start < 12)
@ -247,6 +255,27 @@ grub_ofconsole_readkey (int *key)
/* Left: Ctrl-b. */ /* Left: Ctrl-b. */
c = GRUB_TERM_LEFT; c = GRUB_TERM_LEFT;
break; 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;
}
} }
} }