Touchpad Synaptics (简体中文)

From ArchWiki
Jump to navigation Jump to search


Template:I18n links start Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n links end

Tango-preferences-desktop-locale.pngThis article or section needs to be translated.Tango-preferences-desktop-locale.png

Notes: please use the first argument of the template to provide more detailed indications. (Discuss in Talk:Touchpad Synaptics (简体中文)#)

简介

synaptics 是一个能驱动绝大多数笔记本触摸板的驱动,本文将指导你根据需要安装和配置这个驱动。

安装

Xorg7.4用户安装

开启testing仓库,更新了本地数据库之后,就可以通过运行如下命令安装了

# pacman -S xf86-input-synaptics

因为新的Xorg 7.4自动识别设备能力很强大,因此对于多数人来说,不需要xorg.conf,X也能很正常的工作,因此默认触摸板就可以使用了。如果发现触摸板无法使用,再仿照下面7.3的配置安装,当然前提是你需要有xorg.conf,具体请看Xorg

旧的Xorg 7.3安装

你可以通过pacman从extra仓库安装synaptics

# pacman -S synaptics

以root身份编辑/etc/X11/xorg.conf,添加InputDevice "Touchpad" "SendCoreEvents"ServerLayout这一节:

Section "ServerLayout"
	...
	InputDevice    "USB Mouse" "CorePointer"
	InputDevice    "Touchpad"  "SendCoreEvents"
EndSection

添加 Load "synaptics"Module 这一节, 例如:

Section "Module"
	...
	Load  "freetype"
	Load  "record"
	Load "synaptics"
	...
EndSection

最后,为触摸板添加一个新的InputDevice章节:

Section "InputDevice"
	Identifier      "Touchpad"
       Driver          "synaptics"
       Option  "Device"        "/dev/input/mouse0"
	Option  "Protocol"      "auto-dev"
	Option  "LeftEdge"      "1700"
	Option  "RightEdge"     "5300"
	Option  "TopEdge"       "1700"
	Option  "BottomEdge"    "4200"
	Option  "FingerLow"     "25"
	Option  "FingerHigh"    "30"
	Option  "MaxTapTime"    "180"
	Option  "MaxTapMove"    "220"
	Option  "VertScrollDelta" "100"
	Option  "MinSpeed"      "0.06"
	Option  "MaxSpeed"      "0.12"
	Option  "AccelFactor" "0.0010"
	Option  "SHMConfig"     "on"
EndSection

对ALPS触摸板: 如果上面配置没有效果,请尝试下面的配置:

Section "InputDevice"
       Identifier  "Touchpad"
	Driver  "synaptics"
	Option  "Device"   "/dev/input/mouse0"
	Option  "Protocol"   "auto-dev"
	Option  "LeftEdge"   "130"
	Option  "RightEdge"   "840"
	Option  "TopEdge"   "130"
	Option  "BottomEdge"   "640"
	Option  "FingerLow"   "7"
	Option  "FingerHigh"   "8"
	Option  "MaxTapTime"   "180"
	Option  "MaxTapMove"   "110"
	Option  "EmulateMidButtonTime"   "75"
	Option  "VertScrollDelta"   "20"
	Option  "HorizScrollDelta"   "20"
	Option  "MinSpeed"   "0.25"
	Option  "MaxSpeed"   "0.50"
	Option  "AccelFactor"   "0.010"
	Option  "EdgeMotionMinSpeed"   "200"
	Option  "EdgeMotionMaxSpeed"   "200"
	Option  "UpDownScrolling"   "1"
	Option  "CircularScrolling"   "1"
	Option  "CircScrollDelta"   "0.1"
	Option  "CircScrollTrigger"   "2"
	Option  "SHMConfig"   "on"
	Option  "Emulate3Buttons"   "on"
EndSection

保存,退出,重启X服务,触摸板应该可以使用了。你可以更详细的配置输入设备(InputDevice),需要更多请看 高级设置

请注意Xorg将自动加载evdevpsmouse 内核模块,因为synaptics需要他们,因此你可以把这两个模块加入/etc/rc.conf文件里面。

MODULES=( ... evdev psmouse ... )

使用GUI图形程序配置

Gsynaptics

如果synaptics驱动已经安装,gnome用户可以安装使用gsynaptics:

# pacman -S gsynaptics

想自动保存和加载gsynaptics配置,在自启动程序里面加入gsnynaptics-init:System -> Preferences -> Sessions

注意: 如果不是gnome用户也可以向.xinitrc或者.xsession脚本里面加入gsnynaptics-init

高级设置

synaptics 驱动提供许多可以自由定制的选项,下面的列表描述了这些选项,可以加入xorg配置文件中。

Identifier is the name of this input device you've specified in the server layout section above.

Device defines where your synaptic device is located. See Troubleshooting to find your device handler if it isn't /dev/input/mouse0 for you.

LeftEdge, RightEdge, TopEdge and BottomEdge are integer values which indicate the dimensions of your touchpad as x or y coordinates.

FingerLow and FingerHigh are integer values which indicate the 'pressure value' at which the driver counts a touch (pressure value goes above FingerHigh) or a release (pressure value drops below FingerLow).

MaxTapTime is an integer value that defines the maximum time for detecting a tap (in milliseconds).

MaxTapMove is an integer value which defines the maximum movement of your finger for detecting a tap.

MinSpeed and MaxSpeed are set to determine the minimum and maximum speed factor. An floating point value is expected. VertScrollDelta

AccelFactor is the acceleration factor as well defined as a floating point value.

VertScrollDelta and HorizScrollDelta is an integer value defining scrolling speed. Smaller values result in faster scrolling.

SHMConfig is a boolean value (on/off) for activating or deactivating shared memory. This needs to be enabled if you want to monitor or configure your synaptics device with clients as synclient, which will be using in this article.

More options are explained in the synaptics' manpage, accessible with:

man 5 synaptics

用synclient调整

synclient监视器可以实时显示触摸板上的压力和位置,允许更详细调整默认synaptics的设置。为了让synclient能工作,SHMConfig选项必须是on或者true

你可以用下面命令启动synaptics监视:

$ synclient -m 100

Where -m activates the monitor and the following number specifies the update interval in milliseconds.

这个监视器提供你触摸板现在状态信息,例如,如果你用触摸板移动鼠标,监视器中x和y值就会改变。此外,你可以非常容易知道触摸板LeftEdge-, RightEdge-, BottomEdge-和TopEdge-Options的测量值。

下面是缩写的解释:

time

Time in seconds since the logging was started.

x, y

The x/y coordinates of the finger on the touchpad. The origin is in the upper left corner.

z

The pressure value. It represents the pressure you are using to navigate on your touchpad.

f

Number of fingers currently touching the touchpad.

w

Value that represents the finger width.

l,r,u,d,m,multi

Those values represent the state of the left, right, up, down, middle and multi buttons pressed where zero means not pressed and one means pressed.

gl,gm,gr

For touchpads which have a guest device, this are the associated button states for guest left, guest middle and guest right pressed (1) and not pressed (0).

gdx, gdy

x/y coordinates of the guest device.

如果值一直是0,那么说明你的硬件不支持这个选项。

了解这些,你应该能知道需要的数据了。

实现滚动功能

对于xorg7.3用户来说,按照上面设置了之后就有普通的边缘滚动功能。但是Xorg 7.4会默认启用两点触摸滚动,如果你不喜欢,请按照你的需要设置:

普通边缘滚动

就是一般触摸板能够见到的,手指在触摸板右边边界处上下滑动,能够起到鼠标滚轮上下滚动的效果。下面边界处也是类似。需要启用这项功能,就向你的触摸板设置里面添加:

Section "InputDevice"
        ...
        Option "VertEdgeScroll" "boolean"	#垂直方向滚动
        Option "HorizEdgeScroll" "boolean"	#水平方向滚动
        Option "CornerCoasting"  "boolean"	#如果手指滑动到最边界是否屏幕继续滚动
        ...
EndSection

注意:其中boolean处可以是ture或者false,对应启用和不启用。

环状滚动(Circular scrolling)

环状滚动是synaptics提供的一项功能,你可能从iPod上知道了这样的功能。你可以使用画圈来代替或者代替垂直和水平滚动。 你可以向触摸板输入设备这一节中添加如下来启动环状滚动:

Section "InputDevice"
        ...
        Option      "CircularScrolling"          "on"
        Option      "CircScrollTrigger"          "0"
        ...
EndSection

你可能猜到CircularScrolling控制启用和禁用环状滚动。CircScrollTrigger则可能是如下任意一个值,确定环形滚动启动的边缘。

0    All Edges
1    Top Edge
2    Top Right Corner
3    Right Edge
4    Bottom Right Corner
5    Bottom Edge
6    Bottom Left Corner
7    Left Edge
8    Top Left Corner

如果你同时使用垂直或者水平滚动,那么设置不是0的值比较有帮助。如果你这样做,那么滚动将从你决定的地方开始。

如果想滚动快点,就在触摸板上画小圈,否则就画大圈。

两点触摸滚动

最近的synaptics驱动支持触摸板两个手指来控制滚动,替代了以前只能在触摸板边上定义滚动区域。你可能在使用Macbook上的MAC OSX见过这样的方式。

确认你的触摸板支持这个功能(确认应该很困难,所以不如直接尝试一下),添加如下两行到你的synaptic触摸板的设置里面去:

Option   "VertTwoFingerScroll"   "1"
Option   "HorizTwoFingerScroll"  "1"

重新启动X后你就可以让你的触摸板像一般边缘控制滚动一样,能够用两只手指控制滚动了。

对于Firefox用户: 你可能发现默认的Firefox习惯相当的讨厌,那么请看下面的Firefox和特殊触摸板事件怎么禁用这功能。

插入鼠标禁用触摸板

udev的帮助下,可以实现自动在外部鼠标插入时禁用触摸板。你需要做的是在udev的规则里面添加:

ACTION=="add", SUBSYSTEM=="input", ID_CLASS="mouse", RUN+="/usr/bin/synclient TouchpadOff=1"
ACTION=="remove", SUBSYSTEM=="input", ID_CLASS="mouse", RUN+="/usr/bin/synclient TouchpadOff=0"

把上面内容保存到/etc/udev/rules.d/01-touchpad.rules,而且确保共享内存(SHMConfig)打开。

其他功能

默认触摸板能识别放在触摸板上的手指数目,但ALPS触摸板不行。如果触摸板上放有两根手指,驱动将会虚拟一个中键点击,如果触摸板上有三个手指点击,就会虚拟一个右键点击。

解决问题

我的触摸板硬件位置不在/dev/input/mouse0

如果这是问题的原因,你可以使用下面的命令来了解你输入设备的信息。

cat /proc/bus/input/devices

搜索名称为"SynPS/2 Synaptics TouchPad"的章节的输入设备。通过这一节的handlers就可以了解xorg.conf中需要使用的硬件。

Example output:

I: Bus=0011 Vendor=0002 Product=0007 Version=0000
N: Name="SynPS/2 Synaptics TouchPad"
P: Phys=isa0060/serio4/input0
S: Sysfs=/class/input/input1
H: Handlers=mouse0 event1 
B: EV=b
B: KEY=6420 0 7000f 0

如果Handlers是mouse0和event1,就使用/dev/input/mouse0的位置。

在键盘输入停止触摸板点击

这是一个简单的小技巧,你可以使触摸板在键盘输入的时候禁用,步骤很简单。加入如下命令到.xinitrc,在启动窗口管理器命令的前面。

syndaemon -i 2 &

-i 2设置停止时间为2秒。停止时间即在键盘输入之后多少秒后重新启用触摸板

另外,你可以使用-t来不阻止触摸板鼠标移动,仅仅禁止点击或者滚动。

syndaemon -t -i 2 &

和其他命令一样,你可以通过man来了解更多应用:

$ man syndaemon

Firefox和特殊触摸板事件

尽管这些问题不是由驱动引起,但是仍然需要解决。

默认的,firefox会设置触摸板上特殊区域完成特殊功能。你可以在地址栏输入about:config设置这些功能。编辑就是双击这些行,让true编程false,如果是数值你就必须手动改变了。

如果想让firefox不从滚动历史记录,而让它在网页滚动,你可以在about:config里面改变下面两个选项。

mousewheel.horizscroll.withnokey.action = 1
mousewheel.horizscroll.withnokey.sysnumlines = true

如果不想firefox当你点击触摸板右上(或者鼠标中键)把剪切板里面内容粘贴到地址栏并且打开,你需要设置如下内容为false:

middlemouse.contentLoadURL = false

Opera误解水平滚动

就像上面提到的一样。 修复这个问题,你需要点击工具 -> 首选项 -> 高级 -> 快捷键。在这里设置鼠标属性:删除"Button 5" 和 "Button 6"的定义

在LG笔记本上的滚动和多功能

这些问题可能出现在多种型号的LG笔记本上。 Symptoms are that when pressing Mouse Button 1 synaptics interpretes it as ScrollUP and a regular button 1 click, same goes for button 2.

The scrolling can be solved by entering in xorg.conf:

Option "UpDownScrolling" "0"

This however will make synaptics interprete one button push as three. There is a patch written by Oskar Sandberg, found at http://www.math.chalmers.se/~ossa/linux/lg_tx_express.html , that removes these clicks.

However when trying to compile this with the latest version of synaptics it fails. The solution to this is using the GIT repository for synaptics. It can be found at http://web.telia.com/~u89404340/touchpad/synaptics/.git .

There is also a package build file in the archlinux user repository to automate this, http://aur.archlinux.org/packages.php?ID=15983.

Instructions on how to build this package, after downloading the tarball and unpacking it:

cd synaptics-git
makepkg 

If you want it to be automatically installed after it has build just add '-i' after makepkg.

一直不能让外接USB鼠标工作?

首先,你需要确定你的外部鼠标描述设置里面包含(或者类似)这一行:

Option	    "Device" "/dev/input/mice"

如果"Device"行不一样,改成如上的,并且重新启动X。如果没有解决,修改"Server Layout"设置,将touchpad设置成 CorePointer:

InputDevice    "Touchpad" "CorePointer"

然后设置你的外接鼠标为"SendCoreEvents":

InputDevice    "USB Mouse" "SendCoreEvents"

最后,你需要添加这个到你的外接鼠标设置里面去:

Option      "SendCoreEvents"    "true"

如果还是不行,说不定是鼠标硬件有问题。请检查是不是bug,或者查看论坛,看是否有人有更好的解决方法。

Touchpad loses synchronization

Sometimes the cursor may freeze for several seconds or start acting on its own for no apparent reason. This is accompanied by similar records in /var/log/messages.log

 psmouse.c: TouchPad at isa0060/serio1/input0 lost synchronization, throwing 3 bytes away

This problem has no general solution, but you may try several possible workarounds.

  • If you use cpu frequency scaling, try not using "ondemand" governor and use "performance" governor when possible, since touchpad may lose sync when cpu frequency changes.
  • Try not using acpi battery monitor.
  • Try to load psmouse with "proto=imps" option. To do that, add this line to your /etc/modprobe.conf
options psmouse proto=imps
  • Try another desktop environment. Some users report, that this problem only occurs when using Xfce or Gnome and newer occurs under KDE.
  • If your touchpad loses sync not only under Linux, but under Windows too, this may be a hardware issue. So, you may need to replace the touchpad itself.

我的触摸板不能点击,只能通过触摸板下方或者上方按钮实现

xorg7.4默认是没有启用这项功能的。你可以通过修改你定义的xorg.conf里面触摸板部分:

Section "InputDevice"
       ...
       Option "TapButton1" "integer"  #当你一个手指点击时候效果,一般是1,也就是左键
       Option "TapButton2" "integer"  #2个手指点击效果,一般是2,也就是鼠标中键
       Option "TapButton3" "integer"  #3个手指点击效果,一般是3,也就是鼠标右键
       ...

EndSection 现在,linux下触摸板是不是功能很强大呢?

SynPS/2 Synaptics TouchPad can't grab event device, errno=16

如果你使用Xorg 7.4,查看Xorg日志(/var/log/Xorg.0.log)时候可能会发现有这么一条警告信息。这是因为当使用linux2.6事件协议,驱动默认会试图独占此设备。失败就会出现此条提示。也就是说其他无论是内核空间还是用户空间的程序都无法获取此设备上的信号。当你的xorg.conf里面还定义了一个/dev/misc输入设备时候,这点很有用。但是如果你想测试设备的信号,那么就很麻烦了。

开启和关闭这项功能,可以修改你定义的xorg.conf的触摸板部分:

Section "InputDevice"

       ...
       Option "GrabEventDevice" "boolean"
       ...

EndSection

boolean部分可以是yes或者false,分别代表启用和禁止此功能。

当然你也可以使用synclient来调整,不过不能马上生效,只有触摸板驱动被禁用然后重新启用才能有效果。你可以通过切换到控制台然后切换回来实现。

链接

Synaptics为XOrg/XFree86的触摸板驱动 : [1]