Ubuntu 18.04 Unity点击触摸板无法触发鼠标左键

Ubuntu 18.04 默认情况下,用的是gnome界面。
但是换回Ubuntu后发现单击触摸板没有触发左键,在gnome的时候是没有这个问题的。
这就说明了不是驱动的问题了。

这里主要是xinput配置的问题

  1. 首先用xinput list查看当前的设备信息
    ⎡ Virtual core pointer                      id=2    [master pointer  (3)]
    ⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
    ⎜   ↳ Logitech M515                             id=11   [slave  pointer  (2)]
    ⎜   ↳ DLL06E4:01 06CB:7A13 Touchpad             id=13   [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)]
        ↳ Video Bus                                 id=8    [slave  keyboard (3)]
        ↳ Power Button                              id=9    [slave  keyboard (3)]
        ↳ Sleep Button                              id=10   [slave  keyboard (3)]
        ↳ Integrated_Webcam_HD: Integrate           id=12   [slave  keyboard (3)]
        ↳ Intel HID events                          id=14   [slave  keyboard (3)]
        ↳ Dell WMI hotkeys                          id=15   [slave  keyboard (3)]
        ↳ AT Translated Set 2 keyboard              id=16   [slave  keyboard (3)]
        ↳ Logitech M515                             id=17   [slave  keyboard (3)]
        ↳ FILCO Bluetooth Keyboard                  id=18   [slave  keyboard (3)]
    
    

    找到对应触摸板的设备名DLL06E4:01 06CB:7A13 Touchpad

  2. 获取这个设备的配置信息

    $ sudo xinput list-props "DLL06E4:01 06CB:7A13 Touchpad"
    Device 'DLL06E4:01 06CB:7A13 Touchpad':
        Device Enabled (145):   1
        Coordinate Transformation Matrix (147): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
        libinput Tapping Enabled (298): 0
        libinput Tapping Enabled Default (299): 0
        libinput Tapping Drag Enabled (300):    1
        libinput Tapping Drag Enabled Default (301):    1
        libinput Tapping Drag Lock Enabled (302):   0
        libinput Tapping Drag Lock Enabled Default (303):   0
        libinput Tapping Button Mapping Enabled (304):  1, 0
        libinput Tapping Button Mapping Default (305):  1, 0
        libinput Natural Scrolling Enabled (280):   0
        libinput Natural Scrolling Enabled Default (281):   0
        libinput Disable While Typing Enabled (306):    1
        libinput Disable While Typing Enabled Default (307):    1
        libinput Scroll Methods Available (282):    1, 1, 0
        libinput Scroll Method Enabled (283):   1, 0, 0
        libinput Scroll Method Enabled Default (284):   1, 0, 0
        libinput Click Methods Available (308): 1, 1
        libinput Click Method Enabled (309):    1, 0
        libinput Click Method Enabled Default (310):    1, 0
        libinput Middle Emulation Enabled (287):    0
        libinput Middle Emulation Enabled Default (288):    0
        libinput Accel Speed (289): 0.000000
        libinput Accel Speed Default (290): 0.000000
        libinput Left Handed Enabled (294): 0
        libinput Left Handed Enabled Default (295): 0
        libinput Send Events Modes Available (265): 1, 1
        libinput Send Events Mode Enabled (266):    0, 0
        libinput Send Events Mode Enabled Default (267):    0, 0
        Device Node (268):  "/dev/input/event9"
        Device Product ID (269):    1739, 31251
        libinput Drag Lock Buttons (296):   <no items>
        libinput Horizontal Scroll Enabled (297):   1
    
    

    这里需要注意的是 libinput Tapping Enabled 这个字段,如果为0则无法触发点击左键

  3. 修改配置(临时修改方案)
    执行 xinput set-prop "DLL06E4:01 06CB:7A13 Touchpad" "libinput Tapping Enabled" 1
    执行完即可,不需要重启OS
  4. 修改配置(长期修改方案)
    修改文件 /usr/share/X11/xorg.conf.d/40-libinput.conf, 增加以下的信息
    Section "InputClass"
    Identifier "DLL06E4:01 06CB:7A13 Touchpad"
    MatchProduct "DLL06E4:01 06CB:7A13 Touchpad"
    MatchIsTouchpad "on"
    MatchDevicePath "/dev/input/event*"
    Option "Tapping" "on"
    Driver "libinput"
    EndSection

    修改后重启机器