Sly*_*ven 4 debian mouse scrolling
我有一个光学GreatEye滚轮鼠标有2个滚轮和5个“按钮”(三级,包括中央作为第一滚轮“点击”)和左右两侧的按钮(在下面的图片阴暗面区),尽管有xinput --list-props输出寻找正确BOTH滚轮表现为按钮 4 和 5 而不是第二个在 6 和 7 上工作,为什么会这样,我该如何解决(让第二个滚轮像水平滚轮一样工作)?

上图来自:A4Tech网站
从输出xinput list-props #,其中#是正确的设备ID:
Device 'ImExPS/2 Generic Explorer Mouse':
Device Enabled (142): 1
Coordinate Transformation Matrix (144): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
Device Accel Profile (269): 0
Device Accel Constant Deceleration (270): 1.000000
Device Accel Adaptive Deceleration (271): 1.000000
Device Accel Velocity Scaling (272): 10.000000
Device Product ID (261): 2, 6
Device Node (262): "/dev/input/event1"
Evdev Axis Inversion (273): 0, 0
Evdev Axes Swap (275): 0
Axis Labels (276): "Rel X" (152), "Rel Y" (153), "Rel Horiz Wheel" (267), "Rel Vert Wheel" (268)
Button Labels (277): "Button Left" (145), "Button Middle" (146), "Button Right" (147), "Button Wheel Up" (148), "Button Wheel Down" (149), "Button Horiz Wheel Left" (150), "Button Horiz Wheel Right" (151), "Button Side" (265), "Button Extra" (266), "Button Unknown" (264), "Button Unknown" (264), "Button Unknown" (264), "Button Unknown" (264)
Evdev Scrolling Distance (278): 1, 1, 1
Evdev Middle Button Emulation (279): 0
Evdev Middle Button Timeout (280): 50
Evdev Third Button Emulation (281): 0
Evdev Third Button Emulation Timeout (282): 1000
Evdev Third Button Emulation Button (283): 3
Evdev Third Button Emulation Threshold (284): 20
Evdev Wheel Emulation (285): 0
Evdev Wheel Emulation Axes (286): 0, 0, 4, 5
Evdev Wheel Emulation Inertia (287): 10
Evdev Wheel Emulation Timeout (288): 200
Evdev Wheel Emulation Button (289): 4
Evdev Drag Lock Buttons (290): 0
Run Code Online (Sandbox Code Playgroud)
使用xev我已经看到两个滚轮看到的事件是相同的。对我来说,这表明这是一个内核/模块问题,我正在使用带有 backports 的 Debian“Jessie” - 后者意味着我目前正在使用,如uname -a:
Linux XXXXX 4.9.0-0.bpo.1-rt-amd64 #1 SMP PREEMPT RT Debian 4.9.2-2~bpo8+1 (2017-01-26) x86_64 GNU/Linux
Run Code Online (Sandbox Code Playgroud)
作为一种推测性假设,我想知道(考虑到实际上有更多真正滚轮的老鼠数量有限)这是否可能与内核相关的东西 - 因此,作为补充答案,我可以从哪里开始寻找更多信息出了什么问题?
更新:也许我错了,因为:
Evdev Wheel Emulation Axes (286): 0, 0, 4, 5
Run Code Online (Sandbox Code Playgroud)
应该:
Evdev Wheel Emulation Axes (286): 6, 7, 4, 5
Run Code Online (Sandbox Code Playgroud)
但只是用xinput set-props # 286 6 7 4 5# 是正确的 ID 号改变它本身并没有产生任何变化......
奇怪的是,grep-ping 我的/var/log/Xorg.0.log文件会产生:
[ 46.173] (II) config/udev: Adding input device ImExPS/2 Generic Explorer Mouse (/dev/input/event1)
[ 46.173] (**) ImExPS/2 Generic Explorer Mouse: Applying InputClass "evdev pointer catchall"
[ 46.173] (**) ImExPS/2 Generic Explorer Mouse: Applying InputClass "evdev pointer catchall"
[ 46.173] (II) Using input driver 'evdev' for 'ImExPS/2 Generic Explorer Mouse'
[ 46.173] (**) ImExPS/2 Generic Explorer Mouse: always reports core events
[ 46.173] (**) evdev: ImExPS/2 Generic Explorer Mouse: Device: "/dev/input/event1"
[ 46.173] (--) evdev: ImExPS/2 Generic Explorer Mouse: Vendor 0x2 Product 0x6
[ 46.173] (--) evdev: ImExPS/2 Generic Explorer Mouse: Found 9 mouse buttons
[ 46.173] (--) evdev: ImExPS/2 Generic Explorer Mouse: Found scroll wheel(s)
[ 46.173] (--) evdev: ImExPS/2 Generic Explorer Mouse: Found relative axes
[ 46.173] (--) evdev: ImExPS/2 Generic Explorer Mouse: Found x and y relative axes
[ 46.173] (II) evdev: ImExPS/2 Generic Explorer Mouse: Configuring as mouse
[ 46.173] (II) evdev: ImExPS/2 Generic Explorer Mouse: Adding scrollwheel support
[ 46.173] (**) evdev: ImExPS/2 Generic Explorer Mouse: YAxisMapping: buttons 4 and 5
[ 46.173] (**) evdev: ImExPS/2 Generic Explorer Mouse: EmulateWheelButton: 4, EmulateWheelInertia: 10, EmulateWheelTimeout: 200
[ 46.173] (II) XINPUT: Adding extended input device "ImExPS/2 Generic Explorer Mouse" (type: MOUSE, id 9)
[ 46.174] (II) evdev: ImExPS/2 Generic Explorer Mouse: initialized for relative axes.
[ 46.174] (**) ImExPS/2 Generic Explorer Mouse: (accel) keeping acceleration scheme 1
[ 46.174] (**) ImExPS/2 Generic Explorer Mouse: (accel) acceleration profile 0
[ 46.174] (**) ImExPS/2 Generic Explorer Mouse: (accel) acceleration factor: 2.000
[ 46.174] (**) ImExPS/2 Generic Explorer Mouse: (accel) acceleration threshold: 4
[ 46.174] (II) config/udev: Adding input device ImExPS/2 Generic Explorer Mouse (/dev/input/mouse0)
Run Code Online (Sandbox Code Playgroud)
请注意,虽然有一行包括YAxisMapping: buttons 4 and 5没有相应的XAxisMapping: buttons 6 and 7- 这是暗示......
注意:(回应评论)它是 PS/2 连接器鼠标,因此与 USB 相关的诊断可能不会有帮助。
安装evtest软件包后,我发现两个滚轮的事件具有相同的type 2 (EV_REL),code 8 (EV_WHEEL)但是第一个滚轮具有value 1or -1(用于在两个相反方向上移动)而第二个滚轮具有value 2或-2。有趣的是,我记得在使用中我注意到在某些应用程序中,第二个滚轮产生的滚动动作是第一个的两倍- 这开始听起来像是某些代码可能将值误解为移动量而不是“方向” !
好像十五年前就有人注意到了!Linux 内核邮件列表上几天 (2002/07/17-18) 的一系列帖子,标题为“PS2 输入核心支持”表明这是众所周知的,但因为有不止一种处理方式使用手动模块参数可能必须为该特定产品处理相同的数据。然而,这似乎从未实现。在这篇文章中可以最好地看到细节:
...
问题是 A4Tech 驱动程序并不关心。它只是按照我描述的方式解释传入的数据:+-1 是垂直移动,+-2 是水平移动,0 是不移动,其他一切都被忽略......这是 A4Tech 对 ImPS/2 和 ExPS/2 协议的解释.
所以我们可以假设(就像 GPM 一样)滚轮移动只能是 +-1,所以我们可以安全地假设 +-2 是水平移动,然后一切都很好,或者我们需要一些会影响鼠标驱动程序的选项行为。
我所有的(A4Tech...)PS/2 滚轮鼠标报告滚轮移动只有 +-1,即使采样率为 10Hz,但我认为我的鼠标不是可用 ExPS/2 实现的代表性样本。
不,正常的 ImPS/2 和 ExPS/2 鼠标确实可以报告大于 1 的车轮运动值。
我们可以进行一些启发式(曾经看到 3 的移动?如果是,那么它不是 A4Tech 鼠标...),或者使用命令行参数。
我想我会拿出我的一些 A4Tech 老鼠并折磨它们,看看它们是否会对某些序列做出反应......
另一件事是 USB A4Tech 鼠标,它使用一个按钮来区分轮子,而 USB 规范在鼠标上提供了两个轮子:(。但至少可以检测到这些。
--
Vojtech Pavlik
SuSE 实验室
所以,我打算搞一个位内核两轮牛车的添加一个模块参数./drivers/input/mouse/psmouse_base.c来揍了的情况下启用时将数据从鼠标读来修复它psmouse_type是PSMOUSE_IMEX。
好吧,我现在有一些对我有用的东西,并已将它作为输入发布到 Linux 内核输入组的区域:psmouse - 修复 A4Tech 双滚轮鼠标上的第二个滚轮,但因为它只对非常小的鼠标有用用户组 我不确定它会加入。补丁相当小,但因为它修改了与其他以更正常方式使用 PS/2 鼠标协议的鼠标不兼容的行为,所以它不会被激活默认情况下。作为一个模块,它将被一个option psmouse a4tech_hack=1inmodules.conf或现在系统上使用的任何东西启用-evtest用于演示给出,首先禁用 hack:
stephen@Ripley:~$ sudo modprobe psmouse options a4tech_hack=0 stephen@Ripley:~$ sudo evtest --grab /dev/input/event1 Input driver version is 1.0.1 Input device ID: bus 0x11 vendor 0x2 product 0x6 version 0x0 Input device name: "ImExPS/2 Generic Explorer Mouse" 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 type 2 (EV_REL) Event code 0 (REL_X) Event code 1 (REL_Y) Event code 6 (REL_HWHEEL) Event code 8 (REL_WHEEL) Properties: Property type 0 (INPUT_PROP_POINTER) Testing ... (interrupt to exit) Event: time 1511190325.037494, type 2 (EV_REL), code 8 (REL_WHEEL), value -1 Event: time 1511190325.037494, -------------- SYN_REPORT ------------ Event: time 1511190325.069545, type 2 (EV_REL), code 8 (REL_WHEEL), value -1 Event: time 1511190325.069545, -------------- SYN_REPORT ------------ Event: time 1511190325.103279, type 2 (EV_REL), code 8 (REL_WHEEL), value -1 Event: time 1511190325.103279, -------------- SYN_REPORT ------------ Event: time 1511190325.360609, type 2 (EV_REL), code 8 (REL_WHEEL), value -1 Event: time 1511190325.360609, -------------- SYN_REPORT ------------ Event: time 1511190325.754597, type 2 (EV_REL), code 8 (REL_WHEEL), value -2 Event: time 1511190325.754597, -------------- SYN_REPORT ------------ Event: time 1511190326.226203, type 2 (EV_REL), code 8 (REL_WHEEL), value 2 Event: time 1511190326.226203, -------------- SYN_REPORT ------------ Event: time 1511190326.335886, type 2 (EV_REL), code 8 (REL_WHEEL), value -2 Event: time 1511190326.335886, -------------- SYN_REPORT ------------ Event: time 1511190326.420238, type 2 (EV_REL), code 8 (REL_WHEEL), value -2 Event: time 1511190326.420238, -------------- SYN_REPORT ------------ Event: time 1511190326.849670, type 2 (EV_REL), code 8 (REL_WHEEL), value -2 Event: time 1511190326.849670, -------------- SYN_REPORT ------------
然后启用它,请注意值为 +/-2 的 REL_WHEEL 事件现在如何正确映射为 REL_HWHEEL 事件:
stephen@Ripley:~$ sudo modprobe -r psmouse stephen@Ripley:~$ sudo modprobe psmouse options a4tech_hack=1 stephen@Ripley:~$ sudo evtest --grab /dev/input/event1 Input driver version is 1.0.1 Input device ID: bus 0x11 vendor 0x2 product 0x6 version 0x0 Input device name: "ImExPS/2 Generic Explorer Mouse" 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 type 2 (EV_REL) Event code 0 (REL_X) Event code 1 (REL_Y) Event code 6 (REL_HWHEEL) Event code 8 (REL_WHEEL) Properties: Property type 0 (INPUT_PROP_POINTER) Testing ... (interrupt to exit) Event: time 1511190624.369531, type 2 (EV_REL), code 8 (REL_WHEEL), value 1 Event: time 1511190624.369531, -------------- SYN_REPORT ------------ Event: time 1511190625.580824, type 2 (EV_REL), code 8 (REL_WHEEL), value -1 Event: time 1511190625.580824, -------------- SYN_REPORT ------------ Event: time 1511190626.139235, type 2 (EV_REL), code 8 (REL_WHEEL), value 1 Event: time 1511190626.139235, -------------- SYN_REPORT ------------ Event: time 1511190626.419281, type 2 (EV_REL), code 8 (REL_WHEEL), value -1 Event: time 1511190626.419281, -------------- SYN_REPORT ------------ Event: time 1511190626.693413, type 2 (EV_REL), code 8 (REL_WHEEL), value 1 Event: time 1511190626.693413, -------------- SYN_REPORT ------------ Event: time 1511190628.506133, type 2 (EV_REL), code 6 (REL_HWHEEL), value 1 Event: time 1511190628.506133, -------------- SYN_REPORT ------------ Event: time 1511190628.669774, type 2 (EV_REL), code 6 (REL_HWHEEL), value -1 Event: time 1511190628.669774, -------------- SYN_REPORT ------------ Event: time 1511190628.921986, type 2 (EV_REL), code 6 (REL_HWHEEL), value 1 Event: time 1511190628.921986, -------------- SYN_REPORT ------------ Event: time 1511190628.970915, type 2 (EV_REL), code 6 (REL_HWHEEL), value 1 Event: time 1511190628.970915, -------------- SYN_REPORT ------------ Event: time 1511190629.235774, type 2 (EV_REL), code 6 (REL_HWHEEL), value -1 Event: time 1511190629.235774, -------------- SYN_REPORT ------------ Event: time 1511190629.425575, type 2 (EV_REL), code 6 (REL_HWHEEL), value 1 Event: time 1511190629.425575, -------------- SYN_REPORT ------------ Event: time 1511190629.475333, type 2 (EV_REL), code 6 (REL_HWHEEL), value 1 Event: time 1511190629.475333, -------------- SYN_REPORT ------------ Event: time 1511190629.668506, type 2 (EV_REL), code 6 (REL_HWHEEL), value -1 Event: time 1511190629.668506, -------------- SYN_REPORT ------------ Event: time 1511190629.730081, type 2 (EV_REL), code 6 (REL_HWHEEL), value -1 Event: time 1511190629.730081, -------------- SYN_REPORT ------------ Event: time 1511190629.862513, type 2 (EV_REL), code 6 (REL_HWHEEL), value 1 Event: time 1511190629.862513, -------------- SYN_REPORT ------------ Event: time 1511190629.909745, type 2 (EV_REL), code 6 (REL_HWHEEL), value 1 Event: time 1511190629.909745, -------------- SYN_REPORT ------------ Event: time 1511190630.139196, type 2 (EV_REL), code 6 (REL_HWHEEL), value -1 Event: time 1511190630.139196, -------------- SYN_REPORT ------------