滑鼠滾輪 3m ergo 滑鼠 Ubuntu 18.04

滑鼠滾輪 3m ergo 滑鼠 Ubuntu 18.04

在 Ubuntu 16.04 中,這對於我的 3m Ergo 滑鼠的 evdev 配置來說效果很好,可以透過按住「中間」按鈕來模擬滾輪。它不再適用於 Ubuntu 18.04。

在 /usr/share/X11/xorg.conf.d/42-middle-mouse-scrolling.conf -rw-r--r-- 1 root root 395 Feb 23 2017 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 滑鼠滾動功能再次起作用。

相關內容