summaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
authorMichael Brown2022-02-16 16:19:35 +0100
committerMichael Brown2022-02-16 16:31:47 +0100
commitbc5c612f756b11c08e5e1eaeee3c1fd91252534d (patch)
tree5068ece4582bf3f2da30bfb35f42ab53984df155 /src/util
parent[console] Support changing keyboard map at runtime (diff)
downloadipxe-bc5c612f756b11c08e5e1eaeee3c1fd91252534d.tar.gz
ipxe-bc5c612f756b11c08e5e1eaeee3c1fd91252534d.tar.xz
ipxe-bc5c612f756b11c08e5e1eaeee3c1fd91252534d.zip
[console] Include mappings for AltGr-Shift-<key>
The BIOS console's interpretation of LShift+RShift as equivalent to AltGr requires the shifted ASCII characters to be present in the AltGr mapping table, to allow AltGr-Shift-<key> to be interpreted in the same way as AltGr-<key>. For keyboard layouts that have different ASCII characters for AltGr-<key> and AltGr-Shift-<key>, this will potentially leave the character for AltGr-<key> inaccessible via the BIOS console if the BIOS requires the use of the LShift+RShift workaround. This theoretically affects the numeric keys in the Lithuanian ("lt") keyboard layout (where the numerals are accessed via AltGr-<key> and punctuation characters via AltGr-Shift-<key>), but the simple workaround for that keyboard layout is to avoid using AltGr and Shift entirely since the unmodified numeric keys are not remapped anyway. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/util')
-rwxr-xr-xsrc/util/genkeymap.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/util/genkeymap.py b/src/util/genkeymap.py
index 9fd98747..b70ce5f7 100755
--- a/src/util/genkeymap.py
+++ b/src/util/genkeymap.py
@@ -365,9 +365,11 @@ class Keymap:
"""AltGr remapping table"""
# Construct raw mapping from source ASCII to target ASCII
raw = {
- source:
- self.target.get((key.modifiers | KeyModifiers.ALTGR),
- self.target[key.modifiers])[key.keycode].ascii
+ source: next((self.target[x][key.keycode].ascii
+ for x in (key.modifiers | KeyModifiers.ALTGR,
+ KeyModifiers.ALTGR, key.modifiers)
+ if x in self.target
+ and self.target[x][key.keycode].ascii), None)
for source, key in self.source.inverse.items()
}
# Identify printable keys that are unreachable via the basic map