Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] Using UDEV (not EUDEV) to change keyboard keys
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
ManDay
Apprentice
Apprentice


Joined: 22 Jan 2008
Posts: 247

PostPosted: Thu Aug 19, 2021 12:39 pm    Post subject: [SOLVED] Using UDEV (not EUDEV) to change keyboard keys Reply with quote

The following rule worked well with eudev to swap the Capslock and Esc keys on my laptop's integrated keyboard:

Code:
SUBSYSTEM=="input", ENV{ID_INPUT_KEYBOARD}=="1", ENV{KEYBOARD_KEY_01}="capslock", ENV{KEYBOARD_KEY_3a}="esc"


Since changing to udev, it doesn't work anymore. The attributes KEYBOARD_KEY_01 and KEYBOARD_KEY_3a still show up in the device as by udevadm, but the keys are no longer swapped.

Does anyone either know how to fix this or know the right mailing list where I could ask this (systemd? kernel linux-hotplug?)?

Thank you!

Code:
P: /devices/platform/i8042/serio0/input/input3
L: 0
E: DEVPATH=/devices/platform/i8042/serio0/input/input3
E: SUBSYSTEM=input
E: PRODUCT=11/1/1/ab41
E: NAME="AT Translated Set 2 keyboard"
E: PHYS="isa0060/serio0/input0"
E: PROP=0
E: EV=120013
E: KEY=10000 c020000000000 0 0 700f02000003 3802078f870f401 febfffdfffefffff fffffffffffffffe
E: MSC=10
E: LED=7
E: MODALIAS=input:b0011v0001p0001eAB41-e0,1,4,11,14,k71,72,73,74,75,77,79,7A,7B,7C,7D,7E,7F,80,8A,8C,8D,8E,8F,94,95,96,9B,9C,9D,9E,9F,A3,A4,A5,A6,AD,B7,B8,B9,C0,C1,D9,E0,E1,E2,E3,EC,ED,EE,1A9,1B2,1B3,1D0,ram4,l0,1,2,sfw
E: USEC_INITIALIZED=1529018
E: ID_INPUT=1
E: ID_INPUT_KEY=1
E: ID_INPUT_KEYBOARD=1
E: ID_BUS=i8042
E: ID_SERIAL=noserial
E: ID_PATH=platform-i8042-serio-0
E: ID_PATH_TAG=platform-i8042-serio-0
E: KEYBOARD_KEY_01=capslock
E: KEYBOARD_KEY_3a=esc

P: /devices/platform/i8042/serio0/input/input3/event3
N: input/event3
L: 0
S: input/by-path/platform-i8042-serio-0-event-kbd
E: DEVPATH=/devices/platform/i8042/serio0/input/input3/event3
E: SUBSYSTEM=input
E: DEVNAME=/dev/input/event3
E: MAJOR=13
E: MINOR=67
E: USEC_INITIALIZED=1577504
E: KEYBOARD_KEY_86=wlan
E: KEYBOARD_KEY_a5=help
E: KEYBOARD_KEY_a6=setup
E: KEYBOARD_KEY_a7=battery
E: KEYBOARD_KEY_a9=switchvideomode
E: KEYBOARD_KEY_b2=www
E: KEYBOARD_KEY_b3=euro
E: KEYBOARD_KEY_b4=dollar
E: KEYBOARD_KEY_ce=brightnessup
E: KEYBOARD_KEY_d4=bluetooth
E: KEYBOARD_KEY_d5=wlan
E: KEYBOARD_KEY_d6=wlan
E: KEYBOARD_KEY_d7=bluetooth
E: KEYBOARD_KEY_d8=bluetooth
E: KEYBOARD_KEY_d9=bluetooth
E: KEYBOARD_KEY_ee=brightnessup
E: KEYBOARD_KEY_ef=brightnessdown
E: KEYBOARD_KEY_f1=f22
E: KEYBOARD_KEY_f2=f23
E: KEYBOARD_KEY_f3=prog2
E: KEYBOARD_KEY_f4=prog1
E: KEYBOARD_KEY_f5=presentation
E: KEYBOARD_KEY_f6=power
E: KEYBOARD_KEY_f8=fn
E: KEYBOARD_KEY_f9=prog1
E: KEYBOARD_KEY_84=bluetooth
E: KEYBOARD_KEY_92=media
E: ID_INPUT=1
E: ID_INPUT_KEY=1
E: ID_INPUT_KEYBOARD=1
E: ID_BUS=i8042
E: ID_SERIAL=noserial
E: ID_PATH=platform-i8042-serio-0
E: ID_PATH_TAG=platform-i8042-serio-0
E: LIBINPUT_DEVICE_GROUP=11/1/1:isa0060/serio0
E: KEYBOARD_KEY_01=capslock
E: KEYBOARD_KEY_3a=esc
E: DEVLINKS=/dev/input/by-path/platform-i8042-serio-0-event-kbd


Last edited by ManDay on Sun Aug 22, 2021 6:20 pm; edited 1 time in total
Back to top
View user's profile Send private message
ManDay
Apprentice
Apprentice


Joined: 22 Jan 2008
Posts: 247

PostPosted: Sun Aug 22, 2021 10:54 am    Post subject: Reply with quote

I've also noticed that `systemd-hwdb`, the binary which supposedly compiles hwdb.bin and thus causes other `KEYBOARD_KEY` entries to appear, is missing from udev. I'm not sure how this is related, but I find it weird because now I wonder how hwdb.bin is compiled. By now I've filed an upstream bug, because I suspect something causes the udev rules for KEYBOARD_KEY to not make it back into the kernel:

https://github.com/systemd/systemd/issues/20510
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6248
Location: Dallas area

PostPosted: Sun Aug 22, 2021 1:17 pm    Post subject: Reply with quote

I couldn't get any usb keyboard/mouse to accept changes, so I looked around and found

A keymapping program @ https://github.com/stefansaraev/keytable, there is no ebuild, but it's only one .c file and one .h with the makefile.
So I compiled it and put it in my home bin dir.

Now, I can swap middle mouse button, and have some keyboard media keys redefined.
It runs once at start and that's all that's needed till the next reboot.

Edit to add: If I was using X I'd use the modmap utility, but wayland doesn't have such a thing, or at least it didn't the last I looked.
_________________
UM780, 6.12 zen kernel, gcc 13, openrc, wayland
Back to top
View user's profile Send private message
ManDay
Apprentice
Apprentice


Joined: 22 Jan 2008
Posts: 247

PostPosted: Sun Aug 22, 2021 6:21 pm    Post subject: Reply with quote

Solved as by https://github.com/systemd/systemd/issues/20510#issuecomment-903307876 !

(with a clear explanation, too)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum