aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2022-02-15 11:28:57 +0000
committerMichael Brown <mcb30@ipxe.org>2022-02-15 13:37:41 +0000
commitc7d78192919bfa62fde33650e1506e902816eec3 (patch)
tree15718c529fa1643c325bee89d62c1b021cc67f36
parente1cedbc0d4fdb0e16818f6b722f4873a50780761 (diff)
downloadipxe-c7d78192919bfa62fde33650e1506e902816eec3.zip
ipxe-c7d78192919bfa62fde33650e1506e902816eec3.tar.gz
ipxe-c7d78192919bfa62fde33650e1506e902816eec3.tar.bz2
[console] Treat dead keys as producing their ASCII equivalents
Treat dead keys in target keymaps as producing the closest equivalent ASCII character, since many of these characters are otherwise unrepresented on the keyboard. Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r--src/hci/keymap/keymap_al.c2
-rw-r--r--src/hci/keymap/keymap_cf.c5
-rw-r--r--src/hci/keymap/keymap_cz.c6
-rw-r--r--src/hci/keymap/keymap_de.c2
-rw-r--r--src/hci/keymap/keymap_dk.c3
-rw-r--r--src/hci/keymap/keymap_es.c5
-rw-r--r--src/hci/keymap/keymap_et.c3
-rw-r--r--src/hci/keymap/keymap_fi.c3
-rw-r--r--src/hci/keymap/keymap_fr.c3
-rw-r--r--src/hci/keymap/keymap_hu.c1
-rw-r--r--src/hci/keymap/keymap_it.c1
-rw-r--r--src/hci/keymap/keymap_nl.c4
-rw-r--r--src/hci/keymap/keymap_no.c3
-rw-r--r--src/hci/keymap/keymap_pt.c5
-rwxr-xr-xsrc/util/genkeymap.py22
15 files changed, 61 insertions, 7 deletions
diff --git a/src/hci/keymap/keymap_al.c b/src/hci/keymap/keymap_al.c
index b68b988..4d27917 100644
--- a/src/hci/keymap/keymap_al.c
+++ b/src/hci/keymap/keymap_al.c
@@ -37,7 +37,9 @@ static struct keymap_key al_basic[] = {
/** "al" AltGr remapping */
static struct keymap_key al_altgr[] = {
+ { 0x30, 0x7e }, /* '0' => '~' */
{ 0x31, 0x7e }, /* '1' => '~' */
+ { 0x34, 0x7e }, /* '4' => '~' */
{ 0x37, 0x60 }, /* '7' => '`' */
{ 0, 0 }
};
diff --git a/src/hci/keymap/keymap_cf.c b/src/hci/keymap/keymap_cf.c
index 09242ee..434e338 100644
--- a/src/hci/keymap/keymap_cf.c
+++ b/src/hci/keymap/keymap_cf.c
@@ -12,13 +12,17 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
/** "cf" basic remapping */
static struct keymap_key cf_basic[] = {
+ { 0x22, 0x60 }, /* '"' => '`' */
{ 0x23, 0x2f }, /* '#' => '/' */
+ { 0x27, 0x60 }, /* '\'' => '`' */
{ 0x3c, 0x27 }, /* '<' => '\'' */
{ 0x3e, 0x2e }, /* '>' => '.' */
{ 0x40, 0x22 }, /* '@' => '"' */
+ { 0x5b, 0x5e }, /* '[' => '^' */
{ 0x5c, 0x3c }, /* '\\' => '<' */
{ 0x5e, 0x3f }, /* '^' => '?' */
{ 0x60, 0x23 }, /* '`' => '#' */
+ { 0x7b, 0x5e }, /* '{' => '^' */
{ 0x7c, 0x3e }, /* '|' => '>' */
{ 0x7e, 0x7c }, /* '~' => '|' */
{ 0, 0 }
@@ -26,6 +30,7 @@ static struct keymap_key cf_basic[] = {
/** "cf" AltGr remapping */
static struct keymap_key cf_altgr[] = {
+ { 0x27, 0x7b }, /* '\'' => '{' */
{ 0x32, 0x40 }, /* '2' => '@' */
{ 0x3b, 0x7e }, /* ';' => '~' */
{ 0x60, 0x5c }, /* '`' => '\\' */
diff --git a/src/hci/keymap/keymap_cz.c b/src/hci/keymap/keymap_cz.c
index cce686d..fb072b1 100644
--- a/src/hci/keymap/keymap_cz.c
+++ b/src/hci/keymap/keymap_cz.c
@@ -24,6 +24,7 @@ static struct keymap_key cz_basic[] = {
{ 0x28, 0x39 }, /* '(' => '9' */
{ 0x29, 0x30 }, /* ')' => '0' */
{ 0x2a, 0x38 }, /* '*' => '8' */
+ { 0x2b, 0x5e }, /* '+' => '^' */
{ 0x2d, 0x3d }, /* '-' => '=' */
{ 0x2f, 0x2d }, /* '/' => '-' */
{ 0x31, 0x2b }, /* '1' => '+' */
@@ -43,6 +44,7 @@ static struct keymap_key cz_basic[] = {
{ 0x7b, 0x2f }, /* '{' => '/' */
{ 0x7c, 0x27 }, /* '|' => '\'' */
{ 0x7d, 0x28 }, /* '}' => '(' */
+ { 0x7e, 0x60 }, /* '~' => '`' */
{ 0, 0 }
};
@@ -55,16 +57,14 @@ static struct keymap_key cz_altgr[] = {
{ 0x32, 0x40 }, /* '2' => '@' */
{ 0x33, 0x23 }, /* '3' => '#' */
{ 0x34, 0x24 }, /* '4' => '$' */
- { 0x36, 0x5e }, /* '6' => '^' */
{ 0x37, 0x26 }, /* '7' => '&' */
{ 0x38, 0x2a }, /* '8' => '*' */
{ 0x39, 0x7b }, /* '9' => '{' */
{ 0x3b, 0x24 }, /* ';' => '$' */
+ { 0x61, 0x7e }, /* 'a' => '~' */
{ 0x62, 0x7b }, /* 'b' => '{' */
{ 0x63, 0x26 }, /* 'c' => '&' */
{ 0x67, 0x5d }, /* 'g' => ']' */
- { 0x68, 0x60 }, /* 'h' => '`' */
- { 0x6d, 0x5e }, /* 'm' => '^' */
{ 0x6e, 0x7d }, /* 'n' => '}' */
{ 0x76, 0x40 }, /* 'v' => '@' */
{ 0x78, 0x23 }, /* 'x' => '#' */
diff --git a/src/hci/keymap/keymap_de.c b/src/hci/keymap/keymap_de.c
index 4a889a2..bbd3952 100644
--- a/src/hci/keymap/keymap_de.c
+++ b/src/hci/keymap/keymap_de.c
@@ -21,6 +21,7 @@ static struct keymap_key de_basic[] = {
{ 0x28, 0x29 }, /* '(' => ')' */
{ 0x29, 0x3d }, /* ')' => '=' */
{ 0x2a, 0x28 }, /* '*' => '(' */
+ { 0x2b, 0x60 }, /* '+' => '`' */
{ 0x2f, 0x2d }, /* '/' => '-' */
{ 0x3c, 0x3b }, /* '<' => ';' */
{ 0x3e, 0x3a }, /* '>' => ':' */
@@ -32,6 +33,7 @@ static struct keymap_key de_basic[] = {
{ 0x5d, 0x2b }, /* ']' => '+' */
{ 0x5e, 0x26 }, /* '^' => '&' */
{ 0x5f, 0x3f }, /* '_' => '?' */
+ { 0x60, 0x5e }, /* '`' => '^' */
{ 0x79, 0x7a }, /* 'y' => 'z' */
{ 0x7a, 0x79 }, /* 'z' => 'y' */
{ 0x7c, 0x27 }, /* '|' => '\'' */
diff --git a/src/hci/keymap/keymap_dk.c b/src/hci/keymap/keymap_dk.c
index 4d40743..6d2e60a 100644
--- a/src/hci/keymap/keymap_dk.c
+++ b/src/hci/keymap/keymap_dk.c
@@ -18,6 +18,7 @@ static struct keymap_key dk_basic[] = {
{ 0x28, 0x29 }, /* '(' => ')' */
{ 0x29, 0x3d }, /* ')' => '=' */
{ 0x2a, 0x28 }, /* '*' => '(' */
+ { 0x2b, 0x60 }, /* '+' => '`' */
{ 0x2d, 0x2b }, /* '-' => '+' */
{ 0x2f, 0x2d }, /* '/' => '-' */
{ 0x3c, 0x3b }, /* '<' => ';' */
@@ -28,6 +29,7 @@ static struct keymap_key dk_basic[] = {
{ 0x5e, 0x26 }, /* '^' => '&' */
{ 0x5f, 0x3f }, /* '_' => '?' */
{ 0x7c, 0x2a }, /* '|' => '*' */
+ { 0x7d, 0x5e }, /* '}' => '^' */
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
@@ -35,6 +37,7 @@ static struct keymap_key dk_basic[] = {
/** "dk" AltGr remapping */
static struct keymap_key dk_altgr[] = {
+ { 0x30, 0x7d }, /* '0' => '}' */
{ 0x32, 0x40 }, /* '2' => '@' */
{ 0x3d, 0x7c }, /* '=' => '|' */
{ 0x71, 0x40 }, /* 'q' => '@' */
diff --git a/src/hci/keymap/keymap_es.c b/src/hci/keymap/keymap_es.c
index 397e2cb..614ca7b 100644
--- a/src/hci/keymap/keymap_es.c
+++ b/src/hci/keymap/keymap_es.c
@@ -24,9 +24,11 @@ static struct keymap_key es_basic[] = {
{ 0x3e, 0x3a }, /* '>' => ':' */
{ 0x3f, 0x5f }, /* '?' => '_' */
{ 0x40, 0x22 }, /* '@' => '"' */
+ { 0x5b, 0x60 }, /* '[' => '`' */
{ 0x5d, 0x2b }, /* ']' => '+' */
{ 0x5e, 0x26 }, /* '^' => '&' */
{ 0x5f, 0x3f }, /* '_' => '?' */
+ { 0x7b, 0x5e }, /* '{' => '^' */
{ 0x7d, 0x2a }, /* '}' => '*' */
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
@@ -35,8 +37,11 @@ static struct keymap_key es_basic[] = {
/** "es" AltGr remapping */
static struct keymap_key es_altgr[] = {
+ { 0x27, 0x7b }, /* '\'' => '{' */
{ 0x30, 0x7d }, /* '0' => '}' */
{ 0x32, 0x40 }, /* '2' => '@' */
+ { 0x37, 0x7b }, /* '7' => '{' */
+ { 0x38, 0x5b }, /* '8' => '[' */
{ 0x39, 0x5d }, /* '9' => ']' */
{ 0x5c, 0x7d }, /* '\\' => '}' */
{ 0x71, 0x40 }, /* 'q' => '@' */
diff --git a/src/hci/keymap/keymap_et.c b/src/hci/keymap/keymap_et.c
index 4120dbe..f3eb02e 100644
--- a/src/hci/keymap/keymap_et.c
+++ b/src/hci/keymap/keymap_et.c
@@ -16,6 +16,7 @@ static struct keymap_key et_basic[] = {
{ 0x28, 0x29 }, /* '(' => ')' */
{ 0x29, 0x3d }, /* ')' => '=' */
{ 0x2a, 0x28 }, /* '*' => '(' */
+ { 0x2b, 0x60 }, /* '+' => '`' */
{ 0x2d, 0x2b }, /* '-' => '+' */
{ 0x2f, 0x2d }, /* '/' => '-' */
{ 0x3c, 0x3b }, /* '<' => ';' */
@@ -25,6 +26,7 @@ static struct keymap_key et_basic[] = {
{ 0x5c, 0x27 }, /* '\\' => '\'' */
{ 0x5e, 0x26 }, /* '^' => '&' */
{ 0x5f, 0x3f }, /* '_' => '?' */
+ { 0x60, 0x5e }, /* '`' => '^' */
{ 0x7c, 0x2a }, /* '|' => '*' */
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
@@ -33,7 +35,6 @@ static struct keymap_key et_basic[] = {
/** "et" AltGr remapping */
static struct keymap_key et_altgr[] = {
- { 0x27, 0x5e }, /* '\'' => '^' */
{ 0x2d, 0x5c }, /* '-' => '\\' */
{ 0x32, 0x40 }, /* '2' => '@' */
{ 0xdc, 0x7c }, /* Pseudo-'\\' => '|' */
diff --git a/src/hci/keymap/keymap_fi.c b/src/hci/keymap/keymap_fi.c
index 978121a..622f062 100644
--- a/src/hci/keymap/keymap_fi.c
+++ b/src/hci/keymap/keymap_fi.c
@@ -16,6 +16,7 @@ static struct keymap_key fi_basic[] = {
{ 0x28, 0x29 }, /* '(' => ')' */
{ 0x29, 0x3d }, /* ')' => '=' */
{ 0x2a, 0x28 }, /* '*' => '(' */
+ { 0x2b, 0x60 }, /* '+' => '`' */
{ 0x2d, 0x2b }, /* '-' => '+' */
{ 0x2f, 0x2d }, /* '/' => '-' */
{ 0x3c, 0x3b }, /* '<' => ';' */
@@ -26,6 +27,7 @@ static struct keymap_key fi_basic[] = {
{ 0x5e, 0x26 }, /* '^' => '&' */
{ 0x5f, 0x3f }, /* '_' => '?' */
{ 0x7c, 0x2a }, /* '|' => '*' */
+ { 0x7d, 0x5e }, /* '}' => '^' */
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
@@ -34,6 +36,7 @@ static struct keymap_key fi_basic[] = {
/** "fi" AltGr remapping */
static struct keymap_key fi_altgr[] = {
{ 0x2d, 0x5c }, /* '-' => '\\' */
+ { 0x30, 0x7d }, /* '0' => '}' */
{ 0x32, 0x40 }, /* '2' => '@' */
{ 0xdc, 0x7c }, /* Pseudo-'\\' => '|' */
{ 0, 0 }
diff --git a/src/hci/keymap/keymap_fr.c b/src/hci/keymap/keymap_fr.c
index c0a959f..c002bf9 100644
--- a/src/hci/keymap/keymap_fr.c
+++ b/src/hci/keymap/keymap_fr.c
@@ -49,6 +49,7 @@ static struct keymap_key fr_basic[] = {
{ 0x51, 0x41 }, /* 'Q' => 'A' */
{ 0x57, 0x5a }, /* 'W' => 'Z' */
{ 0x5a, 0x57 }, /* 'Z' => 'W' */
+ { 0x5b, 0x5e }, /* '[' => '^' */
{ 0x5c, 0x2a }, /* '\\' => '*' */
{ 0x5d, 0x24 }, /* ']' => '$' */
{ 0x5e, 0x36 }, /* '^' => '6' */
@@ -67,8 +68,8 @@ static struct keymap_key fr_altgr[] = {
{ 0x2d, 0x5d }, /* '-' => ']' */
{ 0x30, 0x40 }, /* '0' => '@' */
{ 0x33, 0x23 }, /* '3' => '#' */
+ { 0x35, 0x5b }, /* '5' => '[' */
{ 0x38, 0x5c }, /* '8' => '\\' */
- { 0x39, 0x5e }, /* '9' => '^' */
{ 0x61, 0x40 }, /* 'a' => '@' */
{ 0, 0 }
};
diff --git a/src/hci/keymap/keymap_hu.c b/src/hci/keymap/keymap_hu.c
index 64e27dd..8f2d70a 100644
--- a/src/hci/keymap/keymap_hu.c
+++ b/src/hci/keymap/keymap_hu.c
@@ -39,6 +39,7 @@ static struct keymap_key hu_basic[] = {
static struct keymap_key hu_altgr[] = {
{ 0x2e, 0x3e }, /* '.' => '>' */
{ 0x2f, 0x2a }, /* '/' => '*' */
+ { 0x32, 0x5e }, /* '2' => '^' */
{ 0x33, 0x5e }, /* '3' => '^' */
{ 0x37, 0x60 }, /* '7' => '`' */
{ 0x3b, 0x24 }, /* ';' => '$' */
diff --git a/src/hci/keymap/keymap_it.c b/src/hci/keymap/keymap_it.c
index f67bbad..a55dafe 100644
--- a/src/hci/keymap/keymap_it.c
+++ b/src/hci/keymap/keymap_it.c
@@ -42,6 +42,7 @@ static struct keymap_key it_altgr[] = {
{ 0x39, 0x5d }, /* '9' => ']' */
{ 0x3b, 0x40 }, /* ';' => '@' */
{ 0x3d, 0x7e }, /* '=' => '~' */
+ { 0x5c, 0x60 }, /* '\\' => '`' */
{ 0x71, 0x40 }, /* 'q' => '@' */
{ 0, 0 }
};
diff --git a/src/hci/keymap/keymap_nl.c b/src/hci/keymap/keymap_nl.c
index bbee4cb..8038d4d 100644
--- a/src/hci/keymap/keymap_nl.c
+++ b/src/hci/keymap/keymap_nl.c
@@ -15,10 +15,12 @@ static struct keymap_key nl_basic[] = {
{ 0x1c, 0x3c }, /* 0x1c => '<' */
{ 0x1d, 0x1c }, /* 0x1d => 0x1c */
{ 0x1e, 0x36 }, /* 0x1e => '6' */
+ { 0x22, 0x60 }, /* '"' => '`' */
{ 0x26, 0x5f }, /* '&' => '_' */
{ 0x28, 0x29 }, /* '(' => ')' */
{ 0x29, 0x27 }, /* ')' => '\'' */
{ 0x2a, 0x28 }, /* '*' => '(' */
+ { 0x2b, 0x7e }, /* '+' => '~' */
{ 0x2d, 0x2f }, /* '-' => '/' */
{ 0x2f, 0x2d }, /* '/' => '-' */
{ 0x3b, 0x2b }, /* ';' => '+' */
@@ -31,6 +33,7 @@ static struct keymap_key nl_basic[] = {
{ 0x5e, 0x26 }, /* '^' => '&' */
{ 0x5f, 0x3f }, /* '_' => '?' */
{ 0x60, 0x40 }, /* '`' => '@' */
+ { 0x7b, 0x5e }, /* '{' => '^' */
{ 0x7c, 0x3e }, /* '|' => '>' */
{ 0x7d, 0x7c }, /* '}' => '|' */
{ 0xdc, 0x5d }, /* Pseudo-'\\' => ']' */
@@ -41,6 +44,7 @@ static struct keymap_key nl_basic[] = {
/** "nl" AltGr remapping */
static struct keymap_key nl_altgr[] = {
{ 0x2d, 0x5c }, /* '-' => '\\' */
+ { 0x38, 0x7b }, /* '8' => '{' */
{ 0x39, 0x7d }, /* '9' => '}' */
{ 0, 0 }
};
diff --git a/src/hci/keymap/keymap_no.c b/src/hci/keymap/keymap_no.c
index 95a9542..4b2f726 100644
--- a/src/hci/keymap/keymap_no.c
+++ b/src/hci/keymap/keymap_no.c
@@ -18,6 +18,7 @@ static struct keymap_key no_basic[] = {
{ 0x28, 0x29 }, /* '(' => ')' */
{ 0x29, 0x3d }, /* ')' => '=' */
{ 0x2a, 0x28 }, /* '*' => '(' */
+ { 0x2b, 0x60 }, /* '+' => '`' */
{ 0x2d, 0x2b }, /* '-' => '+' */
{ 0x2f, 0x2d }, /* '/' => '-' */
{ 0x3c, 0x3b }, /* '<' => ';' */
@@ -30,6 +31,7 @@ static struct keymap_key no_basic[] = {
{ 0x5f, 0x3f }, /* '_' => '?' */
{ 0x60, 0x7c }, /* '`' => '|' */
{ 0x7c, 0x2a }, /* '|' => '*' */
+ { 0x7d, 0x5e }, /* '}' => '^' */
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
@@ -37,6 +39,7 @@ static struct keymap_key no_basic[] = {
/** "no" AltGr remapping */
static struct keymap_key no_altgr[] = {
+ { 0x30, 0x7d }, /* '0' => '}' */
{ 0x32, 0x40 }, /* '2' => '@' */
{ 0x71, 0x40 }, /* 'q' => '@' */
{ 0, 0 }
diff --git a/src/hci/keymap/keymap_pt.c b/src/hci/keymap/keymap_pt.c
index 99ba52e..f294e95 100644
--- a/src/hci/keymap/keymap_pt.c
+++ b/src/hci/keymap/keymap_pt.c
@@ -12,6 +12,7 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
/** "pt" basic remapping */
static struct keymap_key pt_basic[] = {
+ { 0x1c, 0x7e }, /* 0x1c => '~' */
{ 0x1e, 0x36 }, /* 0x1e => '6' */
{ 0x26, 0x2f }, /* '&' => '/' */
{ 0x28, 0x29 }, /* '(' => ')' */
@@ -24,10 +25,13 @@ static struct keymap_key pt_basic[] = {
{ 0x3f, 0x5f }, /* '?' => '_' */
{ 0x40, 0x22 }, /* '@' => '"' */
{ 0x5b, 0x2b }, /* '[' => '+' */
+ { 0x5c, 0x7e }, /* '\\' => '~' */
{ 0x5e, 0x26 }, /* '^' => '&' */
{ 0x5f, 0x3f }, /* '_' => '?' */
{ 0x60, 0x5c }, /* '`' => '\\' */
{ 0x7b, 0x2a }, /* '{' => '*' */
+ { 0x7c, 0x5e }, /* '|' => '^' */
+ { 0x7d, 0x60 }, /* '}' => '`' */
{ 0x7e, 0x7c }, /* '~' => '|' */
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
@@ -36,6 +40,7 @@ static struct keymap_key pt_basic[] = {
/** "pt" AltGr remapping */
static struct keymap_key pt_altgr[] = {
+ { 0x30, 0x7d }, /* '0' => '}' */
{ 0x32, 0x40 }, /* '2' => '@' */
{ 0x37, 0x7b }, /* '7' => '{' */
{ 0x38, 0x5b }, /* '8' => '[' */
diff --git a/src/util/genkeymap.py b/src/util/genkeymap.py
index ff5ff0a..42ccee1 100755
--- a/src/util/genkeymap.py
+++ b/src/util/genkeymap.py
@@ -54,6 +54,14 @@ class KeyType(IntEnum):
UNKNOWN = 0xf0
+class DeadKey(IntEnum):
+ """Dead keys"""
+
+ GRAVE = 0
+ CIRCUMFLEX = 2
+ TILDE = 3
+
+
class KeyModifiers(Flag):
"""Key modifiers"""
@@ -96,6 +104,13 @@ class Key:
KeyType.LETTER}
"""Key types with direct ASCII values"""
+ DEAD_KEYS: ClassVar[Mapping[int, str]] = {
+ DeadKey.GRAVE: '`',
+ DeadKey.CIRCUMFLEX: '^',
+ DeadKey.TILDE: '~',
+ }
+ """Dead key replacement ASCII values"""
+
@property
def keytype(self) -> Optional[KeyType]:
"""Key type"""
@@ -112,11 +127,14 @@ class Key:
@property
def ascii(self) -> Optional[str]:
"""ASCII character"""
- if self.keytype in self.ASCII_TYPES:
- value = self.value
+ keytype = self.keytype
+ value = self.value
+ if keytype in self.ASCII_TYPES:
char = chr(value)
if value and char.isascii():
return char
+ if keytype == KeyType.DEAD:
+ return self.DEAD_KEYS.get(value)
return None