The new Thinkpad Touchpad

Lately i’ve been having an really irritating issue with my
Thinkpad(w540)’s Touchpad accidentally moving the mouse pointer,
clicking on other windows, moving cursor through text etc. Being a
keyboard centered user, i very rarely use the Touchpad, and usually
opt for the Trackpoint, which (while magnitudes inferiority to the old
x200 era) still is a comfy way to do simple mouse pointing where i
need to, or must.

X Input: Configure X Input devices

The way to access your input devices (in X11) is by using the
program, xinput, which features a very easy and fast way of
tinkering with your devices and their settings.

Here is the man-page for xinput;

xinput(1)       General Commands Manual                xinput(1)

NAME
       xinput - utility to configure and test X input devices

SYNOPSIS
       xinput [OPTIONS] [DEVICE]

DESCRIPTION

       xinput is a utility to list available input devices, query
       information about a device and change input device settings.

[...]

The rules are quite simple, running xinput; lists all available
input devices together with a short description and an associated
id. This id is used exclusively to represent said device.

Device ID

To list what kinds of properties device id = 16 has, the option
list-props is used. Here is the properties of my Thinkpad’s Touchpad
for example running: xinput list-props 16;

$ xinput list-props 16

Device 'SynPS/2 Synaptics TouchPad':
        Device Enabled (172):   1
        Coordinate Transformation Matrix (174): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
        Device Accel Profile (305):     1
        Device Accel Constant Deceleration (306):       2.500000
        Device Accel Adaptive Deceleration (307):       1.000000
        Device Accel Velocity Scaling (308):    12.500000
        Synaptics Edges (330):  1310, 4826, 2220, 4636
        Synaptics Finger (331): 30, 50, 0
        Synaptics Tap Time (332):       125
        Synaptics Tap Move (333):       218
        Synaptics Tap Durations (334):  180, 180, 100
        Synaptics ClickPad (335):       1
        Synaptics Middle Button Timeout (336):  0
        Synaptics Two-Finger Pressure (337):    40
        Synaptics Two-Finger Width (338):       8
        Synaptics Scrolling Distance (339):     99, 99
        Synaptics Edge Scrolling (340): 1, 1, 0
        Synaptics Two-Finger Scrolling (341):   1, 1
        Synaptics Move Speed (342):     1.000000, 1.750000, 0.040331, 0.000000
        Synaptics Off (343):    0
        Synaptics Locked Drags (344):   0
        Synaptics Locked Drags Timeout (345):   5000
        Synaptics Tap Action (346):     0, 0, 0, 0, 1, 3, 2
        Synaptics Click Action (347):   1, 3, 2
        Synaptics Circular Scrolling (348):     1
        Synaptics Circular Scrolling Distance (349):    0.100000
        Synaptics Circular Scrolling Trigger (350):     2
        Synaptics Circular Pad (351):   0

Property ID

The bracketed number signifies a property id, which is used to
modify the associated feature. The value[’s] after the colon signifies
the current value (and/or) possible values. The option I’m looking
for here is the option to turn of the Touchpad is “Synaptics Off (343)”
(keep in mind that i want to use it’s features the Trackpoint is using,
for scrolling etc, while having the touch stuff turned off).

Property Value

To set the value of the property, the option set-prop is used. This
option takpnes a Device ID, Property ID and a New Value
(xinput set-prop 16 343 1). To turn of the Touchpad i set the value of
property 343 to 1. And instantly the touch is turned off. Success.

Here is the script i used, to be put in my autostart.sh file. This
script is essentially a tiny API, for more cleanly settings, and
values of my devices (Keep in mind that the Id’s change each
boot). So one cannot simply hard-code xinput set-prop 16 343 1. I
have noticed (i believe) changes in the property Id’s, however I’m
unsure.

Demonstration of Usage

Functions Provided

find-prop(String) => Integer
This function finds a device Id from
a Regular Expression which match with the xinput printing. This
allows for a changing Id, which sometimes occurs.
prop-value(String) => Integer
This function finds the (current)
value of a device’s property.

The Script

#!/bin/bash
# 
# Author: bl3ue
# Turn of the touchpad on a synaptics touchpad without disabling the
# trackpoint


# Get the touchpad device ID
DEVICE=$(xinput | grep "TouchPad" | cut -f2 | awk -F "=" '{print $2 }')

find-prop()
{

    xinput list-props $DEVICE | grep  "$1" | cut -f2 | \
        awk -F "(" '{print $2 }' \
        | awk -F ")" '{print $1 }'

}

prop-value()
{ 
    xinput list-props $DEVICE | grep "$1" | cut -f3    
}

PROP=$(find-prop 'Synaptics Off (')

# Turn of the Touchpad
printf "Turning Touchpad off...\n"
printf "DEVICE: $DEVICE\nPROPERTY: $PROP\nVALUE: 1\n"
xinput set-prop $DEVICE $PROP 1