Commit Graph

5 Commits (e1cedbc0d4fdb0e16818f6b722f4873a50780761)

Author SHA1 Message Date
Michael Brown e1cedbc0d4 [console] Support AltGr to access ASCII characters via remapping
Several keyboard layouts define ASCII characters as accessible only
via the AltGr modifier.  Add support for this modifier to ensure that
all ASCII characters are accessible.

Experiments suggest that the BIOS console is likely to fail to
generate ASCII characters when the AltGr key is pressed.  Work around
this limitation by accepting LShift+RShift (which will definitely
produce an ASCII character) as a synonym for AltGr.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-02-15 12:50:26 +00:00
Michael Brown f2a59d5973 [console] Centralise handling of key modifiers
Handle Ctrl and CapsLock key modifiers within key_remap(), to provide
consistent behaviour across different console types.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-02-15 11:58:50 +00:00
Michael Brown 871dd236d4 [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>
2022-02-15 11:58:47 +00:00
Michael Brown 0bbd896783 [console] Handle remapping of scancode 86
The key with scancode 86 appears in the position between left shift
and Z on a US keyboard, where it typically fails to exist entirely.
Most US keyboard maps define this nonexistent key as generating "\|",
with the notable exception of "loadkeys" which instead reports it as
generating "<>".  Both of these mapping choices duplicate keys that
exist elsewhere in the map, which causes problems for our ASCII-based
remapping mechanism.

Work around these quirks by treating the key as generating "\|" with
the high bit set, and making it subject to remapping.  Where the BIOS
generates "\|" as expected, this allows us to remap to the correct
ASCII value.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-02-10 13:59:32 +00:00
Michael Brown f51a62bc3f [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>
2022-02-10 13:11:27 +00:00