在 Linux 中重新映射触摸鼠标按钮

在 Linux 中重新映射触摸鼠标按钮

我在 Ubuntu 上使用蓝牙触摸鼠标,注意到它有一些额外的键盘映射,对我来说没有实际用途。向左滑动鼠标会产生“d”,向右滑动会产生退格键。我尝试使用 xinput 和 input-kdb 更改键映射,但到目前为止没有任何运气。

$ xinput list "ThinkPad Bluetooth Touch Mouse"
ThinkPad Bluetooth Touch Mouse                 
       Reporting 6 classes:
            Class originated from: 10. Type: XIButtonClass
            Buttons supported: 7
            Button labels: "Button Left" "Button Middle" "Button Right" "Button Wheel Up" "Button Wheel Down" "Button Horiz Wheel Left" "Button Horiz Wheel Right"
            Button state:
            Class originated from: 10. Type: XIKeyClass
            Keycodes supported: 248
            Class originated from: 10. Type: XIValuatorClass
            Detail for Valuator 0:
              Label: Rel X
              Range: -1.000000 - -1.000000
              Resolution: 1 units/m
              Mode: relative
            Class originated from: 10. Type: XIValuatorClass
            Detail for Valuator 1:
              Label: Rel Y
              Range: -1.000000 - -1.000000
              Resolution: 1 units/m
              Mode: relative
            Class originated from: 10. Type: XIValuatorClass
            Detail for Valuator 2:
              Label: Rel Vert Wheel
              Range: -1.000000 - -1.000000
              Resolution: 1 units/m
              Mode: relative
            Class originated from: 10. Type: XIScrollClass
            Scroll info for Valuator 2
              type: 1 (vertical)
              increment: -1.000000
              flags: 0x2 ( preferred )

禁用按钮没有帮助(将它们映射到 0),仍然会生成各种字符。

使用input-kbd更改键映射会导致错误。

$ sudo input-kbd 6
/dev/input/event6
bustype : BUS_BLUETOOTH
vendor  : 0x17ef
product : 0x6063
version : 87
name    : "ThinkPad Bluetooth Touch Mouse"
phys    : "9c:b6:d0:ec:e1:c4"
uniq    : "f0:65:dd:b0:b6:d5"
bits ev : EV_SYN EV_KEY EV_REL EV_MSC EV_REP

map: 12 keys, size: 19/64
0x90001 = 272  # BTN_LEFT
0x90002 = 273  # BTN_RIGHT
0x90003 = 274  # BTN_MIDDLE
0x70006 =  46  # KEY_C
0x70007 =  32  # KEY_D
0x7002a =  14  # KEY_BACKSPACE
0x70014 =  16  # KEY_Q
0x7002b =  15  # KEY_TAB
0x700e3 = 125  # KEY_LEFTMETA
0x700e0 =  29  # KEY_LEFTCTRL
0xc0224 = 158  # KEY_BACK
0xc0225 = 159  # KEY_FORWARD

创建一个将0x70007 = 240d 映射到的文件KEY_UNKNOWN会导致

$ sudo input-kdb -f keymap 6
/dev/input/event6
map: 12 keys, size: 19/64
scancode 458759 out of range (0-19)

是否有另一种方法可以以某种方式映射这些源自鼠标的键盘输入?

相关内容