个人工具

“Synaptics触摸板指南”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
Apple ibook G4
(已恢复1.202.40.80对话)的编辑至123.6.166.214的最后一个修订版本)
 
第317行: 第317行:
 
Option "SHMConfig" "on"
 
Option "SHMConfig" "on"
 
EndSection</pre>
 
EndSection</pre>
==参考资料==
 
 
[http://www.2quanxun.com VIM][http://www.xtutu.com OpenVZ][http://www.weiluoka.com XEN][http://www.anywayanyday.net BurstNet][http://www.transphone.cc Redhat][http://www.imessage.cc CentOS][http://www.onstar.cc lighttpd][http://www.ideapad.cc LVS][http://www.touchpad.cc DSN][http://www.taobaoguanwang.com XEN][http://www.7j7k.com ZEN][http://www.wanglidanni.com Maths][http://www.mashengxi.com SIS][http://www.gourideqq.com TUO][http://www.xiaogege.com AVS][http://www.iipian.com MOQ][http://www.girlfriendvid.net LQP][http://cnzynga.com RIA][http://www.aiaipian.com AIAI]
 
 
 
 
[[Category:硬件]]
 
[[Category:硬件]]

2013年3月23日 (六) 16:33的最新版本

致新手

笔记本电脑上,使用触摸版作为内建鼠标。注意,“Synaptics触摸板”应当与“Synaptic”(Ubuntu的包管理器,即apt-get的图形化用户界面形式)加以区分。

在Breezy (5.10)中,笔记本电脑的触摸板应该立即可用。打开一个终端用grep查看您的/etc/X11/xorg.conf文件:

grep Id /etc/X11/xorg.conf

如果其中有一行:

        Identifier        "Synaptics Touchpad"

那么,就说明您正在使用一个Synaptics触摸板。

在Dapper flight 7 (6.06)中synaptics触摸板好像会被认成一个摄像头之类的设备,所以触摸板的滚轮功能可能不可用。查看“编辑您的xorg.conf文件以包含Synaptics触摸板驱动”来获取滚轮支持。

qsynaptics(或者KDE中的ksynaptics)是一个允许您设置您的触摸板的图形化用户界面程序。要安装该程序,请在终端中键入:

sudo apt-get install qsynaptics

或者:

sudo apt-get install ksynaptics

您可能需要在每次启动X的时候运行qsynaptics -r。请到“系统>首选项>会话>启动程序”中添加。

在Intrepid(8.10)中,系统使用了不同于xorg.conf的设置来控制触摸板,请直接看下面关于Intrepid(8.10)的设置。

Intrepid:修改HAL以提供对Synaptics触摸板支持

Ubuntu 8.10中新的Xserver改成了通过HAL来修改设置,而之前都是的xorg.conf文件来修改。

有些笔记本(如Dell)在安装Ubuntu 8.10后,触摸板无法正常工作。

以下操作应该是可行的,fdi文件内容我是根据Dell笔记本的内容改的,去掉了一些参数设置,并未做测试。如果其他品牌笔记本使用下面的fdi文件不行,请直接使用Dell的,应该也不会有区别。

为了修改触摸板配置需要在HAL新建并编辑一个fdi文件:

gksudo gedit /etc/hal/fdi/policy/touchpad.fdi

再将下面的代码完全放进去,并保存:

<?xml version="1.0" encoding="ISO-8859-1"?> 
<deviceinfo version="0.2"> 
 <device> 
  <match key="input.x11_driver" string="synaptics"> 
   <merge key="input.x11_options.SHMConfig" type="string">true</merge> 
  </match> 
 </device> 
</deviceinfo>

然后重启下HAL:

sudo /etc/init.d/hal restart

最后重启一下Xserver(通过同时按键 Ctrl+ALT+Backspace)。

若要使用快捷键开启、关闭触摸板,请看后面相关小节的内容。

Dell笔记本触摸板设置

Dell的笔记本支持边缘滑动触发滚动条功能,可以进行更多一些的设置。

下面操作在Dell XPS M1530中通过。和前面相比只有第一步新建fdi文件有不同,内容比较丰富。

第一步 添加触摸板支持

先新建并编辑HAL里的fdi文件:

gksudo gedit /etc/hal/fdi/policy/xps-touchpad.fdi

再将下面的代码完全放进去,并保存

<?xml version="1.0" encoding="ISO-8859-1"?>
<deviceinfo version="0.2">
<device>
<match key="input.x11_driver" string="synaptics">
<merge key="input.x11_options.LeftEdge" type="string">120</merge>
<merge key="input.x11_options.RightEdge" type="string">830</merge>
<merge key="input.x11_options.TopEdge" type="string">120</merge>
<merge key="input.x11_options.BottomEdge" type="string">650</merge>
<merge key="input.x11_options.FingerLow" type="string">14</merge>
<merge key="input.x11_options.FingerHigh" type="string">15</merge>
<merge key="input.x11_options.MaxTapTime" type="string">180</merge>
<merge key="input.x11_options.MaxTapMove" type="string">110</merge>
<merge key="input.x11_options.ClickTime" type="string">0</merge>
<merge key="input.x11_options.EmulateMidButtonTime" type="string">75</merge>
<merge key="input.x11_options.VertScrollDelta" type="string">10</merge>
<merge key="input.x11_options.HorizScrollDelta" type="string">0</merge>
<merge key="input.x11_options.MinSpeed" type="string">0.45</merge>
<merge key="input.x11_options.MaxSpeed" type="string">0.95</merge>
<merge key="input.x11_options.AccelFactor" type="string">0.06</merge>
<merge key="input.x11_options.EdgeMotionMinSpeed" type="string">200</merge>
<merge key="input.x11_options.EdgeMotionMaxSpeed" type="string">200</merge>
<merge key="input.x11_options.UpDownScrolling" type="string">1</merge>
<merge key="input.x11_options.CircularScrolling" type="string">0</merge>
<merge key="input.x11_options.SHMConfig" type="string">true</merge>
</match>
</device>
</deviceinfo> 

然后重启下hal

sudo /etc/init.d/hal restart

最后重启一下Xserver(通过同时按键 Ctrl+ALT+Backspace)。

第二步 修改Grub。

Dell的笔记本还有个问题要解决,就是即使进行上面设置仍然没有开启触摸板,需要再修改一下Grub启动项内容才行。

首先编辑/boot/grub/menu.lst

gksu gedit /boot/grub/menu.lst

在其中你需要的每一个内核版本的启动项后加一条 i8042.nomux=1。例如一个启动项样子是这样的:

title Ubuntu 8.10, kernel 2.6.27-8-generic
uuid f8aefb46-d3fb-4425-9ea2-017073e2d87c
kernel /boot/vmlinuz-2.6.27-8-generic root=UUID=f8aefb46-d3fb-4425-9ea2-017073e2d87c ro locale=zh_CN quiet splash
initrd /boot/initrd.img-2.6.27-8-generic
quiet

将其kernel行最后加上 i8042.nomux=1 即可,最后kernel行应形如:

kernel /boot/vmlinuz-2.6.27-8-generic root=UUID=f8aefb46-d3fb-4425-9ea2-017073e2d87c ro locale=zh_CN quiet splash '''i8042.nomux=1'''

更新一下这个修改过的Grub

sudo update-grub

这样改过之后,重启系统,触摸板应该就是没有问题了。而且,还能支持Dell的边界滚动条功能。

Dapper:编辑您的xorg.conf文件以包含Synaptics触摸板驱动

为了获取滚轮支持,您可能需要编辑您的xorg.conf文件。请在终端中键入sudo gedit /etc/X11/xorg.conf。在如下内容之后:

Section "InputDevice"
        Identifier        "Configured Mouse"
        Driver                "mouse"
        Option                "CorePointer"
        Option                "Device"                "/dev/input/mice"
        Option                "Protocol"                "ExplorerPS/2"
        Option                "ZAxisMapping"                "4 5"
        Option                "Emulate3Buttons"        "true"
EndSection

添加如下内容:

Section "InputDevice"
        Identifier        "Synaptics Touchpad"
        Driver                "synaptics"
        Option                "SendCoreEvents"        "true"
        Option                "Device"                "/dev/psaux"
        Option                "Protocol"                "auto-dev"
        Option                "HorizScrollDelta"        "0"
        Option              "SHMConfig"                 "on"
EndSection

there are also a bunch of lines about a wacom tablet, I have commented them out, I am not sure if that is a necessary step. -原作者brallan注

接下来,向下寻找如下内容:

Section "ServerLayout"
        Identifier        "Default Layout"
        Screen                "Default Screen"
        InputDevice        "Generic Keyboard"
        InputDevice        "Configured Mouse"
        InputDevice     "stylus" "SendCoreEvents"
        InputDevice     "cursor" "SendCoreEvents"
        InputDevice     "eraser" "SendCoreEvents"
EndSection

在"Configured Mouse"之后添加:

        InputDevice        "Synaptics Touchpad"

i also commented out the three lines about the wacom: "stylus", "cursor", and "eraser", but I am not sure if this is necessary. -原作者brallan注

重启X:<ctrl> <Backspace>,现在您应该有拥有滚轮支持了。然后安装qsynaptics来更精准地控制您的设备。

使用快捷键来启动/禁用Synaptics触摸板

您有可能想要启用或者禁用触摸板,从而在您使用USB或者其他鼠标的时候不致因触摸板的缘故干扰您打字。请使用如下步骤:

步骤 1

在终端中编辑/etc/xorg.conf

sudo gedit /etc/X11/xorg.conf

找到如下内容:

Section "InputDevice"
        Identifier        "Synaptics Touchpad"
        Driver                "synaptics"
        Option                "SendCoreEvents"        "true"
        Option                "Device"                "/dev/psaux"
        Option                "Protocol"                "auto-dev"
        Option                "HorizScrollDelta"        "0"
EndSection

在Section的最后添加如下的选项:

        Option              "SHMConfig"                 "on"
EndSection

如果您正在使用一个Alps触摸板(您可以通过如下方法确认)

cat /proc/bus/input/devices

您看到的代码应当如下:

Section "InputDevice"
        Driver          "synaptics"
        Identifier          "TouchPad"
        Option                "SendCoreEvents"        "true"
        Option                "Device"                "/dev/input/event2"
        Option                "Protocol"                "event"
        Option          "SHMConfig"             "on"
EndSection

您可以定义一些参数来改变您的触摸板的行为。这些参数已经在[1]中列出。您可以通过如下方法检查您的触摸板是否工作正常,或者您是否使用了正确的参数:

synclient -m l

如果一切正常,您的手指的位置应该能够随您的移动而改变,而且您可以根据这一信息设置您的参数。


步骤 2

接下来,我们会创建三个文件:一个bash脚本来启用触摸板,一个来禁用,以及一个python脚本来使用组合键启用或者禁用。在终端中cd/usr/local/bin下,新建一个文件:

cd /usr/local/bin
sudo gedit tpoff

将下列代码粘贴到文件中,保存并关闭。

synclient  -s touchpadoff=1 

然后,再新建一个文件:

sudo gedit tpon

粘贴下列代码,保存并关闭。

synclient -s touchpadoff=0

再新建一个文件:

sudo gedit touchpad.py

粘贴下列代码,保存并关闭。

#!/usr/bin/python 
import os
        

def ReadFile():
        myfile = open('/tmp/synclient.tmp', 'rb')
        for line in myfile:
                TestString(line)                
        myfile.close()

def TestString(string):
        for word in string.split():
                if word == "TouchpadOff":
                        setting = string.split()
                        ChangeState(setting[2])
        

def ChangeState(current):    
        if current == "0":
                os.system("synclient -s touchpadoff=1")
        else:
                os.system("synclient -s touchpadoff=0")
        os.system("rm /tmp/synclient.tmp")

def Main():
        ReadFile()
os.system("synclient -l > /tmp/synclient.tmp")
Main()

最后,为这三个文件设置访问权限:

sudo chmod 644 tpon tpoff touchpad.py

步骤 3

接下来,编辑您的sudo用户文件,以允许您在无须输入密码的情况下运行那两个脚本。

sudo visudo

加入以下行:

{user}   ALL = NOPASSWD: /usr/local/bin/touchpad.py

注意:{user}代表您的用户名。

保存(在nano中,键入<CTRL> <o>),确保将其保存为/etc/sudoers

步骤 4 接下来,安装xbindkeys

sudo apt-get install xbindkeys

完成后,请安装xbindkeys-config,xbindkeys的图形用户界面

sudo apt-get install xbindkeys-config

安装完成后,请把这两个程序都打开:

xbindkeys

以及

xbindkeys-config

编辑您的文件来定义您想要的快捷键。例如,要使用<Ctrl><F5>来启用/禁用触摸板,在Edit下面填入以下内容:

Name: Touchpad On/Off Key: Control + F5 | m:0x4 + c:71 Action: /usr/local/bin/touchpad.py

然后点击apply,save,exit

这样就完成了,重启xbindkeys:

xbindkeys

您可能需要重新起动X。

请记住,在每次启动X的时候您都需要再次运行xbindkeys来启用快捷键。请到“系统>首选项>会话>启动程序”中添加。

Apple ibook G4

Dapper的全新安装环境下触摸板工作极度缓慢。这个bug已经被修复了,详见此处:[2]。这个修复方案非常简单,只要将如下设置添加到您/etc/X11/xorg.conf中适当的位置,然后重新启动X即可。

Section "InputDevice"
Identifier "Synaptics Touchpad"
Driver "synaptics"
Option "SendCoreEvents" "true"
Option "Device" "/dev/input/mice"
Option "Protocol" "auto-dev"
Option "LeftEdge" "0"
Option "RightEdge" "850"
Option "TopEdge" "0"
Option "BottomEdge" "645"
Option "MinSpeed" "0.4"
Option "MaxSpeed" "1"
Option "AccelFactor" "0.03"
Option "FingerLow" "55"
Option "FingerHigh" "60"
Option "MaxTapMove" "20"
Option "MaxTapTime" "100"
Option "TapButton1" "0"
Option "TapButton2" "3"
Option "TabButton3" "2"
Option "HorizScrollDelta" "10"
Option "VertScrollDelta" "30"
Option "SHMConfig" "on"
EndSection