This post is specific to Asus Eee 1005HA netbook, but the technique explained here can be used on any computer having Synaptics touchpad.
Multi-touch gestures allow you to perform user interface actions by doing two finger gestures on touchpad. Apple introduced this feature on Macbooks and after you get used to it, it greatly enhances your web browsing on mouseless netbook. The most important gesture is scroll text by swiping the touchpad with two fingers.
Apple has also many patents related to the gestures so they are not enabled by default.
The real multi-finger touch support needs multi-finger aware (capacitive) touchpad. Most PC laptops are not equipped with one. Luckily some of the simple gestures, like two finger scrolling, can be emulated on normal pressure point sensitive touchpad via clever calculations and other tricks.
Note: Ubuntu HAL support for Synaptics seem to be broken. Only shell script at the end of the post will work. HAL options in FDI file are being ignored.
1. Setting up Synaptics driver
Type in terminal
gksudo gedit /etc/hal/fdi/policy/11-x11-synaptics.fdi
Create and save file with this content:
<?xml version="1.0" encoding="ISO-8859-1"?> <deviceinfo version="0.2"> <device> <match key="info.capabilities" contains="input.touchpad"> <merge key="input.x11_driver" type="string">synaptics</merge> <merge key="input.x11_options.SHMConfig" type="string">On</merge> <merge key="input.x11_options.EmulateTwoFingerMinZ" type="string">40</merge> <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.TapButton1" type="string">1</merge> <merge key="input.x11_options.TapButton2" type="string">3</merge> <!--two finger tap -> middle clieck(3) --> <merge key="input.x11_options.TapButton3" type="string">2</merge> <!--three finger tap -> right click(2). almost impossible to click --> </match> </device> </deviceinfo>
This allows us to use synclient utility to watch touchpad real-time data in console window.
Now restart X
sudo /etc/init.d/gdm restart
And open terminal again.
Type in command
synclient -m 100
And you should see data like this scrolling in the terminal:
129.355 2912 3469 59 1 4 0 0 0 0 0 00000000 0 0 0 0 0 129.455 2952 3529 59 1 4 1 0 0 0 0 00000000 0 0 0 0 0 time x y z f w l r u d m multi gl gm gr gdx gdy 129.555 3283 3516 60 1 4 1 0 0 0 0 00000000 0 0 0 0 0 129.656 3928 3517 60 1 4 1 0 0 0 0 00000000 0 0 0 0 0 129.756 4364 3637 60 1 4 1 0 0 0 0 00000000 0 0 0 0 0 129.856 4020 3329 49 1 4 0 0 0 0 0 00000000 0 0 0 0 0 129.956 3634 3122 58 1 4 0 0 0 0 0 00000000 0 0 0 0 0 130.057 3320 2957 60 1 4 0 0 0 0 0 00000000 0 0 0 0 0 130.157 2779 3312 61 1 4 0 0 0 0 0 00000000 0 0 0 0 0 130.257 2557 3739 61 1 4 0 0 0 0 0 00000000 0 0 0 0 0 130.358 2636 3485 39 1 4 0 0 0 0 0 00000000 0 0 0 0 0 130.458 2659 3104 60 1 4 0 0 0 0 0 00000000 0 0 0 0 0 130.558 2671 2988 60 1 4 0 0 0 0 0 00000000 0 0 0 0 0
f column tells the number of fingers. w is the touched area width. z is the pressure.
If you put two fingers on touchpad and you see value f=2 then your hardware has multi-touch aware touchpad. Unfortunately Asus Eee 1005HA doesn’t seem to have one 🙁
2. Emulation approach
Synaptics driver can emulate two-finger touch with the following conditions
- Touched area width exceeds certain threshold (min width)
- Touch pressure exceeds certain thresholds
When the conditions are met the driver thinks “Wow looks this guy is pressing us really hard. maybe he is using two fingers?” Note that touchpad values are touchpad specific and values applying for one model don’t work on another computer.
Synaptics driver settings are described here. Synaptic driver settings can be modified run-time using xinput command. Run synclient -m 100 in one terminal window and change threshold values in other until you find correct emulation parameters for your laptop. Below is my xinput tests. Test scrolling on Firefox and any long web page.
moo@huiskuttaja:~$ xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Width" 32 7 moo@huiskuttaja:~$ xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Pressure" 32 280 moo@huiskuttaja:~$ xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Width" 32 11 moo@huiskuttaja:~$ xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Pressure" 32 50 moo@huiskuttaja:~$
Looks like the following parameters are good for two finger emulation for Asus Eee 1005HA:
- Width: 8
- Pressure (Z): 10
You can also use command synclient -l to dump the current settings.
Below is the final script you need to run during log-in (see note about broken HAL at the beginning of the post):
#!/bin/sh#!/bin/sh # # Use xinput --list-props "SynPS/2 Synaptics TouchPad" to extract data # # Set multi-touch emulation parameters xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Pressure" 32 10 xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Width" 32 8 xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Two-Finger Scrolling" 8 1 xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Scrolling" 8 1 1 # Disable edge scrolling xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Synaptics Edge Scrolling" 8 0 0 0 # This will make cursor not to jump if you have two fingers on the touchpad and you list one # (which you usually do after two-finger scrolling) xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Synaptics Jumpy Cursor Threshold" 32 110
Jumpy cursor after two finger scroll
When you do a two-finger scroll and lift your one finger before the other the mouse cursor/scrolling may jump. Synaptics driver does not seem to have an option to filter out this bad event. If anyone knows solution for this please comment.
3. Other resources
- Linux Multi-Touch is a project to collect set of Perl scripts related to multi-touch events. If you want to customize your multi-touch experience and you have some development insight, this is the place to begin.
- Notes about multi-touch emulation (see the last comment).
- Diagnosing multitouch support and editing HAL files.
- Related idea on Ubuntu Brainstorm.
- Synaptics X11 driver source. Synaptics driver project page. Looks like there is no one central figure behind it, except for maintaining, and big bunch of patches from distributors.