Difference between revisions of "Touchpad Synaptics (简体中文)"

From ArchWiki
Jump to navigation Jump to search
Line 119: Line 119:
  
 
在每个配置选项的封闭标签'''</match>'''前都必须加入这一行:
 
在每个配置选项的封闭标签'''</match>'''前都必须加入这一行:
 +
<merge key="input.x11_options.RightEdge" type="string">5300</merge>
 +
在'''xorg.conf'''中则是:
 
  Option      "RightEdge"        "5300"
 
  Option      "RightEdge"        "5300"
在'''xorg.conf'''中则是:
 
<merge key="input.x11_options.RightEdge" type="string">5300</merge>
 
 
在此'''.fdi'''文件中。
 
在此'''.fdi'''文件中。
  
Line 135: Line 135:
 
   <merge key="input.x11_options.TapButton3" type="string">3</merge>
 
   <merge key="input.x11_options.TapButton3" type="string">3</merge>
 
  </match>
 
  </match>
 
 
  
 
==高级设置==
 
==高级设置==

Revision as of 08:53, 1 May 2009


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 是一个能驱动绝大多数笔记本触摸板的驱动,本文将指导你根据需要安装和配置这个驱动。

安装

触摸板驱动如今已打包为xf86-input-synaptics,可以从标准的软件包仓库中获取到它:

# pacman -S xf86-input-synaptics

配置

有两种方式可以对触摸板进行配置。你该如何做,这取决于你是否启用Xorg input hotplugging

通过xorg.conf进行配置 (禁用hotplugging)

以root身份编辑/etc/X11/xorg.conf,在ServerLayout里加入InputDevice "Touchpad" "SendCoreEvents",如:

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

Module段加入Load "synaptics",如:

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

最后,为触摸板自身新增一个InputDevice段:

Section "InputDevice"
   Identifier  "SynapticsTouchpad"
   Driver      "synaptics"
   Option      "AlwaysCore"        "true"  # send events to CorePointer
  #Option      "Device"            "/dev/input/mice"
   Option      "Device"            "/dev/psaux"
   Option      "Protocol"          "auto-dev"
   Option      "SHMConfig"         "false" # configurable at runtime? security risk
   Option      "LeftEdge"          "1700"  # x coord left
   Option      "RightEdge"         "5300"  # x coord right
   Option      "TopEdge"           "1700"  # y coord top
   Option      "BottomEdge"        "4200"  # y coord bottom
   Option      "FingerLow"         "25"    # pressure below this level triggers release
   Option      "FingerHigh"        "30"    # pressure above this level triggers touch
   Option      "MaxTapTime"        "180"   # max time in ms for detecting tap
   Option      "VertEdgeScroll"    "true"  # enable vertical scroll zone
   Option      "HorizEdgeScroll"   "true"  # enable horizontal scroll zone
   Option      "CornerCoasting"    "true"  # enable continuous scroll with finger in corner
   Option      "CoastingSpeed"     "0.30"  # corner coasting speed
   Option      "VertScrollDelta"   "100"   # edge-to-edge scroll distance of the vertical scroll
   Option      "HorizScrollDelta"  "100"   # edge-to-edge scroll distance of the horizontal scroll
   Option      "MinSpeed"          "0.10"  # speed factor for low pointer movement
   Option      "MaxSpeed"          "0.60"  # maximum speed factor for fast pointer movement
   Option      "AccelFactor"       "0.0020"    # acceleration factor for normal pointer movements
   Option      "VertTwoFingerScroll"   "true"	# vertical scroll anywhere with two fingers
   Option      "HorizTwoFingerScroll"  "true"	# horizontal scroll anywhere with two fingers
EndSection

粗体标示的行是很重要的,因为用户必须显式启用触摸板的边缘和底部滚动区域。如果你已经有旧触摸板驱动的一个InputDevice段的配置,那么需要正常使用滚动区域的话就得添加这两行。

保存、退出然后重启X。 现在触摸板应该可以正常使用滚动区域了。你还可以进一步根据自己需要调整InputDevice设置。详情可参见 高级设置

要注意的是,Xorg会自动加载触摸板所需的evdevpsmouse核心模块 ,当然如果需要的话你也可以显式的在/etc/rc.conf文件的MODULES列表里加入它们。

ALPS 触摸板

对于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

通过HAL策略(启用hotplugging)

如果你已经选择使用Xorg input hotplugging,那么下次你进入X,应该发现你的触摸板无需特别设置就已经可以工作了。

如果不行的话,或者你需要调整配置,可以删除xorg.conf中相关配置,只保留Load "synaptics"这行。

