鼠标滚轮 3m 人体工学鼠标 Ubuntu 18.04

鼠标滚轮 3m 人体工学鼠标 Ubuntu 18.04

在 Ubuntu 16.04 中,通过按住“中间”按钮,evdev 配置我的 3m Ergo Mouse 鼠标模拟滚轮,此方法效果很好。但在 Ubuntu 18.04 中,此方法不再有效。

在 /usr/share/X11/xorg.conf.d/42-middle-mouse-scrolling.conf -rw-r--r-- 1 root root 395 2017 年 2 月 23 日 42-middle-mouse-scrolling.conf

Section "InputClass"
    Identifier "Middle Mouse Button Scrolling"
    Driver "evdev"
    MatchProduct "Optical Mouse"
    MatchDevicePath "/dev/input/event*"
    Option "EmulateWheel" "true"
    Option "EmulateWheelButton" "2"
    Option "XAxisMapping" "6 7"
    Option "YAxisMapping" "4 5"
EndSection

添加后我重新启动了。

在 Ubuntu 18.04 中,这不再起作用。因此,我尝试这样做以查找更多信息:

xinput --list
⎡ Virtual core pointer                      id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ Forward USB Optical Mouse                 id=10   [slave  pointer  (2)]
⎜   ↳ SynPS/2 Synaptics TouchPad                id=15   [slave  pointer  (2)]
⎣ Virtual core keyboard                     id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ↳ Power Button                              id=6    [slave  keyboard (3)]
    ↳ Video Bus                                 id=7    [slave  keyboard (3)]
    ↳ Power Button                              id=8    [slave  keyboard (3)]
    ↳ Sleep Button                              id=9    [slave  keyboard (3)]
    ↳ Chicony USB2.0 Camera: Chicony            id=11   [slave  keyboard (3)]
    ↳ HID 05f3:0007                             id=12   [slave  keyboard (3)]
    ↳ HID 05f3:0007                             id=13   [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard              id=14   [slave  keyboard (3)]

而且输入的名称仍然相同。我也尝试了上述配置 MatchProduct,其全名为“Forward USB Optical Mouse”。

然后我尝试sudo evtest查看该事件:

Event: time 1533888912.632951, -------------- SYN_REPORT ------------
(3)]
    ⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
    ⎜   ↳ Forward USB Optical Mouse                 id=10   [slave  pointer  (2)]
    ⎜   ↳ SynPS/2 Synaptics TouchPad                id=15   [slave  pointer  (2)]
    ⎣ Virtual core keyboard                     id=3    [master keyboard (2)]
        ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
        ↳ Power Button                              id=6    [slave  keyboard (3)]
        ↳ Video Bus                                 id=7    [slave  keyboard (3)]
        ↳ Power Button                              id=8    [slave  Event: time 1533888912.729025, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90003

并从此尝试改变为Option "EmulateWheelButton" "4"

我希望有人知道 Ubuntu 16 和 Ubuntu 18 在 xorg 方面的工作区别,或者可以发现我做错的事情。

答案1

好的,我现在已经设法解决这个问题,因此对于遇到此问题的任何人来说。

xinput列出了我的设备:

⎡ Virtual core pointer                      id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ PixArt USB Optical Mouse                  id=13   [slave  pointer  (2)]
⎜   ↳ SynPS/2 Synaptics TouchPad                id=15   [slave  pointer  (2)]
⎣ Virtual core keyboard                     id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ↳ Power Button                              id=6    [slave  keyboard (3)]
...

然后从那里我可以看到输入的道具:

Device 'PixArt USB Optical 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
    libinput Natural Scrolling Enabled (279):   0
    libinput Natural Scrolling Enabled Default (280):   0
    libinput Scroll Methods Available (281):    0, 0, 1
    libinput Scroll Method Enabled (282):   0, 0, 1
...

这表明 evdev 不再是驱动程序,现在 libinput 是驱动程序。这时我去了https://www.systutorials.com/docs/linux/man/4-libinput/并将 /usr/share/X11/xorg.conf.d/42-middle-mouse-scrolling.conf 中的选项设置为以下内容:

Section "InputClass"
    Identifier "Middle Mouse Button Scrolling"
    MatchProduct "PixArt USB Optical Mouse"
    Option "MiddleEmulation" "on"
    Option "ScrollMethod" "button"
    Option "ScrollButton" "2"
EndSection

重新启动后,我的 3m ergo 鼠标滚动功能再次可用。

相关内容