[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>
This commit is contained in:
Michael Brown
2022-02-14 13:22:48 +00:00
parent 1150321595
commit 871dd236d4
33 changed files with 373 additions and 130 deletions

View File

@@ -13,16 +13,29 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdint.h>
#include <ipxe/tables.h>
/** A keyboard mapping */
struct key_mapping {
/** A remapped key
*
* Represents a mapping from an ASCII character (as interpreted from a
* keyboard scancode by the US-only keyboard driver provided by the
* BIOS) to the appropriate ASCII value for the keyboard layout.
*/
struct keymap_key {
/** Character read from keyboard */
uint8_t from;
/** Character to be used instead */
uint8_t to;
} __attribute__ (( packed ));
/** A keyboard mapping */
struct keymap {
/** Name */
const char *name;
/** Basic remapping table (zero-terminated) */
struct keymap_key *basic;
};
/** Keyboard mapping table */
#define KEYMAP __table ( struct key_mapping, "keymap" )
#define KEYMAP __table ( struct keymap, "keymap" )
/** Define a keyboard mapping */
#define __keymap __table_entry ( KEYMAP, 01 )