配置Trackpoint的中键滚轮功能

出自Linux Wiki

在2008年11月10日 (一) 02:51由Ngukho (讨论 | 贡献)所做的修订版本

本文参考了thinkwiki.org中的相关文章,主要是做了翻译,并添加了Fedora Core Linux的解决方案。如果使用其它发行版,只要用xserver-xorg,都可以按本文设置。

Trackpoint指的是Thinkpad笔记本上的指点杆(又常被称为红点)。

目录

系统要求

2.6.11以前版本的内核

此段未经测试

2.6.11以前版本的内核中滚动功能可以直接像Windows里一样被驱动。在终端中输入:

# echo -n 1 > /proc/trackpoint/scroll 

启用滚动,而用

# echo -n 0 > /proc/trackpoint/scroll 

禁用滚动。

2.6.11以后版本的内核

2.6.11以后的内核去掉了原来的相关配置信息,所以只能在X Server中模拟这一功能。

目前实现这一功能需要 "EmulateWheelTimeout" 的支持,但它在Xorg 6.9或7.0的更早版本中不被支持。令人欣慰的是它已经被包含在多数发行版的Xorg版本中,具体情况在http://www.mail-archive.com/devel@xfree86.org/msg03333.html 这里。

Debian/Ubuntu类发行版和Fedora等发行版的设置方法稍有不同,下面分别介绍。

Hint.gif
提示:
对于其它发行版,如果在/etc/X11/xorg.conf中有Configured Mouse一项,就参照Debian/Ubuntu的设置方法,如果没有,就参照Fedora Core的设置方法。

为避免出现意外,请先备份你的xorg.conf

# cp /etc/X11/xorg.conf /etc/X11/xorg.conf.bak.trackpoint

Debian/Ubuntu等发行版

Debian Stable等版本

安装了此项功能,可以在/etc/X11/xorg.conf中,Configured Mouse部分加入:

      Option "EmulateWheel"          "on"
      Option "EmulateWheelButton"    "2"
      Option "EmulateWheelTimeOut" "200"
      Option "YAxisMapping" "4 5"
      Option "XAxisMapping" "6 7"

以下的配置在我的电脑(IBM R51,1829)上测试通过

Section "InputDevice"
      Identifier  "Configured Mouse"
      Driver      "mouse"
      Option      "CorePointer"
      Option      "Device"              "/dev/input/mice"
      Option      "Protocol"            "ExplorerPS/2"
      Option      "Emulate3Buttons"     "on"
      Option      "Emulate3TimeOut"     "50"
      Option      "EmulateWheel"        "on"
      Option      "EmulateWheelTimeOut" "200"
      Option      "EmulateWheelButton"  "2"
      Option      "YAxisMapping"        "4 5"
      Option      "XAxisMapping"        "6 7"
      Option      "ZAxisMapping"        "4 5"
EndSection

重启X,滚轮就可以用了。

Debian Sid版本

Emulate3Buutons在新版中不再取on、off值,而要取true,故请InputDevice的Configured Mouse修改如下即可: Section "InputDevice"

   Identifier  "Configured Mouse"
   Driver      "mouse"
   Option      "CorePointer"
   Option      "Device"              "/dev/input/mice"
   Option      "Protocol"            "ExplorerPS/2"
   Option      "Emulate3Buttons"     "true"
   Option      "Emulate3TimeOut"     "50"
   Option      "EmulateWheel"        "on"
   Option      "EmulateWheelTimeOut" "200"
   Option      "EmulateWheelButton"  "2"
   Option      "YAxisMapping"        "4 5"
   Option      "XAxisMapping"        "6 7"
   Option      "ZAxisMapping"        "4 5"

EndSection

Ubuntu 8.10版本

在Ubuntu 8.10中,键盘、鼠标不再由X服务器而是HAL管理,/etc/X11/xorg.conf中原有的配置不再有效(实际上Ubuntu在升级时也会自动注释相关部分)。要在Ubuntu 8.10中启用Trackpoint中键的滚轮功能,需要进行如下操作: (对于Ubuntu 8.10之前的版本请不要使用此方法,依照Debian配置方法即可)

首先,创建文件/etc/hal/fdi/policy/mouse-wheel.fdi,内容为:

