adb_kbd.c: Implement dummy get-key-map word for the ADB keyboard package.
This word is used by some bootloaders to detect keypresses at startup e.g. to enable verbose boot. The current implementation simply returns an empty array (indicating no keys are pressed) as the key/bitmap mapping is unknown; however this allows bootloaders which make use of the word to execute. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@1083 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
parent
8cdeb33758
commit
f77b08b8a8
|
@ -42,11 +42,13 @@ keyboard_close(int *idx)
|
|||
}
|
||||
|
||||
static void keyboard_read(void);
|
||||
static void keyboard_getkeymap(void);
|
||||
|
||||
NODE_METHODS( keyboard ) = {
|
||||
{ "open", keyboard_open },
|
||||
{ "close", keyboard_close },
|
||||
{ "read", keyboard_read },
|
||||
{ "get-key-map", keyboard_getkeymap },
|
||||
};
|
||||
|
||||
/* VT100 escape sequences */
|
||||
|
@ -471,6 +473,7 @@ struct adb_kbd_t {
|
|||
int next_key;
|
||||
char sequence[ADB_MAX_SEQUENCE_LEN];
|
||||
int len;
|
||||
char keytable[32];
|
||||
};
|
||||
|
||||
static adb_dev_t *my_adb_dev = NULL;
|
||||
|
@ -531,6 +534,21 @@ void *adb_kbd_new (char *path, void *private)
|
|||
ADB_kbd_us, ADB_sequences);
|
||||
kbd->next_key = -1;
|
||||
kbd->len = 0;
|
||||
|
||||
/* Debugging BootX: the lines below force get-key-map to report that
|
||||
* cmd-V is being held down, which forces BootX to run in verbose mode
|
||||
* for debugging.
|
||||
*
|
||||
* TODO: if we can find a mapping between the get-key-map bitmap and
|
||||
* ADB scancodes, the keyboard driver should be altered to update this
|
||||
* accordingly.
|
||||
*/
|
||||
|
||||
/*
|
||||
kbd->keytable[3] = 0x40;
|
||||
kbd->keytable[28] = 0x10;
|
||||
*/
|
||||
|
||||
dev->state = kbd;
|
||||
my_adb_dev = dev;
|
||||
}
|
||||
|
@ -566,3 +584,12 @@ static void keyboard_read(void)
|
|||
}
|
||||
PUSH(i);
|
||||
}
|
||||
|
||||
/* ( -- keymap ) (?) */
|
||||
/* should return a pointer to an array with 32 bytes (256 bits) */
|
||||
static void keyboard_getkeymap(void)
|
||||
{
|
||||
adb_kbd_t *kbd = my_adb_dev->state;
|
||||
|
||||
PUSH( pointer2cell(kbd->keytable) );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue