使用 hwdb NumLock 0 重新映射 udev 键盘

使用 hwdb NumLock 0 重新映射 udev 键盘

我有一台三星 np870z5e 笔记本电脑,内置数字键盘,操作系统为 ubuntu 16.04 和 udev 229。

我有一个“Fn-lock”按钮,如果按下它,数字键盘 0 按钮 (KP_0) 会变成“菜单”按钮(xev 报告它)或“KEY_COMPOSE”(evtest 报告它)。

所以我想将KEY_COMPOSE永久重写为KP_0。因此,即使我按下键盘上的 FN-lock 按钮,数字键盘的 0 键也应该保持 0 键。 (没有其他键交换,只有 0 键有问题)。

键盘位于:

/dev/input/event3
/dev/input/by-path/platform-i8042-serio-0-event-kbd

$ udevadm info /dev/input/by-path/plat*
P: /devices/platform/i8042/serio0/input/input3/event3
N: input/event3
S: input/by-path/platform-i8042-serio-0-event-kbd
E: BACKSPACE=guess
E: DEVLINKS=/dev/input/by-path/platform-i8042-serio-0-event-kbd
E: DEVNAME=/dev/input/event3
E: DEVPATH=/devices/platform/i8042/serio0/input/input3/event3
E: ID_INPUT=1
E: ID_INPUT_KEY=1
E: ID_INPUT_KEYBOARD=1
E: ID_PATH=platform-i8042-serio-0
E: ID_PATH_TAG=platform-i8042-serio-0
E: ID_SERIAL=noserial
E: KEYBOARD_KEY_74=prog1
E: KEYBOARD_KEY_75=www
E: KEYBOARD_KEY_78=mail
E: KEYBOARD_KEY_82=!switchvideomode
E: KEYBOARD_KEY_83=!battery
E: KEYBOARD_KEY_84=!prog1
E: KEYBOARD_KEY_86=!wlan
E: KEYBOARD_KEY_88=!brightnessup
E: KEYBOARD_KEY_89=!brightnessdown
E: KEYBOARD_KEY_96=!kbdillumup
E: KEYBOARD_KEY_97=!kbdillumdown
E: KEYBOARD_KEY_b1=!prog2
E: KEYBOARD_KEY_b3=!prog3
E: KEYBOARD_KEY_b4=!wlan
E: KEYBOARD_KEY_c5=!prog3
E: KEYBOARD_KEY_ce=!prog1
E: KEYBOARD_KEY_d5=!wlan
E: KEYBOARD_KEY_f7=!f22
E: KEYBOARD_KEY_f9=!f23
E: MAJOR=13
E: MINOR=67
E: SUBSYSTEM=input
E: USEC_INITIALIZED=1876095
E: XKBLAYOUT=hu
E: XKBMODEL=pc105

ev测试输出:

 sudo evtest
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0:  Lid Switch
/dev/input/event1:  Power Button
/dev/input/event2:  Power Button
/dev/input/event3:  AT Translated Set 2 keyboard
/dev/input/event4:  Video Bus
/dev/input/event5:  Video Bus
/dev/input/event6:  ETPS/2 Elantech Touchpad
/dev/input/event7:  WebCam SC-10HDP12631N
/dev/input/event8:  HDA Intel PCH Mic
/dev/input/event9:  HDA Intel PCH Headphone
/dev/input/event10: HDA Intel PCH HDMI/DP,pcm=3
Select the device event number [0-10]: 3
Input driver version is 1.0.1
Input device ID: bus 0x11 vendor 0x1 product 0x1 version 0xab41
Input device name: "AT Translated Set 2 keyboard"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 1 (KEY_ESC)
    Event code 2 (KEY_1)
    Event code 3 (KEY_2)
    ... (truncated for brevity)

所以bus应该是:0011,vendor应该是0x0001:

hwdb文件是这样的:

$ cat /etc/udev/hwdb.d/10-my-modifiers.hw 
evdev:input:b0011v0001*
 KEYBOARD_KEY_3a=leftalt     # bind capslock to leftalt
 KEYBOARD_KEY_38=leftctrl    # bind leftalt to leftctrl
 KEYBOARD_KEY_1a=a
 KEYBOARD_KEY_1b=b

更新通过:

$ sudo udevadm hwdb --update && sudo udevadm trigger

但这不起作用。我也尝试过evdev:name:,,evdev:atkbd:仍然没有运气。

我如何确定哪条evdev:input:b0011v0001*线是正确的?

类似的问题(没有一个对我有用): udev 键盘与 hwdb 重新映射为辅助键盘 Udev hwdb 规则不起作用

答案1

尝试这样的事情:

evdev:atkbd:dmi:bvn*:bvr*:bd*:svn*:pn*:pvr*

在我的 Ubuntu 16.04 上的 Thinkpad x240 上,它工作正常:

cat /etc/udev/hwdb.d/61-ThinkPad-X240-keyboard.hwdb
# ThinkPad X240: switch End and Insert keys (so that when Fn-Lock is enabled, End works without Fn).
#keyboard:dmi:bvn*:bvr*:bd*:svnLENOVO:pn*:pvrThinkPadX240:*
evdev:atkbd:dmi:bvn*:bvr*:bd*:svnLENOVO:pn*:pvrThinkPadX240:*
 KEYBOARD_KEY_d2=end
 KEYBOARD_KEY_cf=insert

相关内容