aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorRoss Lagerwall <ross.lagerwall@citrix.com>2023-02-27 17:20:58 +0000
committerDaniel P. Berrangé <berrange@redhat.com>2023-03-03 12:28:26 +0000
commit22b8996dba9041874845c7446ce89ec4ae2b713d (patch)
treee664fc2377da87ee530d6c9915b12e6b9623c51a /tools
parentf5772a62ec52591ff6870b7e8ef32482371f22c6 (diff)
downloadkeycodemapdb-master.zip
keycodemapdb-master.tar.gz
keycodemapdb-master.tar.bz2
Fix Hangeul/Hanja scancodesHEADmaster
Invert the Xfree86 scancodes for these keys. They were swapped due to a Linux bug which has since been fixed [1]. Fix the scancodes for the AT set 1 to be correct - they include bit 0x80 which requires some special handling to avoid triggering asserts. Also ensure that the QNum scancodes remain as 0x71/0x72 to avoid the wire protocol changing. Finally, add the scancodes for AT set 2 since this is what Windows uses. [1] Linux commit 0ae051a19092 ("Input: atkbd - fix HANGEUL/HANJA keys") Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/keymap-gen11
1 files changed, 9 insertions, 2 deletions
diff --git a/tools/keymap-gen b/tools/keymap-gen
index d05e945..4ac4800 100755
--- a/tools/keymap-gen
+++ b/tools/keymap-gen
@@ -151,6 +151,11 @@ class Database:
MAP_QCODE: "Q_KEY_CODE__MAX",
}
+ # These keys need special handling since the key press scan code overlaps
+ # the 0x80 bit commonly used to indicate key release.
+ # It also needs handling to ensure that the QNum matches its historical value.
+ HANJA_HANGEUL_KEYS = (0xf1, 0xf2)
+
def __init__(self):
self.mapto = {}
@@ -252,7 +257,7 @@ class Database:
# 0xe0 scan codes
if linux in self.mapto[self.MAP_ATSET1]:
at1 = self.mapto[self.MAP_ATSET1][linux]
- if at1 > 0x7f:
+ if at1 > 0x7f and at1 not in self.HANJA_HANGEUL_KEYS:
assert((at1 & ~0x7f) == 0xe000)
xtkbd = 0x100 | (at1 & 0x7f)
else:
@@ -286,7 +291,9 @@ class Database:
# different encoding of 0xe0 scan codes
if linux in self.mapto[self.MAP_ATSET1]:
at1 = self.mapto[self.MAP_ATSET1][linux]
- if at1 > 0x7f:
+ if at1 in self.HANJA_HANGEUL_KEYS:
+ qnum = at1 & 0x7f
+ elif at1 > 0x7f:
assert((at1 & ~0x7f) == 0xe000)
qnum = 0x80 | (at1 & 0x7f)
else: