[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>
pull/594/head
Michael Brown 2022-02-16 15:19:35 +00:00
parent 304333dace
commit bc5c612f75
20 changed files with 118 additions and 3 deletions

View File

@ -39,6 +39,7 @@ static struct keymap_key al_basic[] = {
static struct keymap_key al_altgr[] = {
{ 0x21, 0x7e }, /* '!' => '~' */
{ 0x26, 0x60 }, /* '&' => '`' */
{ 0x29, 0x7e }, /* ')' => '~' */
{ 0x30, 0x7e }, /* '0' => '~' */
{ 0x31, 0x7e }, /* '1' => '~' */
{ 0x34, 0x7e }, /* '4' => '~' */

View File

@ -30,11 +30,17 @@ static struct keymap_key cf_basic[] = {
/** "cf" AltGr remapping */
static struct keymap_key cf_altgr[] = {
{ 0x22, 0x7b }, /* '"' => '{' */
{ 0x27, 0x7b }, /* '\'' => '{' */
{ 0x32, 0x40 }, /* '2' => '@' */
{ 0x3a, 0x7e }, /* ':' => '~' */
{ 0x3b, 0x7e }, /* ';' => '~' */
{ 0x5c, 0x7d }, /* '\\' => '}' */
{ 0x60, 0x5c }, /* '`' => '\\' */
{ 0x7b, 0x5b }, /* '{' => '[' */
{ 0x7c, 0x7d }, /* '|' => '}' */
{ 0x7d, 0x5d }, /* '}' => ']' */
{ 0x7e, 0x5c }, /* '~' => '\\' */
{ 0, 0 }
};

View File

@ -52,6 +52,7 @@ static struct keymap_key cz_basic[] = {
static struct keymap_key cz_altgr[] = {
{ 0x21, 0x7e }, /* '!' => '~' */
{ 0x24, 0x7e }, /* '$' => '~' */
{ 0x28, 0x7b }, /* '(' => '{' */
{ 0x29, 0x7e }, /* ')' => '~' */
{ 0x2c, 0x3c }, /* ',' => '<' */
{ 0x2e, 0x3e }, /* '.' => '>' */
@ -65,7 +66,13 @@ static struct keymap_key cz_altgr[] = {
{ 0x39, 0x7b }, /* '9' => '{' */
{ 0x3a, 0x7e }, /* ':' => '~' */
{ 0x3b, 0x24 }, /* ';' => '$' */
{ 0x41, 0x7e }, /* 'A' => '~' */
{ 0x42, 0x7b }, /* 'B' => '{' */
{ 0x43, 0x26 }, /* 'C' => '&' */
{ 0x46, 0x5b }, /* 'F' => '[' */
{ 0x47, 0x5d }, /* 'G' => ']' */
{ 0x4b, 0x26 }, /* 'K' => '&' */
{ 0x56, 0x40 }, /* 'V' => '@' */
{ 0x58, 0x3e }, /* 'X' => '>' */
{ 0x5a, 0x3c }, /* 'Z' => '<' */
{ 0x61, 0x7e }, /* 'a' => '~' */
@ -76,6 +83,8 @@ static struct keymap_key cz_altgr[] = {
{ 0x6e, 0x7d }, /* 'n' => '}' */
{ 0x76, 0x40 }, /* 'v' => '@' */
{ 0x78, 0x23 }, /* 'x' => '#' */
{ 0x7b, 0x5b }, /* '{' => '[' */
{ 0x7d, 0x5d }, /* '}' => ']' */
{ 0, 0 }
};

View File

@ -45,15 +45,23 @@ static struct keymap_key de_basic[] = {
/** "de" AltGr remapping */
static struct keymap_key de_altgr[] = {
{ 0x26, 0x7b }, /* '&' => '{' */
{ 0x28, 0x5d }, /* '(' => ']' */
{ 0x29, 0x7d }, /* ')' => '}' */
{ 0x2a, 0x5b }, /* '*' => '[' */
{ 0x2d, 0x5c }, /* '-' => '\\' */
{ 0x30, 0x7d }, /* '0' => '}' */
{ 0x37, 0x7b }, /* '7' => '{' */
{ 0x38, 0x5b }, /* '8' => '[' */
{ 0x39, 0x5d }, /* '9' => ']' */
{ 0x3a, 0x7e }, /* ':' => '~' */
{ 0x3b, 0x7e }, /* ';' => '~' */
{ 0x51, 0x40 }, /* 'Q' => '@' */
{ 0x5d, 0x7e }, /* ']' => '~' */
{ 0x5f, 0x5c }, /* '_' => '\\' */
{ 0x71, 0x40 }, /* 'q' => '@' */
{ 0x7c, 0x7e }, /* '|' => '~' */
{ 0x7d, 0x7e }, /* '}' => '~' */
{ 0xdc, 0x7c }, /* Pseudo-'\\' => '|' */
{ 0, 0 }
};

View File

@ -37,6 +37,11 @@ static struct keymap_key dk_basic[] = {
/** "dk" AltGr remapping */
static struct keymap_key dk_altgr[] = {
{ 0x26, 0x7b }, /* '&' => '{' */
{ 0x28, 0x5d }, /* '(' => ']' */
{ 0x29, 0x7d }, /* ')' => '}' */
{ 0x2a, 0x5b }, /* '*' => '[' */
{ 0x2b, 0x7c }, /* '+' => '|' */
{ 0x30, 0x7d }, /* '0' => '}' */
{ 0x32, 0x40 }, /* '2' => '@' */
{ 0x34, 0x24 }, /* '4' => '$' */
@ -45,9 +50,12 @@ static struct keymap_key dk_altgr[] = {
{ 0x39, 0x5d }, /* '9' => ']' */
{ 0x3a, 0x7e }, /* ':' => '~' */
{ 0x3d, 0x7c }, /* '=' => '|' */
{ 0x51, 0x40 }, /* 'Q' => '@' */
{ 0x5c, 0x7e }, /* '\\' => '~' */
{ 0x5d, 0x7e }, /* ']' => '~' */
{ 0x71, 0x40 }, /* 'q' => '@' */
{ 0x7c, 0x7e }, /* '|' => '~' */
{ 0xfc, 0x5c }, /* Pseudo-'|' => '\\' */
{ 0, 0 }
};

View File

@ -37,8 +37,13 @@ static struct keymap_key es_basic[] = {
/** "es" AltGr remapping */
static struct keymap_key es_altgr[] = {
{ 0x21, 0x7c }, /* '!' => '|' */
{ 0x22, 0x7b }, /* '"' => '{' */
{ 0x26, 0x7b }, /* '&' => '{' */
{ 0x27, 0x7b }, /* '\'' => '{' */
{ 0x28, 0x5d }, /* '(' => ']' */
{ 0x29, 0x7d }, /* ')' => '}' */
{ 0x2a, 0x5b }, /* '*' => '[' */
{ 0x2b, 0x7e }, /* '+' => '~' */
{ 0x2d, 0x5c }, /* '-' => '\\' */
{ 0x30, 0x7d }, /* '0' => '}' */
@ -52,9 +57,12 @@ static struct keymap_key es_altgr[] = {
{ 0x3a, 0x7e }, /* ':' => '~' */
{ 0x3b, 0x7e }, /* ';' => '~' */
{ 0x3d, 0x7e }, /* '=' => '~' */
{ 0x51, 0x40 }, /* 'Q' => '@' */
{ 0x5c, 0x7d }, /* '\\' => '}' */
{ 0x5f, 0x5c }, /* '_' => '\\' */
{ 0x60, 0x5c }, /* '`' => '\\' */
{ 0x71, 0x40 }, /* 'q' => '@' */
{ 0x7b, 0x5b }, /* '{' => '[' */
{ 0x7c, 0x7e }, /* '|' => '~' */
{ 0x7e, 0x5c }, /* '~' => '\\' */
{ 0xdc, 0x7c }, /* Pseudo-'\\' => '|' */

View File

@ -35,6 +35,8 @@ static struct keymap_key fi_basic[] = {
/** "fi" AltGr remapping */
static struct keymap_key fi_altgr[] = {
{ 0x26, 0x7b }, /* '&' => '{' */
{ 0x29, 0x7d }, /* ')' => '}' */
{ 0x2d, 0x5c }, /* '-' => '\\' */
{ 0x30, 0x7d }, /* '0' => '}' */
{ 0x32, 0x40 }, /* '2' => '@' */
@ -44,6 +46,8 @@ static struct keymap_key fi_altgr[] = {
{ 0x39, 0x5d }, /* '9' => ']' */
{ 0x49, 0x7c }, /* 'I' => '|' */
{ 0x5d, 0x7e }, /* ']' => '~' */
{ 0x5f, 0x5c }, /* '_' => '\\' */
{ 0x7d, 0x7e }, /* '}' => '~' */
{ 0xdc, 0x7c }, /* Pseudo-'\\' => '|' */
{ 0, 0 }
};

View File

@ -65,6 +65,11 @@ static struct keymap_key fr_basic[] = {
/** "fr" AltGr remapping */
static struct keymap_key fr_altgr[] = {
{ 0x25, 0x5b }, /* '%' => '[' */
{ 0x26, 0x60 }, /* '&' => '`' */
{ 0x29, 0x40 }, /* ')' => '@' */
{ 0x2a, 0x5c }, /* '*' => '\\' */
{ 0x2b, 0x7d }, /* '+' => '}' */
{ 0x2d, 0x5d }, /* '-' => ']' */
{ 0x30, 0x40 }, /* '0' => '@' */
{ 0x33, 0x23 }, /* '3' => '#' */
@ -74,7 +79,10 @@ static struct keymap_key fr_altgr[] = {
{ 0x37, 0x60 }, /* '7' => '`' */
{ 0x38, 0x5c }, /* '8' => '\\' */
{ 0x3d, 0x7d }, /* '=' => '}' */
{ 0x41, 0x40 }, /* 'A' => '@' */
{ 0x5c, 0x60 }, /* '\\' => '`' */
{ 0x5e, 0x7c }, /* '^' => '|' */
{ 0x5f, 0x5d }, /* '_' => ']' */
{ 0x61, 0x40 }, /* 'a' => '@' */
{ 0xdc, 0x7c }, /* Pseudo-'\\' => '|' */
{ 0, 0 }

View File

@ -39,7 +39,9 @@ static struct keymap_key hu_basic[] = {
static struct keymap_key hu_altgr[] = {
{ 0x21, 0x7e }, /* '!' => '~' */
{ 0x23, 0x5e }, /* '#' => '^' */
{ 0x24, 0x7e }, /* '$' => '~' */
{ 0x26, 0x60 }, /* '&' => '`' */
{ 0x29, 0x7e }, /* ')' => '~' */
{ 0x2c, 0x3b }, /* ',' => ';' */
{ 0x2e, 0x3e }, /* '.' => '>' */
{ 0x2f, 0x2a }, /* '/' => '*' */
@ -49,8 +51,19 @@ static struct keymap_key hu_altgr[] = {
{ 0x33, 0x5e }, /* '3' => '^' */
{ 0x34, 0x7e }, /* '4' => '~' */
{ 0x37, 0x60 }, /* '7' => '`' */
{ 0x3a, 0x24 }, /* ':' => '$' */
{ 0x3b, 0x24 }, /* ';' => '$' */
{ 0x3c, 0x3b }, /* '<' => ';' */
{ 0x40, 0x5e }, /* '@' => '^' */
{ 0x42, 0x7b }, /* 'B' => '{' */
{ 0x43, 0x26 }, /* 'C' => '&' */
{ 0x46, 0x5b }, /* 'F' => '[' */
{ 0x47, 0x5d }, /* 'G' => ']' */
{ 0x4b, 0x26 }, /* 'K' => '&' */
{ 0x4d, 0x3c }, /* 'M' => '<' */
{ 0x51, 0x5c }, /* 'Q' => '\\' */
{ 0x56, 0x40 }, /* 'V' => '@' */
{ 0x57, 0x7c }, /* 'W' => '|' */
{ 0x58, 0x3e }, /* 'X' => '>' */
{ 0x5a, 0x3c }, /* 'Z' => '<' */
{ 0x62, 0x7b }, /* 'b' => '{' */

View File

@ -31,7 +31,12 @@ static struct keymap_key il_basic[] = {
/** "il" AltGr remapping */
static struct keymap_key il_altgr[] = {
{ 0x22, 0x27 }, /* '"' => '\'' */
{ 0x3f, 0x2f }, /* '?' => '/' */
{ 0x5c, 0x60 }, /* '\\' => '`' */
{ 0x71, 0x2f }, /* 'q' => '/' */
{ 0x77, 0x27 }, /* 'w' => '\'' */
{ 0x7c, 0x60 }, /* '|' => '`' */
{ 0, 0 }
};

View File

@ -37,17 +37,25 @@ static struct keymap_key it_basic[] = {
/** "it" AltGr remapping */
static struct keymap_key it_altgr[] = {
{ 0x22, 0x23 }, /* '"' => '#' */
{ 0x23, 0x7e }, /* '#' => '~' */
{ 0x26, 0x7b }, /* '&' => '{' */
{ 0x27, 0x23 }, /* '\'' => '#' */
{ 0x28, 0x5d }, /* '(' => ']' */
{ 0x29, 0x7d }, /* ')' => '}' */
{ 0x2a, 0x5b }, /* '*' => '[' */
{ 0x2d, 0x60 }, /* '-' => '`' */
{ 0x30, 0x7d }, /* '0' => '}' */
{ 0x37, 0x7b }, /* '7' => '{' */
{ 0x38, 0x5b }, /* '8' => '[' */
{ 0x39, 0x5d }, /* '9' => ']' */
{ 0x3a, 0x40 }, /* ':' => '@' */
{ 0x3b, 0x40 }, /* ';' => '@' */
{ 0x3d, 0x7e }, /* '=' => '~' */
{ 0x40, 0x7e }, /* '@' => '~' */
{ 0x51, 0x40 }, /* 'Q' => '@' */
{ 0x5c, 0x60 }, /* '\\' => '`' */
{ 0x5f, 0x60 }, /* '_' => '`' */
{ 0x71, 0x40 }, /* 'q' => '@' */
{ 0x7c, 0x7e }, /* '|' => '~' */
{ 0, 0 }

View File

@ -20,6 +20,7 @@ static struct keymap_key lt_altgr[] = {
{ 0x22, 0x5e }, /* '"' => '^' */
{ 0x27, 0x5e }, /* '\'' => '^' */
{ 0x4b, 0x26 }, /* 'K' => '&' */
{ 0x51, 0x40 }, /* 'Q' => '@' */
{ 0x71, 0x40 }, /* 'q' => '@' */
{ 0, 0 }
};

View File

@ -22,11 +22,16 @@ static struct keymap_key mt_basic[] = {
/** "mt" AltGr remapping */
static struct keymap_key mt_altgr[] = {
{ 0x26, 0x7b }, /* '&' => '{' */
{ 0x28, 0x5d }, /* '(' => ']' */
{ 0x29, 0x7d }, /* ')' => '}' */
{ 0x2a, 0x5b }, /* '*' => '[' */
{ 0x30, 0x7d }, /* '0' => '}' */
{ 0x37, 0x7b }, /* '7' => '{' */
{ 0x38, 0x5b }, /* '8' => '[' */
{ 0x39, 0x5d }, /* '9' => ']' */
{ 0x5c, 0x60 }, /* '\\' => '`' */
{ 0x7e, 0x60 }, /* '~' => '`' */
{ 0, 0 }
};

View File

@ -46,6 +46,7 @@ static struct keymap_key nl_altgr[] = {
{ 0x2d, 0x5c }, /* '-' => '\\' */
{ 0x38, 0x7b }, /* '8' => '{' */
{ 0x39, 0x7d }, /* '9' => '}' */
{ 0x5f, 0x5c }, /* '_' => '\\' */
{ 0, 0 }
};

View File

@ -40,7 +40,11 @@ static struct keymap_key no_latin1_basic[] = {
/** "no-latin1" AltGr remapping */
static struct keymap_key no_latin1_altgr[] = {
{ 0x22, 0x5b }, /* '"' => '[' */
{ 0x26, 0x7b }, /* '&' => '{' */
{ 0x27, 0x7b }, /* '\'' => '{' */
{ 0x28, 0x5d }, /* '(' => ']' */
{ 0x29, 0x7d }, /* ')' => '}' */
{ 0x2a, 0x5b }, /* '*' => '[' */
{ 0x30, 0x7d }, /* '0' => '}' */
{ 0x32, 0x40 }, /* '2' => '@' */
{ 0x37, 0x7b }, /* '7' => '{' */

View File

@ -39,6 +39,10 @@ static struct keymap_key no_basic[] = {
/** "no" AltGr remapping */
static struct keymap_key no_altgr[] = {
{ 0x26, 0x7b }, /* '&' => '{' */
{ 0x28, 0x5d }, /* '(' => ']' */
{ 0x29, 0x7d }, /* ')' => '}' */
{ 0x2a, 0x5b }, /* '*' => '[' */
{ 0x30, 0x7d }, /* '0' => '}' */
{ 0x32, 0x40 }, /* '2' => '@' */
{ 0x34, 0x24 }, /* '4' => '$' */
@ -46,9 +50,11 @@ static struct keymap_key no_altgr[] = {
{ 0x38, 0x5b }, /* '8' => '[' */
{ 0x39, 0x5d }, /* '9' => ']' */
{ 0x3a, 0x7e }, /* ':' => '~' */
{ 0x51, 0x40 }, /* 'Q' => '@' */
{ 0x5c, 0x7e }, /* '\\' => '~' */
{ 0x5d, 0x7e }, /* ']' => '~' */
{ 0x71, 0x40 }, /* 'q' => '@' */
{ 0x7c, 0x7e }, /* '|' => '~' */
{ 0, 0 }
};

View File

@ -40,11 +40,16 @@ static struct keymap_key pt_basic[] = {
/** "pt" AltGr remapping */
static struct keymap_key pt_altgr[] = {
{ 0x26, 0x7b }, /* '&' => '{' */
{ 0x28, 0x5d }, /* '(' => ']' */
{ 0x29, 0x7d }, /* ')' => '}' */
{ 0x2a, 0x5b }, /* '*' => '[' */
{ 0x30, 0x7d }, /* '0' => '}' */
{ 0x32, 0x40 }, /* '2' => '@' */
{ 0x37, 0x7b }, /* '7' => '{' */
{ 0x38, 0x5b }, /* '8' => '[' */
{ 0x39, 0x5d }, /* '9' => ']' */
{ 0x51, 0x40 }, /* 'Q' => '@' */
{ 0x71, 0x40 }, /* 'q' => '@' */
{ 0, 0 }
};

View File

@ -37,6 +37,10 @@ static struct keymap_key se_basic[] = {
/** "se" AltGr remapping */
static struct keymap_key se_altgr[] = {
{ 0x26, 0x7b }, /* '&' => '{' */
{ 0x28, 0x5d }, /* '(' => ']' */
{ 0x29, 0x7d }, /* ')' => '}' */
{ 0x2a, 0x5b }, /* '*' => '[' */
{ 0x2d, 0x5c }, /* '-' => '\\' */
{ 0x30, 0x7d }, /* '0' => '}' */
{ 0x32, 0x40 }, /* '2' => '@' */
@ -44,7 +48,9 @@ static struct keymap_key se_altgr[] = {
{ 0x37, 0x7b }, /* '7' => '{' */
{ 0x38, 0x5b }, /* '8' => '[' */
{ 0x39, 0x5d }, /* '9' => ']' */
{ 0x51, 0x40 }, /* 'Q' => '@' */
{ 0x5d, 0x7e }, /* ']' => '~' */
{ 0x5f, 0x5c }, /* '_' => '\\' */
{ 0x71, 0x40 }, /* 'q' => '@' */
{ 0xdc, 0x7c }, /* Pseudo-'\\' => '|' */
{ 0, 0 }

View File

@ -45,12 +45,19 @@ static struct keymap_key sg_basic[] = {
/** "sg" AltGr remapping */
static struct keymap_key sg_altgr[] = {
{ 0x22, 0x7b }, /* '"' => '{' */
{ 0x26, 0x7c }, /* '&' => '|' */
{ 0x27, 0x7b }, /* '\'' => '{' */
{ 0x2b, 0x7e }, /* '+' => '~' */
{ 0x32, 0x40 }, /* '2' => '@' */
{ 0x33, 0x23 }, /* '3' => '#' */
{ 0x37, 0x7c }, /* '7' => '|' */
{ 0x3d, 0x7e }, /* '=' => '~' */
{ 0x5c, 0x7d }, /* '\\' => '}' */
{ 0x7b, 0x5b }, /* '{' => '[' */
{ 0x7c, 0x7d }, /* '|' => '}' */
{ 0x7d, 0x5d }, /* '}' => ']' */
{ 0xfc, 0x5c }, /* Pseudo-'|' => '\\' */
{ 0, 0 }
};

View File

@ -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