使用 udev hwdb 映射鼠标按钮

使用 udev hwdb 映射鼠标按钮

遵循本指南:http://www.vxnick.com/blog/2014/10/binding-extra-mouse-buttons-on-linux/

我已经设置了一个配置文件:

$ lsusb | grep G500
Bus 006 Device 007: ID 046d:c068 Logitech, Inc. G500 Laser Mouse
$ cat /etc/udev/hwdb.d/70-g500.hwdb 
keyboard:usb:v046DpC068*
  KEYBOARD_KEY_90009=9
  KEYBOARD_KEY_9000a=8
  KEYBOARD_KEY_90006=0

基于以下evtest输出:

Event: time 1422711060.272136, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90009
Event: time 1422711060.272136, type 1 (EV_KEY), code 280 (?), value 1
Event: time 1422711060.272136, -------------- EV_SYN ------------
Event: time 1422711060.432134, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90009
Event: time 1422711060.432134, type 1 (EV_KEY), code 280 (?), value 0
Event: time 1422711060.432134, -------------- EV_SYN ------------
Event: time 1422711061.461191, type 4 (EV_MSC), code 4 (MSC_SCAN), value 9000a
Event: time 1422711061.461191, type 1 (EV_KEY), code 281 (?), value 1
Event: time 1422711061.461191, -------------- EV_SYN ------------
Event: time 1422711061.628125, type 4 (EV_MSC), code 4 (MSC_SCAN), value 9000a
Event: time 1422711061.628125, type 1 (EV_KEY), code 281 (?), value 0
Event: time 1422711061.628125, -------------- EV_SYN ------------
Event: time 1422711062.725119, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90006
Event: time 1422711062.725119, type 1 (EV_KEY), code 277 (BTN_FORWARD), value 1
Event: time 1422711062.725119, -------------- EV_SYN ------------
Event: time 1422711062.902137, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90006
Event: time 1422711062.902137, type 1 (EV_KEY), code 277 (BTN_FORWARD), value 0

evtest然而,当我完成后,我没有按键(或输出发生变化)。

(是的,我已经做到了udevadm hwdb --update/ trigger

答案1

我在 G600 上经历了同样的事情,在创建 hwdb 文件后,我必须运行(以 root 身份):

udevadm hwdb --update
udevadm control --reload

然后我不得不拔掉/重新插入鼠标。如果这不起作用,我建议删除配置文件中每个 KEYBOARD_KEY 行前面的空格之一。不幸的是,我没有链接,但我在故障排除时确实看到另一篇文章说这些行前面应该有一个空格。我一直没有使用空格,只添加一个修复了 hwdb 不更新的问题。

相关内容