<?xml version="1.0" encoding="UTF-8"?>
<match key="info.product" string="TPPS/2 IBM TrackPoint">
 <merge key="input.x11_options.EmulateWheel" type="string">true</merge>
 <merge key="input.x11_options.EmulateWheelButton" type="string">2</merge>
 <merge key="input.x11_options.XAxisMapping" type="string">6 7</merge>
 <merge key="input.x11_options.YAxisMapping" type="string">4 5</merge>
 <merge key="input.x11_options.ZAxsisMapping" type="string">4 5</merge>
 <merge key="input.x11_options.Emulate3Buttons" type="string">true</merge>
</match>

完成更改后,重启hal和gdm服务:

sudo /etc/init.d/hal restart
sudo /etc/init.d/gdm restart

由于对应的新驱动(xserver-xorg-input-evdev)存在一些bug,完成上述配置后可能在一些情况下仍然无法使用滚轮,可以尝试自行编译打过补丁的驱动,步骤如下:

wget http://launchpadlibrarian.net/19254960/preinit.diff
sudo apt-get install build-essential
sudo apt-get build-dep xserver-xorg-input-evdev
apt-get source xserver-xorg-input-evdev
cd xserver-xorg-input-evdev-2.0.99+git20080912
patch -p1 < ../preinit.diff
./autogen --prefix=/usr
make
sudo make install

其它发行版

其它发行版只要把xorg.conf中有关鼠标一项如上设置即可,并注意更改ServerLayout部分(如果有的话)的设备名称。下面以Fedora为例介绍:

Fedora中,/etc/X11/xorg.conf中没有Configured Mouse一项,需要添加:

# ServerFlags一节对Fedora 9来说是必要的[1]
Section "ServerFlags"
       Option  "AutoAddDevices"        "false"
EndSection
Section "InputDevice"
      Identifier  "Configured Mouse"
      Driver      "mouse"
      Option      "CorePointer"
      Option      "Device"              "/dev/input/mice"
      Option      "Protocol"            "ExplorerPS/2"
      Option      "Emulate3Buttons"     "on"
      Option      "Emulate3TimeOut"     "50"
      Option      "EmulateWheel"        "on"
      Option      "EmulateWheelTimeOut" "200"
      Option      "EmulateWheelButton"  "2"
      Option      "YAxisMapping"        "4 5"
      Option      "XAxisMapping"        "6 7"
      Option      "ZAxisMapping"        "4 5"
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

Section "ServerLayout"中,去掉(如果有的话)

 InputDevice    "Synaptics" "CorePointer"

加入:

InputDevice    "Configured Mouse"
InputDevice	"Synaptics Touchpad"

配置完成(至少在我的R51 1829上好使的),重新启动X就可以看到效果。

Firefox中水平滚动的配置

Firefox中垂直滚动是没有问题的,但是当试图水平滚动时发现执行的是前进、后退操作。如果要修正,请在地址栏中输入

about:config 

回车。更改下列设置:

mousewheel.horizscroll.withcontrolkey.action = 3;
mousewheel.horizscroll.withcontrolkey.numlines = 1; 
mousewheel.horizscroll.withcontrolkey.sysnumlines = true;

mousewheel.horizscroll.withnokey.action = 0;
mousewheel.horizscroll.withnokey.numlines = 1;
mousewheel.horizscroll.withnokey.sysnumlines = true;
 
mousewheel.horizscroll.withshiftkey.action = 1;
mousewheel.horizscroll.withshiftkey.numlines = 1;
mousewheel.horizscroll.withshiftkey.sysnumlines = true;

你也可以直接做如下更改(仅仅避免了由中键导致的前进、后退功能):

mousewheel.horizscroll.withnokey.action = 0;

Opera中滚动的设置

Opera在水平滚动时也可能发生“前进”、“后退”等操作,修正方法为:

菜单中:工具->首选项->高级->快捷键->鼠标设置->Opera Standard->编辑

在弹出的窗口中:

Application->Button6->删除->Button7->删除

确定后,选中Opera Standard(已修改),一路确定即可。

相关文章

Firefox、Opera中使用Thinkpad导航键


--Chenxing 01:10 2007年4月7日 (CST) --Chenxing 14:25 2007年8月10日 (CST)

参考资料

  1. http://unx.ca/log/2008/06/27/scrolling-with-the-trackpoing-on-an-x61-with-fedora-9/
个人工具
简体繁体转换