Skeleton for keyboard layouts
This commit is contained in:
parent
c6e5caab1d
commit
87fae34a1f
21 changed files with 337 additions and 168 deletions
|
@ -1154,54 +1154,6 @@ FUNCTION(grub_console_real_putchar)
|
|||
* %al = ASCII character
|
||||
*/
|
||||
|
||||
/* this table is used in translate_keycode below */
|
||||
LOCAL (translation_table):
|
||||
.word GRUB_CONSOLE_KEY_LEFT, GRUB_TERM_LEFT
|
||||
.word GRUB_CONSOLE_KEY_RIGHT, GRUB_TERM_RIGHT
|
||||
.word GRUB_CONSOLE_KEY_UP, GRUB_TERM_UP
|
||||
.word GRUB_CONSOLE_KEY_DOWN, GRUB_TERM_DOWN
|
||||
.word GRUB_CONSOLE_KEY_HOME, GRUB_TERM_HOME
|
||||
.word GRUB_CONSOLE_KEY_END, GRUB_TERM_END
|
||||
.word GRUB_CONSOLE_KEY_DC, GRUB_TERM_DC
|
||||
.word GRUB_CONSOLE_KEY_BACKSPACE, GRUB_TERM_BACKSPACE
|
||||
.word GRUB_CONSOLE_KEY_PPAGE, GRUB_TERM_PPAGE
|
||||
.word GRUB_CONSOLE_KEY_NPAGE, GRUB_TERM_NPAGE
|
||||
.word 0
|
||||
|
||||
/*
|
||||
* translate_keycode translates the key code %dx to an ascii code.
|
||||
*/
|
||||
.code16
|
||||
|
||||
translate_keycode:
|
||||
pushw %bx
|
||||
pushw %si
|
||||
|
||||
#ifdef __APPLE__
|
||||
movw $(ABS(LOCAL (translation_table)) - 0x10000), %si
|
||||
#else
|
||||
movw $ABS(LOCAL (translation_table)), %si
|
||||
#endif
|
||||
|
||||
1: lodsw
|
||||
/* check if this is the end */
|
||||
testw %ax, %ax
|
||||
jz 2f
|
||||
/* load the ascii code into %ax */
|
||||
movw %ax, %bx
|
||||
lodsw
|
||||
/* check if this matches the key code */
|
||||
cmpw %bx, %dx
|
||||
jne 1b
|
||||
/* translate %dx, if successful */
|
||||
movw %ax, %dx
|
||||
|
||||
2: popw %si
|
||||
popw %bx
|
||||
ret
|
||||
|
||||
.code32
|
||||
|
||||
FUNCTION(grub_console_getkey)
|
||||
pushl %ebp
|
||||
|
||||
|
@ -1228,7 +1180,6 @@ FUNCTION(grub_console_getkey)
|
|||
int $0x16
|
||||
|
||||
movw %ax, %dx /* real_to_prot uses %eax */
|
||||
call translate_keycode
|
||||
|
||||
DATA32 call real_to_prot
|
||||
.code32
|
||||
|
|
|
@ -38,7 +38,7 @@ grub_rescue_read_line (char **line, int cont)
|
|||
grub_printf ((cont) ? "> " : "grub rescue> ");
|
||||
grub_memset (linebuf, 0, GRUB_RESCUE_BUF_SIZE);
|
||||
|
||||
while ((c = GRUB_TERM_ASCII_CHAR (grub_getkey ())) != '\n' && c != '\r')
|
||||
while ((c = grub_getkey ()) != '\n' && c != '\r')
|
||||
{
|
||||
if (grub_isprint (c))
|
||||
{
|
||||
|
|
36
kern/term.c
36
kern/term.c
|
@ -75,8 +75,8 @@ grub_putchar (int c)
|
|||
}
|
||||
}
|
||||
|
||||
int
|
||||
grub_getkey (void)
|
||||
static int
|
||||
grub_getkey_dumb (void)
|
||||
{
|
||||
grub_term_input_t term;
|
||||
|
||||
|
@ -88,42 +88,14 @@ grub_getkey (void)
|
|||
{
|
||||
int key = term->checkkey ();
|
||||
if (key != -1)
|
||||
return term->getkey ();
|
||||
return term->getkey () & 0xff;
|
||||
}
|
||||
|
||||
grub_cpu_idle ();
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
grub_checkkey (void)
|
||||
{
|
||||
grub_term_input_t term;
|
||||
|
||||
FOR_ACTIVE_TERM_INPUTS(term)
|
||||
{
|
||||
int key = term->checkkey ();
|
||||
if (key != -1)
|
||||
return key;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
grub_getkeystatus (void)
|
||||
{
|
||||
int status = 0;
|
||||
grub_term_input_t term;
|
||||
|
||||
FOR_ACTIVE_TERM_INPUTS(term)
|
||||
{
|
||||
if (term->getkeystatus)
|
||||
status |= term->getkeystatus ();
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
int (*grub_getkey) (void) = grub_getkey_dumb;
|
||||
|
||||
void
|
||||
grub_cls (void)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue