Disable ThinkPad TrackPad in Ubuntu 16.04
25 Mar 2017
Once upon a time, disabling the trackpad in the BIOS worked. That time is no more.
A bit of poking around showed me that I could use the xinput command to find my trackpad's device id like so:
$ xinput --list
⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
⎜   ↳ SynPS/2 Synaptics TouchPad              	id=11	[slave  pointer  (2)]
⎜   ↳ TPPS/2 IBM TrackPoint                   	id=12	[slave  pointer  (2)]
⎣ Virtual core keyboard                   	id=3	[master keyboard (2)]
    ↳ Virtual core XTEST keyboard             	id=5	[slave  keyboard (3)]
    ↳ Power Button                            	id=6	[slave  keyboard (3)]
    ↳ Video Bus                               	id=7	[slave  keyboard (3)]
    ↳ Sleep Button                            	id=8	[slave  keyboard (3)]
    ↳ Integrated Camera                       	id=9	[slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard            	id=10	[slave  keyboard (3)]
    ↳ ThinkPad Extra Buttons                  	id=13	[slave  keyboard (3)]
So my trackpad is device 11, a Synaptics TouchPad. After some googling, I came up with this shell script:
#!/bin/bash set -e set -o pipefail set -u # We want to capture the id from this line: # ⎜ ↳ TPPS/2 IBM TrackPoint id=12 [slave pointer (2)] DEVICE_ID=$(xinput list | grep 'TouchPad' | sed -n 's/^.*id=\([0-9]*\).*$/\1/p') echo "TrackPoint device id is $DEVICE_ID" # show the user the current status of the device xinput --list-props $DEVICE_ID | grep 'Device Enabled' echo "disabling..." xinput --disable $DEVICE_ID # show the user the changed status of the device xinput --list-props $DEVICE_ID | grep 'Device Enabled' # Apparently this also works: # $ synclient TouchpadOff=1 # See also the docs for synclient (synaptics touchpad client) # https://www.x.org/archive/X11R7.5/doc/man/man4/synaptics.4.html
But I wanted more. I wanted to disable the trackpad for all users, from the xorg config files. That was quite a journey.
After lots of googling and experimenting, I made a few discoveries.
One is that the location of xorg conf is now spread out amongst files ending in .conf in this directory:
/usr/share/X11/xorg.conf.d
and I see that there are already two files of interest:
50-synaptics.conf
and
51-synaptics-quirks.conf
which proved to be useful for inspiration, but I left them unedited
Also useful to know is that xorg's logs are kept in
/var/log/Xorg.0.log
And as I was futzing around with differnt configs, the logs would give me some useful feedback like so:
[ 8.222] (==) Using config directory: "/etc/X11/xorg.conf.d" [ 8.222] (==) Using system config directory "/usr/share/X11/xorg.conf.d" [ 8.222] Data incomplete in file /etc/X11/xorg.conf.d/99-disable-trackpad.conf InputDevice section "SynPS/2 Synaptics TouchPad" must have a Driver line. [ 8.222] (EE) Problem parsing the config file [ 8.222] (EE) Error parsing the config file
One important thing I found in my travels was that I did not want to use the xinput command; I wanted to use the synclient command, for my synaptics touchpad! And listing the properties from the point of vew of my synaptics client proved to be hugely useful:
$ synclient -l | sort
# output omitted ...
    TouchpadOff             = 2
# output omitted ...
Note that the value 2 means the trackpad turns itself off after typing stops, but otherwise it's on.
Another thing I discovered is that even though the system xorg config files live in this directory:
/usr/share/X11/xorg.conf.d/
my own config file could (should?) instead go in this directory, which I had to create:
# mkdir /etc/X11/xorg.conf.d
I ended up creating a file in that directory:
# mv /usr/share/X11/xorg.conf.d/90-disable-touchpad.conf /etc/X11/xorg.conf.d/
and that file's contents ended up being
Section "InputClass"
    Identifier     "SynPS/2 Synaptics TouchPad"
    MatchDriver    "synaptics"
    Option         "TouchpadOff" "1"
EndSection
And note that the exact same property, listed by synclient, is used in this xorg conf file, and I just set the value to 1 instead of 2.
Even, cooler, when I look at /var/log/Xorg.0.log, I see that the
pre-existing synaptic-oriented conf files in /usr/share/X11/xorg.conf.d
get applied, but then my file, with the higher number (starts with 90 instead of 50
and 51) gets applied:
[ 6.702] (II) config/udev: Adding input device SynPS/2 Synaptics TouchPad (/dev/input/event5) [ 6.702] (**) SynPS/2 Synaptics TouchPad: Applying InputClass "evdev touchpad catchall" [ 6.702] (**) SynPS/2 Synaptics TouchPad: Applying InputClass "evdev touchscreen catchall" [ 6.702] (**) SynPS/2 Synaptics TouchPad: Applying InputClass "touchpad catchall" [ 6.702] (**) SynPS/2 Synaptics TouchPad: Applying InputClass "Default clickpad buttons" [ 6.702] (**) SynPS/2 Synaptics TouchPad: Applying InputClass "SynPS/2 Synaptics TouchPad"
Here are some useful links I used while trying to figure this out: