mirror of
https://github.com/ipxe/ipxe
synced 2025-12-23 13:30:57 +03:00
[console] Generalise bios_keymap() as key_remap()
Allow the keyboard remapping functionality to be exposed to consoles other than the BIOS console. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -339,22 +339,6 @@ static const char * bios_ansi_seq ( unsigned int scancode ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Map a key
|
||||
*
|
||||
* @v character Character read from console
|
||||
* @ret character Mapped character
|
||||
*/
|
||||
static int bios_keymap ( unsigned int character ) {
|
||||
struct key_mapping *mapping;
|
||||
|
||||
for_each_table_entry ( mapping, KEYMAP ) {
|
||||
if ( mapping->from == character )
|
||||
return mapping->to;
|
||||
}
|
||||
return character;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get character from BIOS console
|
||||
*
|
||||
@@ -387,7 +371,7 @@ static int bios_getchar ( void ) {
|
||||
|
||||
/* If it's a normal character, just map and return it */
|
||||
if ( character && ( character < 0x80 ) )
|
||||
return bios_keymap ( character );
|
||||
return key_remap ( character );
|
||||
|
||||
/* Otherwise, check for a special key that we know about */
|
||||
if ( ( ansi_seq = bios_ansi_seq ( keypress >> 8 ) ) ) {
|
||||
|
||||
Reference in New Issue
Block a user