evdev ButtonMapping 记录正常但没有效果

evdev ButtonMapping 记录正常但没有效果

忽略命令有效,但按钮映射无效。

我创建了一个文件/usr/share/X11/xorg.conf.d/39-myinput.com

Section "InputClass"
        Identifier "Apple MagicKeyboard"
        MatchIsKeyboard "on"
        MatchProduct "Magic Keyboard"
        MatchDevicePath "/dev/input/event*"
        Driver "evdev"
        Option "Ignore" "off"
        Option "ButtonMapping" "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 0"
EndSection

我目前正在测试 ButtonMapping,但似乎没有效果。您能给我指明正确的方向吗?

我已evtest确定键 16 和 17 是QW

Event: time 1512268567.675999, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70014
Event: time 1512268567.675999, type 1 (EV_KEY), code 16 (KEY_Q), value 0
Event: time 1512268567.675999, -------------- SYN_REPORT ------------
Event: time 1512268568.531055, type 4 (EV_MSC), code 4 (MSC_SCAN), value 7001a
Event: time 1512268568.531055, type 1 (EV_KEY), code 17 (KEY_W), value 1
Event: time 1512268568.531055, -------------- SYN_REPORT ------------

...我已经将它们设置为0KeyMapping字符串中将它们设置为以禁用它们,但在重新启动 X 后我发现它们并没有被禁用。如果我将指令更改Ignoreon而不是off,我发现我的整个 MagicKeyboard 都被禁用了(而我连接的其他键盘仍然有效)。

我的xorg.conf.d目录包含以下内容:

10-amdgpu.conf
10-evdev.conf
10-quirks.conf
10-radeon.conf
11-evdev-quirks.conf
11-evdev-trackpoint.conf
39-myinput.conf
40-libinput.conf
51-synaptics-quirks.conf
70-synaptics.conf
70-wacom.conf

我的/var/log/X.log.0包含以下内容:

[196248.970] (II) config/udev: Adding input device Magic Keyboard (/dev/input/event20)
[196248.970] (**) Magic Keyboard: Applying InputClass "Apple MagicKeyboard"
[196248.970] (**) Magic Keyboard: Applying InputClass "evdev keyboard catchall"
[196248.970] (**) Magic Keyboard: Applying InputClass "libinput keyboard catchall"
[196248.970] (**) Magic Keyboard: Applying InputClass "Apple MagicKeyboard"
[196248.970] (**) Magic Keyboard: Applying InputClass "Apple MagicKeyboard"
[196248.971] (II) Using input driver 'evdev' for 'Magic Keyboard'
[196248.971] (**) Magic Keyboard: always reports core events
[196248.971] (**) evdev: Magic Keyboard: Device: "/dev/input/event20"
[196248.971] (**) evdev: Magic Keyboard: ButtonMapping '1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 0'
[196248.971] (--) evdev: Magic Keyboard: Vendor 0x4c Product 0x267
[196248.971] (--) evdev: Magic Keyboard: Found 3 mouse buttons
[196248.971] (--) evdev: Magic Keyboard: Found absolute axes
[196248.971] (II) evdev: Magic Keyboard: Forcing absolute x/y axes to exist.
[196248.971] (--) evdev: Magic Keyboard: Found keys
[196248.971] (II) evdev: Magic Keyboard: Forcing relative x/y axes to exist.
[196248.971] (II) evdev: Magic Keyboard: Configuring as mouse
[196248.971] (II) evdev: Magic Keyboard: Configuring as keyboard
[196248.971] (**) evdev: Magic Keyboard: YAxisMapping: buttons 4 and 5
[196248.971] (**) evdev: Magic Keyboard: EmulateWheelButton: 4, EmulateWheelInertia: 10, EmulateWheelTimeout: 200
[196248.971] (II) XINPUT: Adding extended input device "Magic Keyboard" (type: KEYBOARD, id 12)
[196248.972] (II) evdev: Magic Keyboard: initialized for absolute axes.
[196248.972] (**) Magic Keyboard: (accel) keeping acceleration scheme 1
[196248.972] (**) Magic Keyboard: (accel) acceleration profile 0
[196248.972] (**) Magic Keyboard: (accel) acceleration factor: 2.000
[196248.972] (**) Magic Keyboard: (accel) acceleration threshold: 4

我正在运行 Ubuntu 17.04。

答案1

ButtonMapping 是一个指针函数(用于鼠标),但您已设置 MatchIsKeyboard,这意味着您正在尝试将其应用于键盘。键盘没有按钮。您可以使用以下命令检查:

xinput list

进而

xinput get-button-map <id-of-your-device>

无论如何,您可能不想为此使用 evdev 函数,听起来您想更改键盘映射。

相关内容