How to configure the TrackPoint

From ThinkWiki
Revision as of 18:56, 8 December 2008 by Craftyguy (Talk | contribs) (TrackPoint under Ubuntu 8.10 and Fedora 10 using HAL)

Jump to: navigation, search
The kernel trackpoint driver is controlled by echoing values to special files. Common configuration options are outlined below.
NOTE!
  • With kernels 2.6.19 and above config files for this driver are located in /sys/devices/platform/i8042/serio1.
  • With kernels 2.6.13 (inclusive) to 2.6.19 (exclusive) config files for this driver are located in /sys/devices/platform/i8042/serio0/serio2.
  • With kernels 2.6.11 (inclusive) to 2.6.13 (exclusive) config files for this driver are located in /sys/devices/platform/i8042/serio0.
  • With kernels 2.6.9 (inclusive) to 2.6.11 (exclusive) config files for this driver are located in /proc/trackpoint.
  • Prior to kernel 2.6.9, configuration was not done through files but through command-line options to the psmouse module. (Note this means you must compile psmouse as a module!) See http://stephen.evanchik.com/node/16.

General Configuration

The configuration options are reflected by the files you can find in /sys/devices/platform/i8042/serio0/serio2. See the TrackPoint driver page for a complete list. Configuration is done by echoing the appropriate values into these special files.

If you want to set the sysfs parameters at boot, you can use the sysfsutils and put the preferred value in /etc/sysfs.conf.

Most common Features

The most common settings are Press to Select, sensitivity, speed and scrolling.

Press to Select

Press to Select allows you to tap the control stick which will simulate a left click. You can enable this feature by typing the following in to a terminal (you may need to be root):

# echo -n 1 > /sys/devices/platform/i8042/serio0/serio2/press_to_select

Press to Select should now be enabled. You can disable it in a similar manner:

# echo -n 0 > /sys/devices/platform/i8042/serio0/serio2/press_to_select

You can use this script to automate the operation

       #!/bin/bash
       if [ "$1" = "1" ]; then
               echo "Turning on tap on TrackPoint"
               echo -n 1 > /sys/devices/platform/i8042/serio0/serio2/press_to_select
               exit 0
       fi
       if [ "$1" = "0" ]; then
               echo "Turning off tap on TrackPoint"
               echo -n 0 > /sys/devices/platform/i8042/serio0/serio2/press_to_select
               exit 0
       fi
       echo -n "Tap status: "
       cat /sys/devices/platform/i8042/serio0/serio2/press_to_select

Sensitivity & Speed

Adjusting the speed and sensitivity of the TrackPoint requires echoing a value between 0 and 255 into the appropriate file. For example, for a speed of 120 and a sensitivity of 250, type the following into a terminal:

# echo -n 120 > /sys/devices/platform/i8042/serio0/serio2/speed
# echo -n 250 > /sys/devices/platform/i8042/serio0/serio2/sensitivity

Feel free to experiment with your settings until you find a combination that is comfortable.

When you satisfy your setting, add the two lines into /etc/rc.d/rc.local in order to avoid restoring the default setting every time the system reboots.

Scrolling

Using a kernel prior to 2.6.11

The scrolling action is essentially the same as is used in the TrackPoint Windows drivers. To enable this feature, type the following in to a terminal (you may need to be root):

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

Then press the middle button and push the stick up and down to scroll. Similarly, to disable scrolling:

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

Using the X server (kernel 2.6.11+)

The scroll setting has been removed from the trackpoint driver in kernel versions 2.6.11 and above. Scroll emulation should now be handled in the X server.

A nice side effect of that is, that middle button scrolling applies to any mouse and not just the TrackPoint interface, which can be a quite handy feature for desktop computers or people who prefer to use an external mouse, especially when scrolling through long lists or needing to use horizontal scrolling with a mouse which has only a vertical scroll wheel.

The necessary functionality, known as "EmulateWheelTimeout" allowing to use button 2 for a middle click, wasn't implemented in Xorg prior to 6.9/7.0. However, there was a patch included in most distributions packages of Xorg, which was announced here. You can find an updated version of the package in the experimental branch of Debian or try to build the mouse driver yourself with the information in the announcement. This has successfully been tried with FC3's 6.8.2 packages.

Once this functionality is in the X.org, add these lines to your TrackPoint configuration section in /etc/X11/xorg.conf:

       Option          "EmulateWheel"          "on"
       Option          "EmulateWheelButton"    "2"

It may also be necessary to add these lines:

       Option "YAxisMapping" "4 5"
       Option "XAxisMapping" "6 7"

which specify which buttons are mapped to motion in the vertical (Y) and horizontal (X) directions, respectively, in wheel emulation mode (see http://www.xfree86.org/current/mouse.4.html).

Hint:
Use the program "xev" to see, what mouse button identifiers are sent by your mouse/touchpad/trackpoint.
You might want to try: "xev | grep button"
Hint:
If it does not work see if evdev is installed and remove it. On gentoo do the following:

eix xf86-input-evdev
emerge -C xf86-input-evdev
and then remove the evdev flag in make.conf INPUT_DEVICES

So, a complete mouse section, that implements this nicely and works very well on my R51, even with a simultaneously connected USB mouse, looks like that (tried out today, 20th of September, 2006 on Dapper):

 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

The mappings for Y and Z are the same, since the "Z-Axis" refers to actual hardware scrolling wheels which usually scroll the screen along the Y-Axis. If there is no hardware scrolling wheel present, horizontal and vertical scrolling using the TrackPoint work fine without the Z-Axis line.

Now restart X and hold down button 2 and move the mouse to scroll, or just press and release button 2 for a middle click.

To make this work with the synaptics driver for the touchpad, you can add

       Option      "GuestMouseOff" "1"

to the synaptics device section. This will make the synaptics driver ignore the Trackpoint, so it will be handled by the mouse driver. This allowed me to disable the touchpad while making the TrackPoint work like it should.

NOTE!
With the above mouse section in my xorg.conf all this works like a charm:
  • I can press the wheel on my external USB mouse and move the mouse up and down for scrolling
  • or I can just use the wheel on the external mouse for scrolling
  • or pressing the MMB button of the trackpoint and use the trackpoint for scrolling.
  • Even horizontal scrolling works automagically in Konqueror, for Firefox/Opera see below.

Simultaneously I can use

  • a press on the external mouse's wheel
  • or the MMB of the trackpoint
for pasting the buffer. Lovely! :)
Hint:
If you don't use the middle-mouse-button for pasting and sometimes pasting things by mistake while scrolling (witch is really odd) simply set the "EmulateWheelTimeOut" to "1" as a (bloody) workaround. Middle click will only possible with pressing left and right button simultaneously!


EmulateWheelTimeout temporarily broken (-> fix for Ubuntu Dapper)

Unfortunately, there was a regression so that EmulateWheelTimeout was broken in X.org 6.9.0, and fixed on March 20th, 2006. You can see the primary bug report here, and also reports on the Mandriva and Debian (#346098, #320136) packages.

Unfortunately, this bug is still present in Ubuntu Dapper Drake's xserver-xorg-input-mouse package (version 1.0.3.1+cvs.20060109-0ubuntu1)!

Hint:
xserver-xorg-input-mouse (version 1.0.3.1+cvs.20060109-0ubuntu1.1) is in dapper-updates since July 3rd, 2006. You don't need to patch it anymore.

Use the following procedure to make it (middle button scrolling & middle button pasting) work:

$ cd /desired/path && mkdir tmp && cd tmp (create temporary directory somewhere)
$ sudo nano /etc/apt/sources.list (insert/uncomment the deb-src lines, save and exit)
$ sudo apt-get update
$ apt-get source xserver-xorg-input-mice (in order to get the source code)
$ sudo aptitude install xserver-xorg-dev (this package and the packages it depends on are needed in order to compile the source code, use aptitude for easy removal later on)
$ cd xserver-xorg-input-mouse-1.0.3.1+cvs.20060109/
$ wget http://librarian.launchpad.net/2639933/xserver-xorg-input-mouse_1.0.3.1+cvs.20060109-0ubuntu2.debdiff (downloads the patch that fixes the bug)
$ patch -p1 < xserver-xorg-input-mouse_1.0.3.1+cvs.20060109-0ubuntu2.debdiff (applies the bug fix)
$ fakeroot dpkg-buildpackage (rebuilds the package... watch out for errors and install other missing packages)
$ sudo dpkg -i ../xserver-xorg-input-mouse_1.0.3.1+cvs.20060109-0ubuntu2_i386.deb (installs the rebuilt built package)
$ sudo aptitude remove xserver-xorg-dev (removes the packages needed to rebuild the package)

Hope it works for you, it did work for me! CrypTom

Older versions of X.org

For older versions of Xorg or for Xfree86 (/etc/X11/XF86Config) try this:

      Option          "Emulate3Buttons"       "true"
      Option          "EmulateWheel"          "true"
      Option          "EmulateWheelButton"    "2"

Now restart X and hold down button two and move the mouse for scrolling. To get a middle click, press buttons 1 and 3 simultaneously.

Soft Transparent Mode

If you wish to connect a special device to the external PS/2 port, you should consider using "Soft Transparent Mode" so that the TrackPoint controller does not interpret any commands sent to the external PS/2 port. You can enable soft transparent mode by typing the following in to a terminal:

# echo -n 1 > /sys/devices/platform/i8042/serio0/serio2/transparent

Disabling soft transparent mode is similar:

# echo -n 0 > /sys/devices/platform/i8042/serio0/serio2/transparent

Modify trackpoint parameter permanently in trackpoint.h

If you do not want to run a script to reconfigure the trackpoint you can change the default settings in the trackpoint header file that is located in

/usr/src/<KERNEL_VERSION>/drivers/input/mouse/trackpoint.h.

First you must convert the values (decimal numbers) you normaly echo to /sys/[...] to hex:

echo -e 'obase=16;<DECIMAL_NUMBER>' | bc

Then simply replace the default hex values in trackpoint.h, run 'make && make modules_install' to recompile and install psmouse.ko (should be compiled as module)


Example patch (speed=100, sensitivity=190, press_to_select=1):

 --- trackpoint.h.orig   2006-01-17 16:18:30.000000000 +0100
+++ trackpoint.h        2006-01-17 16:25:47.000000000 +0100
@@ -108,9 +108,9 @@
 /*
  * Default power on values
  */
-#define TP_DEF_SENS            0x80
+#define TP_DEF_SENS            0xBE
 #define TP_DEF_INERTIA         0x06
-#define TP_DEF_SPEED           0x61
+#define TP_DEF_SPEED           0x64
 #define TP_DEF_REACH           0x0A

 #define TP_DEF_DRAGHYS         0xFF
@@ -123,7 +123,7 @@

 /* Toggles */
 #define TP_DEF_MB              0x00
-#define TP_DEF_PTSON           0x00
+#define TP_DEF_PTSON           0x01
 #define TP_DEF_SKIPBACK                0x00
 #define TP_DEF_EXT_DEV         0x01

Configure firefox for using trackpoint horizontal scrolling

Vertical Scrolling seems to work out of the box in firefox if you followed the steps above. Anyway, there is a problem when you don't scroll exactly vertical, because horizontal scrolling turns into browser BACK/FORWARD commands. You can avoid this by typing about:config + ENTER in the address bar of firefox. You have to adjust the following options:

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;

FWIW, you can change only the following value to remove the browser BACK/FORWARD commands:

mousewheel.horizscroll.withnokey.action = 0;

With that, you can still go BACK/FORWARD by pressing together the shift or the alt key, while with the control key you increase or decrease the font size.

NOTE!
This appears to be fixed by default in Firefox 3.

Configure Opera for using trackpoint horizontal scrolling

You'll experience the same annoying problem with the popular browser Opera. To fix this you need to edit the configfile standard_mouse.ini in e.g. /usr/share/opera/ini/ (Debian) or /opt/opera/share/opera/ini/ (Gentoo) and comment out the following lines

Button6                                                        = Back
Button7                                                        = Forward

so they look like that

;Button6                                                        = Back
;Button7                                                        = Forward

Remember, Button6 and Button7 do not so coincidental correspond with our X configuration we know from above:

Option "YAxisMapping" "6 7"

After this change you will be able to scroll vertically and horizontally with your middle button.

Fixing trackpoint under Ubuntu 7.10 Gutsy Gibbon

Using trackpoint deamon

My default Ubuntu Gutsy (running on an X61s) would give the following error messages when running the trackpoint daemon. Running

     /etc/init.d/trackpoint restart

caused a bunch of error messages, as the wrong device was in

        /etc/trackpoint/trackpoint.conf

I fixed this by changing:

        echo -n  > /sys/devices/platform/i8042/serio0/serio2/sensitivity

to

        echo -n  > /sys/devices/platform/i8042/serio1/sensitivity

in /etc/trackpoint/trackpoint.conf.

In addition, Ubuntu ran the appropriate /etc/init.d/trackpoint script on booting, but would give a bunch of errors (which, oddly, I could never find in any of the log files).

It seems that it was running the scripts too early in the boot sequence. The Gutsy package provided

    /etc/rc2.d/S20trackpoint

so I renamed this to S99trackpoint (and in all the other rc.? directories) and it now works on boot.

Editing the kernel config files

Another way of configuring the trackpoint without using the trackpoint daemon is to edit the values of the trackpoint files which, BTW, are located in

/sys/devices/platform/i8042/serio1/serio2.

The script should be executed during boot. This can be done in an init script (e.g. /etc/bootmisc.sh in some distros)

Script:

#! /bin/sh

#
# configuration du trackpoint
#

# vitesse
echo -n 120 > /sys/devices/platform/i8042/serio1/serio2/speed

# sensibilité
echo -n 250 > /sys/devices/platform/i8042/serio1/serio2/sensitivity 

# press to select
echo -n 1 > /sys/devices/platform/i8042/serio1/serio2/press_to_select

An Ubuntu/Fedora example

Another script that I've created seems to work with all versions of Ubuntu/Fedora that I've been able to try (comment out and uncomment the appropriate lines for fedora/ubuntu as necessary) Place in /etc/rc.local or equivalent for your distro:

Script:

#*************************
## START TRACKPOINT CONFIG
#*************************

# For fedora (the slash after "speed" is returned)
# TRACKPATH=$(find /sys -print0 | grep -FzZ "/serio2/speed" | sed s^speed/^^)

# For ubuntu (the slash after "speed" is not returned)
TRACKPATH=$(find /sys -print0 | grep -FzZ "/serio2/speed" | sed s/speed//)

## Select "press_to_select" on the trackpoint input device
## We need to specify the TRACKPATH above because the device under "serio#"
## changes between system boots. (We first test to see if the file we want
## to modify exists, if it does, we make the change
#[ -f $TRACKPATH/press_to_select ] && echo -n 1 > $TRACKPATH/press_to_select

## Adjust the speed setting of the trackpoint input device
[ -f $TRACKPATH/speed ] && echo -n 120 > $TRACKPATH/speed 
## Adjust the sensitivity setting of the trackpoint input device
[ -f $TRACKPATH/sensitivity ] && echo -n 200 > $TRACKPATH/sensitivity

#***********************
## END TRACKPOINT CONFIG
#***********************

TrackPoint under Xorg-7.4+ using HAL

Because Xorg 7.4 uses HAL FDI policy files instead of xorg.conf for device configuration, you must do the following to get the scrolling working: (see: http://forum.ubuntuusers.de/topic/mouse-wheel-emulation-in-xorg.conf/?highlight=hal+trackpoint#post-1558282 )

Create the file /etc/hal/fdi/policy/mouse-wheel.fdi as root with the following content:

<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.YAxisMapping" type="string">4 5</merge>
 <merge key="input.x11_options.XAxisMapping" type="string">6 7</merge>
 <merge key="input.x11_options.Emulate3Buttons" type="string">true</merge>
 <merge key="input.x11_options.EmulateWheelTimeout" type="string">200</merge>
</match>

In Fedora 10, this fix also works, and with lshal you can see that the changes do indeed take effect. However, you will need to update the evdev drivers (yum --enablerepo=rawhide update xorg-x11-drv-evdev) before X will use these settings correctly. I'm still not sure what the problem is with the drivers in vanilla Fedora 10, but with version 2.1.0 of these drivers, I have full functionality.

Note: You must restart both hal and X to see these changes, so it's probably easiest to just reboot.


Confirmed to work in Gentoo as well. You MUST upgrade to x11-drivers/xf86-input-evdev-2.1.0. As of today (12/8/08), this package is only found in the x11 overlay.


https://wiki.ubuntu.com/X/Config


Note: After setting this up, scrolling seems to fail once in a while after resuming from suspend. Re-suspending and then re-resuming causes it to work again. I don't know why this might be.