在将暗影精灵6的ubuntu系统、无线网卡驱动显卡驱动 安装完毕之后,触摸板驱动研究了一段时间才得以解决。
1. 问题原因
- 没有打开或使能触摸板;
- 没有安装驱动;
- 有驱动,没有关联驱动和硬件,及参数设置不对,而暗影精灵6就是这种原因。
2. 解决方案
2.1 针对第一种
- 直接使用键盘组合键打开无线网卡,但需要注意有时候需要多试几次,不同笔记本的组合键不同,暗影精灵6为“Fn+F11”(上面绘制有禁止触摸板的图案,灯亮代表关闭);
- 使用xinput指令对触摸板模块属性进行设置,设置方法可以参考wqli的博客;
- 使用第三方软件进行设置,如Touchpad-indicator,设置方法可参考linuxdog2的博客和上面wqli的博客;
- 重新添加内核中的触摸板模块,可以参考上面wqli和小驰笔记关于这个问题的描述。
2.2 针对第二种
需要安装对应触摸板型号的驱动,触摸板型号可以从Windows系统设备管理器获知,暗影精灵6的触摸板为“Synaptics PrecisionTouchpad Filter Driver”(如下图所示)。
然后安装驱动,CTRL+ALT+T打开终端运行如下指令。
sudo apt-get install xserver-xorg-input-libinput
sudo apt-get install xserver-xorg-input-evdev
sudo apt-get install xserver-xorg-input-mouse
sudo apt-get install xserver-xorg-input-synaptics
2.3 针对第三种
绑定驱动和硬件,此方案对暗影精灵6有效,终端中运行如下指令:
sudo vi /etc/default/grub #使用vi打开rub,若不会使用vi可以将指令改为“sudo vi /etc/default/grub”
#把GRUB_CMDLINE_LINUX="" 改为GRUB_CMDLINE_LINUX="i8042.reset i8042.nomux i8042.nopnp i8042.noloop"
sudo update-grub #更新grub
sudo reboot #重启系统
之后在终端中输入如下指令
xinput --list #列出输入设备列表
结果你就会发现多了一个“SynPS/2 Synaptics TouchPad”,此为我们的触摸板驱动
OMEN:~$ xinput --list
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ Logitech Wireless Mouse id=9 [slave pointer (2)]
⎜ ↳ SynPS/2 Synaptics TouchPad id=12 [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)]
↳ HP Wide Vision HD Camera: HP Wi id=10 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=11 [slave keyboard (3)]
↳ HP WMI hotkeys id=13 [slave keyboard (3)]
此时,你会发现触摸板单指鼠标移动和双指滚动网页已经可以使用,但存在如下问题:
- 触摸板轻触单指左键、双指右键无效;
- 按压触摸板左、右键无效。
结下来讲述如何修复上述问题,(在此之前,对此方法的原理进行讨论一下,就其更改内容可以大致判断此方案为绑定驱动和硬件,并没有安装新的驱动,之所以此方案有效原因可能有:1. 系统自带此触摸板驱动,2.在笔者尝试解决上一问题的方法过程中安装好了驱动。具体原因还请读者验证并告知)。
3. 修复功能缺失
解决这一问题的思路即位对触摸板参数进行认为配置,也就是说上述问题,实际上为触摸板配置参数配置不对。方法有两种:
- 使用xinput命令行工具,针对运行时(runtime)进行实时配置,主要用来调试;
- 使用配置文件的永久配置方式。
首先讲述第一种方法
3.1 xinput方法
xinput list-props "SynPS/2 Synaptics TouchPad" #查看触摸板驱动,其中引号里面的“xinput --list”输出的触摸板型号
打印如下:
OMEN:~$ xinput list-props "SynPS/2 Synaptics TouchPad"
Device 'SynPS/2 Synaptics TouchPad':
Device Enabled (155): 1
Coordinate Transformation Matrix (157): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
libinput Tapping Enabled (307): 0 # 触摸板点击使能
libinput Tapping Enabled Default (308): 0 # 触摸板点击默认状态
libinput Tapping Drag Enabled (309): 1
libinput Tapping Drag Enabled Default (310): 1
# 中间部分省略……
Device Node (277): "/dev/input/event8"
Device Product ID (278): 2, 7
libinput Drag Lock Buttons (306): <no items>
libinput Horizonal Scroll Enabled (279): 1
结下来将“libinput Tapping Enabled” 触摸板点击使能
xinput set-prop "SynPS/2 Synaptics TouchPad" "libinput Tapping Enabled" 1
#指令用法:xinput为指令,set-prop为设置其属性,设置硬件为"SynPS/2 Synaptics TouchPad",设置该硬件的属性"libinput Tapping Enabled"为1(只能是1或0,bool值)
此时点击触摸板已经有效,问题1解决。但是当你重启电脑,你会发现又会失灵,原因为“libinput Tapping Enabled Default (308): 0” # 触摸板点击默认状态没有更改。按照上一命令格式对该属性进行修改,结果打印如下
OMEN:~$ xinput set-prop "SynPS/2 Synaptics TouchPad" "libinput Tapping Enabled Default" 1
X Error of failed request: BadAccess (attempt to access private resource denied)
Major opcode of failed request: 131 (XInputExtension)
Minor opcode of failed request: 57 ()
Serial number of failed request: 20
Current serial number in output stream: 21
无法修改,报错被拒绝(网上很多人也遇到同样的问题1 2 3 4 5 6,但并没有直接解决这个问题的方法)。此路不通,另寻他法。结下来就需要使用第二种解决方法。
3.2 修改配置文件
运行如下指令
sudo gpasswd -a $USER input #给当前用户访问触控板的权限
sudo apt-get install libinput-tools #安装依赖库,可能上面安装驱动的时候已经安装
cd /usr/share/X11/xorg.conf.d/ && ls #进入libinput配置文件目录并列出
打印如下,如何你安装多个驱动,会存在多个文件(参考weixin_34342992的博客)
10-amdgpu.conf 11-evdev-trackpoint.conf 51-synaptics-quirks.conf
10-evdev.conf 50-synaptics.conf 90-libinput.conf
10-quirks.conf 50-vmmouse.conf nvidia-drm-outputclass.conf
11-evdev-quirks.conf 50-wacom.conf
这里有很多配置文件,默认情况下,会根据文件前缀数字的大小决定优先使用哪个配置文件,数字越大,优先级越高,这里我们编辑“90-libinput.conf”。
sudo cp /usr/share/X11/xorg.conf.d/90-libinput.conf /etc/X11/xorg.conf.d/90-libinput.conf #将该配置文件考出,用于自定义设置(其实在原文件上设置也可以)
cd /etc/X11/xorg.conf.d/
sudo gedit 90-libinput.conf
找到Identifier "libinput touchpad catchall"的那一部分,在Driver "libinput"和EndSection之间插内容,结果如下
Section "InputClass"
Identifier "libinput touchpad catchall"
MatchIsTouchpad "on"
MatchDevicePath "/dev/input/event*"
Driver "libinput"
Option "Tapping" "on"
Option "TappingDrag" "on"
Option "TappingDragLock" "on"
Option "AccelSpeed" "0.5"
Option "DisableWhileTyping" "on"
Option "ClickMethod" "clickfinger"
Option "ButtonMapping" "1 2 3 4 5 6 7 8 9 10 11"
Option "TappingButtonMap" "lrm"
EndSection
保存并退出,重启电脑,正常情况问题1已经完美解决。
上述插入内容可参考官方解释,但是**“ButtonMapping”**字段笔者没有很好的理解,估计该设置将和问题2的解决有关,但是问题2依然没有解决。
https://askubuntu.com/questions/917237/how-to-change-default-xinput-values ↩︎
https://www.linuxquestions.org/questions/linux-newbie-8/how-to-save-xinput-touchpad-configuration-libinput-left-handed-enabled-permanently-4175619714/ ↩︎
https://askubuntu.com/questions/975246/xinput-set-prop-worked-in-17-04-but-results-in-error-in-17-10 ↩︎
https://askubuntu.com/questions/1192638/touchpad-using-libinput-instead-of-synaptics-driver ↩︎
https://bugzilla.redhat.com/show_bug.cgi?id=1485644 ↩︎
https://forum.manjaro.org/t/xinput-set-prop-11-276-1-x-error-of-failed-request-badaccess-attempt-to-access-private-resource-denied/40287/22 ↩︎