Disabling touchpad buttons on the Thinkpad X120E

By Abhijit Menon-Sen <ams@toroid.org>


One of the two most annoying things about my Thinkpad X120E is that the touchpad buttons are flush with the outer edge of the chassis, and very easy to press inadvertently. I like the touchpad, so the option of disabling it in the BIOS or with "synclient TouchpadOff=1" did not appeal to me.

After reading the synclient man page, I was forced to accept that there was no easy way to disable just the hardware buttons. That left digging into the source code of the X.Org Synaptics driver ("apt-get source xserver-xorg-input-synaptics", and I had to install xorg-dev, xserver-xorg-dev, and xutils-dev as well).

The code is quite pleasant to read, and a single pass through synaptics.c and some quick grepping suggested a likely approach. ReadInput() handles each packet received from the device, and it calls SynapticsGetHwState(), which in turn calls a device-specific ReadHwState() function (ALPS, PS/2, etc.) to fill in a SynapticsHwState struct. All I did was to set the left and right click flags to 0 after this call.

--- synaptics.c~ 2012-07-22 13:40:01.522703354 +0530
+++ synaptics.c 2012-07-22 12:30:16.498811737 +0530
@@ -1255,8 +1255,10 @@
 SynapticsGetHwState(InputInfoPtr pInfo, SynapticsPrivate *priv,
 		    struct SynapticsHwState *hw)
-    return priv->proto_ops->ReadHwState(pInfo, priv->proto_ops,
+    Bool s = priv->proto_ops->ReadHwState(pInfo, priv->proto_ops,
 					&priv->comm, hw);
+    hw->left = hw->right = 0;
+    return s;

I built and installed the result (by copying src/.libs/synaptics_drv.so to /usr/lib/xorg/modules/input), and now I have a working touchpad with disabled buttons. Tap-to-click is implemented in software, so it works perfectly. The trackpoint is a separate device altogether, so its buttons (just above the trackpad) work fine too.

One oddity is that tap-to-click doesn't work at the lightdm screen, but it works fine inside GNOME. I didn't bother trying to figure out why.