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:
parent
42b1d18685
commit
d1484a422e
2 changed files with 79 additions and 45 deletions
|
@ -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.
|
||||||
|
|
|
@ -202,53 +202,82 @@ 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)
|
||||||
grub_uint64_t start;
|
{
|
||||||
grub_ieee1275_read (stdin_ihandle, &c, 1, &actual);
|
case 0x7f:
|
||||||
|
/* Backspace: Ctrl-h. */
|
||||||
/* On 9600 we have to wait up to 12 milliseconds. */
|
c = '\b';
|
||||||
start = grub_get_time_ms ();
|
break;
|
||||||
while (actual <= 0 && grub_get_time_ms () - start < 12)
|
case '\e':
|
||||||
grub_ieee1275_read (stdin_ihandle, &c, 1, &actual);
|
|
||||||
|
|
||||||
if (actual <= 0)
|
|
||||||
{
|
{
|
||||||
*key = '\e';
|
grub_uint64_t start;
|
||||||
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;
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
*key = c;
|
*key = c;
|
||||||
return actual > 0;
|
return actual > 0;
|
||||||
|
|
Loading…
Reference in a new issue