![您可以使用 hwdb 将 REL_HWHEEL 重新映射到 BTN_* 事件或组合键吗?](https://linux22.com/image/216159/%E6%82%A8%E5%8F%AF%E4%BB%A5%E4%BD%BF%E7%94%A8%20hwdb%20%E5%B0%86%20REL_HWHEEL%20%E9%87%8D%E6%96%B0%E6%98%A0%E5%B0%84%E5%88%B0%20BTN_*%20%E4%BA%8B%E4%BB%B6%E6%88%96%E7%BB%84%E5%90%88%E9%94%AE%E5%90%97%EF%BC%9F.png)
我有一个带有 4 向滚轮的鼠标 (Logitech M705)。左/右按键基本上是按钮,所以不像实际的水平滚轮。由于我没有使用水平滚动功能(当然也不是通过单按钮按下事件),所以我想将它们用于其他用途,例如在浏览器中导航选项卡(通常是 CTRL+PgUp 或 PgDown)。现在在 X11 中,使用例如 imwheel 相当容易,但在 Wayland 上,它似乎更复杂。其余按键会触发 EV_MSC/EV_KEY 事件,并吐出可用于 KEYBOARD_KEY 重新映射的扫描代码,而 REL_HWHEEL 按钮会触发 EV_REL,然后在使用 evtest 进行测试时触发 +1 或 -1。即鼠标左键:
Event: time 1674593064.411235, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90001
Event: time 1674593064.411235, type 1 (EV_KEY), code 272 (BTN_LEFT), value 1
对于左滚轮:
Event: time 1674593069.069576, type 2 (EV_REL), code 6 (REL_HWHEEL), value -1
Event: time 1674593069.069576, type 2 (EV_REL), code 12 (REL_HWHEEL_HI_RES), value -120
我仍然可以使用自定义 hwdb 文件重新映射它们吗?如果可以,如何重新映射?可以直接使用组合键,也可以使用 BTN_EXTRA2 和 BTN_EXTRA3 等组合键。
evtest 还告诉我有关该设备的信息:
Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x46d product 0x101b version 0x111
Input device name: "Logitech M705"
Supported events:
Event type 0 (EV_SYN)
Event type 1 (EV_KEY)
Event code 272 (BTN_LEFT)
Event code 273 (BTN_RIGHT)
Event code 274 (BTN_MIDDLE)
Event code 275 (BTN_SIDE)
Event code 276 (BTN_EXTRA)
Event code 277 (BTN_FORWARD)
Event code 278 (BTN_BACK)
Event code 279 (BTN_TASK)
Event code 280 (?)
Event code 281 (?)
Event code 282 (?)
Event code 283 (?)
Event code 284 (?)
Event code 285 (?)
Event code 286 (?)
Event code 287 (?)
Event type 2 (EV_REL)
Event code 0 (REL_X)
Event code 1 (REL_Y)
Event code 6 (REL_HWHEEL)
Event code 8 (REL_WHEEL)
Event code 11 (REL_WHEEL_HI_RES)
Event code 12 (REL_HWHEEL_HI_RES)
Event type 4 (EV_MSC)
Event code 4 (MSC_SCAN)
干杯,贝恩德
答案1
我为 libinput 提出了一个问题。也许开发人员可以提供帮助。
https://gitlab.freedesktop.org/libinput/libinput/-/issues/868
我遇到了同样的问题“罗技 M500”。