Created
September 11, 2020 05:47
-
-
Save AquariusPower/83748456a59ea743ae034ed78b14f646 to your computer and use it in GitHub Desktop.
Example on how to (low level) hard remap a keyboard key on linux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$sudo evtest #the keyboard was input 5 here, I wanted to make KeyPad0 work as LeftAlt key | |
Select the device event number [0-22]: 5 | |
Input driver version is 1.0.1 | |
Input device ID: bus 0x3 vendor 0x1a2c product 0x3d43 version 0x110 | |
Input device name: "SEMICO USB Keyboard" | |
Event: time 1599799246.967341, -------------- SYN_REPORT ------------ | |
Event: time 1599799247.011339, type 1 (EV_KEY), code 56 (KEY_LEFTALT), value 2 | |
Event: time 1599799247.011339, -------------- SYN_REPORT ------------ | |
Event: time 1599799247.011339, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e2 | |
Event: time 1599799247.011339, type 1 (EV_KEY), code 56 (KEY_LEFTALT), value 0 | |
Event: time 1599797919.619347, -------------- SYN_REPORT ------------ | |
Event: time 1599797919.659355, type 1 (EV_KEY), code 82 (KEY_KP0), value 2 | |
Event: time 1599797919.659355, -------------- SYN_REPORT ------------ | |
Event: time 1599797919.659355, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70062 | |
Event: time 1599797919.659355, type 1 (EV_KEY), code 82 (KEY_KP0), value 0 | |
$sudo input-kbd 5 | |
0x70062 = 82 # ??? | |
$#the b*v*p* is based on "input device id" line from `evtest` | |
$#the =leftalt is just KEY_LEFTALT w/o KEY_ and in lowercase | |
$cat >>/etc/udev/hwdb.d/98-custom-keyboard.hwdb | |
evdev:input:b0003v1A2Cp3D43* | |
KEYBOARD_KEY_70062=leftalt | |
$sudo udevadm hwdb --update | |
$ls -l /etc/udev/hwdb.bin | |
$sudo udevadm trigger --sysname-match="event*" | |
$#to restore use | |
evdev:input:b0003v1A2Cp3D43* | |
KEYBOARD_KEY_70062=kp0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment