Touchpad Synaptics

From ArchWiki
Revision as of 20:00, 14 December 2008 by Stonecrest (talk | contribs) (typos)
Jump to: navigation, search

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

Introduction

This article will help install and configure the synaptics input driver for Synaptics Touchpads found on most notebooks.

Installation

The synaptics driver is now bundled as xf86-input-synaptics, and is available from the standard repositories:

# pacman -S xf86-input-synaptics

Configuration

There are two options configuring the Synaptics Touchpad. How you do so will depend on whether you have enabled Xorg input hotplugging.

Configuration via xorg.conf (hotplugging disabled)

Edit /etc/X11/xorg.conf as root and add InputDevice "Touchpad" "SendCoreEvents" to the ServerLayout, for example:

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

Add Load "synaptics" to the Module section, for example:

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

Lastly, add a new InputDevice section for the touchpad itself:

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

The bolded lines are important because users must now explicitly enable the side and bottom scroll zones of the touchpad. If you already had an InputDevice section configured for the old touchpad driver, you'll still need to add these two lines if you wish to use the scroll zones.

Save, exit and restart X. The touchpad should now have working scroll zones. You can further tweak the InputDevice settings if desired. See Advanced Configuration for more information.

Note that Xorg will automatically load the evdev and psmouse kernel modules required by synaptics, however you may also add them explicitly to the MODULES array in the /etc/rc.conf file if desired.

ALPS Touchpads

For ALPS Touchpads, if the above configuration does not provide the desired results, try the following configuration instead:

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

Configuration via HAL policies (hotplugging enabled)

If you have chosen to use Xorg input hotplugging, then the next time you enter X, you will likely find that your touchpad works without any further configuration.

If it does not or you want to tweak the configuration, remove every related configuration from the xorg.conf file. Keep only the Load "synaptics" line.

Copy /usr/share/hal/fdi/policy/10osvendor/11-x11-synaptics.fdi in /etc/hal/fdi/policy/. Edit it with your favourite editor.

The file contains:

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

You have to add a line just before the closing </match> for every configuration option. What was:

Option      "RightEdge"         "5300"

in the xorg.conf becomes:

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

in this .fdi file.

Here a simple <match> section to begin with, it activates the most wanted features and leaves many settings alone:

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

Advanced Configuration

Input device options

The synaptics driver offers a number of options that can be customized. The following is a brief list of some of these options--see man synaptics for full details:

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

Once the touchpad is configured, GNOME users can also install the gsynaptics package to enable a GUI-based control panel for the device:

# pacman -S gsynaptics

To save and load the settings from gsynaptics automatically, add gsynaptics-init to the list of Startup Programs found in System -> Preferences -> Sessions.

Note: Non-GNOME users can also use gsynaptics by instead adding gsynaptics-init to their .xinitrc or .xsession startup scripts.

Fine tuning with synclient

The synclient monitor can display pressure and placement on the touchpad in real-time, allowing further refinement of the default synaptics settings. In order for synclient to work properly, the SHMConfig option must be set to on or true.

You can start the synaptics monitor with the following command:

$ synclient -m 100

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

This monitor provides information about the current state of your touchpad. For example, if you move the mouse with the touchpad, the x and y values in the monitor will change. Therewith you can easy figure out your touchpad's dimension which is defined in the LeftEdge-, RightEdge-, BottomEdge- and TopEdge-Options.

The abbreviations are explained as following:

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.

If a value constantly is zero, it means that this option is not supported by your device.

With this in mind you should be able to figure the proper values out for you.

Edge scrolling

To enable the scroll zones found along the edges of the touchpad, add one or both of the following options to the touchpad device section in /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

Two-Finger scrolling

Recent synaptics touchpads support two-finger scrolling. This allows you to use two fingers together anywhere on the touchpad, similar to the behaviour of Macbooks.

If your hardware supports this feature, you can enable it by inserting the following lines into the touchpad device section of /etc/X11/xorg.conf:

Section "InputDevice"
        ...
      Option      "VertTwoFingerScroll"   "true"	# vertical scroll anywhere with two fingers
      Option      "HorizTwoFingerScroll"  "true"	# horizontal scroll anywhere with two fingers
        ...
EndSection

Firefox users: You might find the default behaviour of Firefox pretty annoying relating to the horizontal scrolling. Just see Firefox and special touchpad events below to find out how to disable it.

Circular scrolling

Circular scrolling is a feature that synaptics offers which closely resembles the behaviour of iPods. Instead of (or additional to) scrolling horizontally or vertically, you can scroll circularly. Some users find this faster and more precise. To enable circular scrolling, add the following options to the touchpad device section of /etc/X11/xorg.conf:

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

The option CircScrollTrigger may be one of the following values, determining which edge circular scrolling should start:

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

Specifying something different from zero may be useful if you want to use circular scrolling in conjunction with horizontal and/or vertical scrolling. If you do so, the type of scrolling is determined by the edge you're starting.

To scroll fast, draw small circles in the center of your touchpad. To scroll slowly and more precise, draw large circles.

Other features

By default, Synaptics touchpads are able to detect the number of fingers on the touchpad, ALPS touchpads are not. If the touchpad is tapped with two fingers, it will emulate a middle click. If the touchpad is typed with three fingers, a right click will be emulated.

Tips & Tricks

Disable touchpad upon external mouse detection

In assistance to udev, it is possible to automatically disable the touchpad if an external mouse has been plugged in. To achieve this, add the following udev rule to /etc/udev/rules.d/01-touchpad.rules:

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 must be enabled (see the Configuration section for details)

Troubleshooting

My touchpad device isn't located at /dev/input/mouse0

If that's the case, you can use this command to display information about your all input devices:

cat /proc/bus/input/devices

Search for an input device which has the name "SynPS/2 Synaptics TouchPad". The Handler in this section will tell you which Device you have to specify in your 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

As your Handlers are mouse0 and event1, you use /dev/input/mouse0.

Stopping the mouse from clicking while typing

This is a neat little trick incorporated with the synaptics driver, you can actually make sure that the touchpad is disabled while typing. It is a very simple procedure, so here is how it is done.

Just add the following line to your .xinitrc before you run your window manager:

syndaemon -i 2 &

The -i 2 switch sets the idle time to 2 seconds. The idle time specifies how many seconds to wait after the last key press before enabling the touchpad again.

Additionally you can add the -t switch that tells the daemon not to disable mouse movement when typing and only disable tapping and scrolling:

syndaemon -t -i 2 &

As usual you may find further information in the manpage:

$ man syndaemon

Firefox and special touchpad events

Even though this problem isn't concerning the synaptics drivers, you will probably look up here for a solution anyway. By default firefox is set up to do special events on tapping or scrolling certain parts of your touchpad. You can edit the settings of those actions by typing about:config in your firefox address bar. Editing takes place by double clicking on those lines, true changes to false and vise versa, a numerical value you'll have to change manually.

To prevent firefox from scrolling (back and forward) through the history and make it scroll the site, you have to edit the following settings:

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

To prevent firefox from redirecting you to urls formed out of your clipboard content, on tapping the upper-rigt corner of your touchpad (or middle mouse button), you have to set the following line to false:

middlemouse.contentLoadURL = false

Opera misinterprets horizontal scrolling

Same as above. To fix it, go to Tools -> Preferences -> Advanced -> Shortcuts. There you edit the mouse preferences: Delete the entries with "Button 5" and "Button 6".

Scrolling and multiple actions with synaptics on LG Laptops

These problems seems to be occurring on several models of LG laptops. Symptoms are that when pressing Mouse Button 1 synaptics interprets 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 interpret 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.

Still can't get your USB (external) mouse working?

First, make sure your section describing the external mouse contains this line (or that the line looks like this):

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

If the "Device" line is different, change it to the above, and try to restart X. If this doesn't solve your problem, make your touchpad the CorePointer in the "Server Layout" section:

InputDevice    "Touchpad" "CorePointer"

and make your external device "SendCoreEvents":

InputDevice    "USB Mouse" "SendCoreEvents"

finally add this to your external device's section:

Option      "SendCoreEvents"    "true"

If all of the above doesn't work for you, please check relevant bug trackers for possible bugs, or go through the forums to see if anyone has found a better solution.

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.

Touchpad doesn't have tapping function

Xorg v7.4 does not enable tapping by default. To enable, simply add following to the touchpad's InputDevice section in /etc/X11/xorg.conf:

Section "InputDevice"
        ...
        Option "TapButton1" "integer"
        Option "TapButton2" "integer"
        Option "TapButton3" "integer"
        ...
EndSection

The integer of option "TapButton1" means which mouse button is reported on a non-corner one-finger tap. Usually it is 1. The integer of option "TapButton2" means which mouse button is reported on a non-corner two-finger tap. Usually it is 2. The integer of option "TapButton3" means which mouse button is reported on a non-corner three-finger tap. Usually it is 3.

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

If you are using Xorg7.4, you may get a warning like this from /var/log/Xorg.0.log, that's because the driver will grab the event device for exclusive use when using the linux 2.6 event protocol. When it fails, X will warn this message.

Grabbing the event device means that no other user space or kernel space program sees the touchpad events. This is desirable if the X config file includes /dev/input/mice as an input device, but is undesirable if you want to monitor the device from user space.

if you want to control it, add or modify the "GrabEventDevice" option in you touchpad section in xorg.conf:

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

That will affect when next time you start X, and you can also change it by using synclient. When changing this parameter with the synclient program, the change will not take effect until the synaptics driver is disabled and re-enabled. This can be achieved by switching to a text console and then switching back to X.

Other Resources

Synaptics TouchPad driver for XOrg/XFree86 : [1]