udev 键盘映射

udev 键盘映射

我想使用 udev 规则来进行系统范围的键盘映射。
我写了 /etc/udev/hwdb.d/my-custom.hwdb
XPS15 9570

# Map Caps Lock to Control
# I copied from /lib/udev/hwdb.d/60-keyboard.hwdb
# Used to be
# evdev:atkbd:dmi:bvn*:bvr*:bd*:svnDell*:pnXPS*:pvr* 
#  KEYBOARD_KEY_8c=!unknown

evdev:atkbd:dmi:bvn*:bvr*:bd*:svn*:pn*:pvr* 
 KEYBOARD_KEY_3a=leftctrl

$ sudo systemd-hwdb update
/etc/udev/hwdb.d/my-custom.hwdb:19: Property expected, ignoring record with no properties
$ sudo udevadm trigger /dev/input/event0

但这不起作用。
我觉得很简单,但是我现在很头晕。

$ sudo evtest
...
Event: time 1583562939.539691, -------------- SYN_REPORT ------------
Event: time 1583562942.556894, type 4 (EV_MSC), code 4 (MSC_SCAN), value 3a
Event: time 1583562942.556894, type 1 (EV_KEY), code 58 (KEY_CAPSLOCK), value 1
Event: time 1583562942.556894, -------------- SYN_REPORT ------------
Event: time 1583562942.663607, type 4 (EV_MSC), code 4 (MSC_SCAN), value 3a
Event: time 1583562942.663607, type 1 (EV_KEY), code 58 (KEY_CAPSLOCK), value 0
Event: time 1583562942.663607, -------------- SYN_REPORT ------------
Event: time 1583562942.663986, type 17 (EV_LED), code 1 (LED_CAPSL), value 0
Event: time 1583562942.663986, -------------- SYN_REPORT ------------
Event: time 1583562943.321883, type 4 (EV_MSC), code 4 (MSC_SCAN), value 1d
Event: time 1583562943.321883, type 1 (EV_KEY), code 29 (KEY_LEFTCTRL), value 1
$ udevadm info -a -p $(udevadm info -q path -n /dev/input/by-path/platform-i8042-serio-0-event-kbd )

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '//devices/platform/i8042/serio0/input/input0/event0':
    KERNEL=="event0"
    SUBSYSTEM=="input"
    DRIVER==""

  looking at parent device '//devices/platform/i8042/serio0/input/input0':
    KERNELS=="input0"
    SUBSYSTEMS=="input"
    DRIVERS==""
    ATTRS{uniq}==""
    ATTRS{name}=="AT Translated Set 2 keyboard"
    ATTRS{phys}=="isa0060/serio0/input0"
    ATTRS{properties}=="0"

  looking at parent device '//devices/platform/i8042/serio0':
    KERNELS=="serio0"
    SUBSYSTEMS=="serio"
    DRIVERS=="atkbd"
    ATTRS{scroll}=="0"
    ATTRS{description}=="i8042 KBD port"
    ATTRS{firmware_id}=="PNP: PNP0303"
    ATTRS{err_count}=="0"
    ATTRS{extra}=="0"
    ATTRS{set}=="2"
    ATTRS{softraw}=="1"
    ATTRS{force_release}=="140,369-370"
    ATTRS{softrepeat}=="0"
    ATTRS{bind_mode}=="auto"

  looking at parent device '//devices/platform/i8042':
    KERNELS=="i8042"
    SUBSYSTEMS=="platform"
    DRIVERS=="i8042"
    ATTRS{driver_override}=="(null)"

  looking at parent device '//devices/platform':
    KERNELS=="platform"
    SUBSYSTEMS==""
    DRIVERS==""

相关内容