Tuesday, February 24, 2015

Enable Multitouch On The Dell XPS 13 (9333)

With 3.16 and newer kernels the Elan touchpad on the 2014 Dell XPS 13 is fully supported in Linux. The XPS's touchpad is able to register two, three, and four finger gestures, finger width, and palm detection. Unfortunately the xorg-input driver has three and four finger detection disabled.  In order to re-enable them you will have to patch the xserver-xorg-input-synaptics driver.


Install the necessary dependencies for xserver-xorg-input-synaptics
sudo apt-get build-dep xserver-xorg-input-synaptics

Download the source files for xserver-xorg-input-synaptics
apt-get source xserver-xorg-input-synaptics

Change to the xserver-xorg-input-synaptics directory. As of writing this article Xubuntu 14.10 is using 1.8.1, if the version number has changed or you distro uses a different naming scheme you will modify your cd command
cd ~/xserver-xorg-input-synaptics-1.8.1/

Download and apply the patch to enable multitouch support
wget http://xps13-9333.appspot.com/root/synaptics-swipe.patch -O - -q | patch -p1

or

wget https://dl.dropboxusercontent.com/u/6062904/synaptics-swipe.patch -O - -q | patch -p1

Change the version number so updates do not remove the patched driver. Follow the command line prompts. I used nano to edit the file.
sudo apt-get install devscripts
dch -i

Build the newly patched xserver-xorg-input-synaptics package while ignoring signing errors.
dpkg-buildpackage -uc -us

Then install your newly created xserver-xorg-input-synaptics deb

There are a couple ways to map the newly support gestures to actions. Below is my method but other will also work. 
sudo apt-get install xbindkeys xdotool

Create a .xbindkeyssrc configuration file
mousepad ~/.xbindkeysrc

Add the following to the /.xbindkeyssrc file:
"xdotool key Alt+Left"
  release + b:10

"xdotool key Alt+Right"
  release + b:11

"xdotool key Ctrl+Shift+Tab"
  release + b:8

"xdotool key Ctrl+Tab"
  release + b:9

Again there are different methods for setting the 3 finger gestures to actions but a simple startup script worked for me.
mkdir ~/.scripts
mousepad ~/.scripts/touchpad.sh

Add the following to your startup script
#!/bin/bash
    sleep 10s &&
    synclient SwipeThreeUpButton=8;
    synclient SwipeThreeDownButton=9;
    synclient SwipeThreeLeftButton=10;
    synclient SwipeThreeRightButton=11

Make the script executable
chmod +x ~/.scripts/touchpad.sh

Then make sure to add ~/.scripts/touchpad.sh to your starup programs.

I want to thank the author of http://xps13-9333.appspot.com/ who wrote the patch and helped me work through installing it on my system.