diff options
author | Michael Brown <mcb30@ipxe.org> | 2022-02-14 13:22:48 +0000 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2022-02-15 11:58:47 +0000 |
commit | 871dd236d4aff66e871c25addcf522fe75a4ccd7 (patch) | |
tree | 92972b82b4469c1802a7b335d439e04aa0f8e604 /src/core | |
parent | 1150321595c44acfac2b2c56590d4d7f1d2ad70c (diff) | |
download | ipxe-871dd236d4aff66e871c25addcf522fe75a4ccd7.tar.gz |
[console] Allow for named keyboard mappings
Separate the concept of a keyboard mapping from a list of remapped
keys, to allow for the possibility of supporting multiple keyboard
mappings at runtime.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/keymap.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/core/keymap.c b/src/core/keymap.c index 5054e4769..c0953967a 100644 --- a/src/core/keymap.c +++ b/src/core/keymap.c @@ -31,6 +31,12 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); * */ +/** Default keyboard mapping */ +static TABLE_START ( keymap_start, KEYMAP ); + +/** Current keyboard mapping */ +static struct keymap *keymap = keymap_start; + /** * Remap a key * @@ -38,12 +44,12 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); * @ret character Mapped character */ unsigned int key_remap ( unsigned int character ) { - struct key_mapping *mapping; + struct keymap_key *key; /* Remap via table */ - for_each_table_entry ( mapping, KEYMAP ) { - if ( mapping->from == character ) { - character = mapping->to; + for ( key = keymap->basic ; key->from ; key++ ) { + if ( key->from == character ) { + character = key->to; break; } } |