复制/usr/share/hal/fdi/policy/10osvendor/11-x11-synaptics.fdi到/etc/hal/fdi/policy/进行编辑。

此文件包含以下内容:

<match key="info.product" contains="Synaptics TouchPad">
 <merge key="input.x11_driver" type="string">synaptics</merge>
</match>

在每个配置选项的封闭标签</match>前都必须加入这一行:

<merge key="input.x11_options.RightEdge" type="string">5300</merge>

xorg.conf中则是:

Option      "RightEdge"         "5300"

在此.fdi文件中。

以下是一个示范的<match>段,它激活了大部分所需特性:

<match key="info.product" contains="Synaptics TouchPad">
  <merge key="input.x11_driver" type="string">synaptics</merge>
  <merge key="input.x11_options.AlwaysCore" type="string">true</merge>
  <merge key="input.x11_options.VertEdgeScroll" type="string">true</merge>
  <merge key="input.x11_options.HorizEdgeScroll" type="string">true</merge>
  <merge key="input.x11_options.TapButton1" type="string">1</merge>
  <merge key="input.x11_options.TapButton2" type="string">2</merge>
  <merge key="input.x11_options.TapButton3" type="string">3</merge>
</match>

高级设置

Input device选项

synaptics驱动提供许多可以自由定制的选项,下面的列表描述了这些选项,详情可使用man synaptics命令查看。

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

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

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 must be enabled in order to monitor or configure your synaptics device with a client such as synclient, which is discussed below. Shared memory is also required if you want to use udev rules to disable the touchpad automatically when external mouse is plugged in (see the relevant section below).

Gsynaptics

如果synaptics驱动已经安装,gnome用户可以安装gsynaptics以使用基于GUI的控制面板:

# pacman -S gsynaptics

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

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

用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,那么说明你的硬件不支持这个选项。

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

实现滚动功能

要启用触摸板边缘的滚动区域,需增加以下一个或两个选项到/etc/X11/xorg.conf的触摸板设备段:

Section "InputDevice"
        ...
      Option "VertEdgeScroll" "true"         #vertical scrolling when dragging along the right edge.
      Option "HorizEdgeScroll" "true"        #horizontal scrolling when dragging along the bottom edge.
        ...
EndSection

Hotplugging/etc/hal/fdi/policy/11-x11-synaptics.fdi中 :

 <match key="info.product" contains="Synaptics TouchPad">
   ...
   <merge key="input.x11_options.HorizEdgeScroll" type="string">1</merge>
   <merge key="input.x11_options.VertEdgeScroll" type="string">1</merge>
   ...
 </match>

两点触摸滚动

最近的synaptics驱动支持触摸板两个手指来控制滚动。这和Macbook上类似,你可以在触摸板上任何地方同时使用两根手指。

如果你确认你的触摸板支持这个功能,可以添加如下两行到/etc/X11/xorg.conf的触摸板的设置里面去:

Section "InputDevice"
        ...
      Option      "VertTwoFingerScroll"   "true"	# vertical scroll anywhere with two fingers
      Option      "HorizTwoFingerScroll"  "true"	# horizontal scroll anywhere with two fingers
      Option      "EmulateTwoFingerMinZ"  "120" 	# this may vary between different machines
        ...
EndSection

EmulateTwoFingerMinZ 不是每台机器都需要的,它可以用于几款使用Alps触摸板的Dell机器上。 ([| from Ubuntu forums ]

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

Hotplugging/etc/hal/fdi/policy/11-x11-synaptics.fdi中:

 <match key="info.product" contains="Synaptics TouchPad">
   ...
   <merge key="input.x11_options.VertTwoFingerScroll" type="string">1</merge>
   <merge key="input.x11_options.HorizTwoFingerScroll" type="string">1</merge>
   <merge key="input.x11_options.EmulateTwoFingerMinZ" type="string">120</merge>
   ...
 </match>

环状滚动(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的值比较有帮助。如果你这样做,那么滚动将从你决定的地方开始。

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

插入鼠标禁用触摸板

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触摸板不行。如果触摸板上放有两根手指,驱动将会虚拟一个中键点击,如果触摸板上有三个手指点击,就会虚拟一个右键点击。

提示与技巧

插入鼠标禁用触摸板

udev的帮助下,可以实现自动在外部鼠标插入时禁用触摸板。你需要做的是在/etc/udev/rules.d/01-touchpad.rules里加入以下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"

共享内存(SHMConfig)必须已被启用。(详情参看 Configuration)

解决问题

我的触摸板硬件位置不在/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]