Calibrating touch using tslib in Linux

Tslib is a user-space based tool, written in C, used for calibrating touch in ARM based Linux system. Tslib acts as a thin layer between the drivers and the GUI, provides standard filters and provisions for adding new filters as plugins. .


  • Tslib needs the touch to be exposed as a device in the dev folder.
  • Calibration can only be performed on devices with frame buffer support.
  • Framebuffer needs write access.

Installing the tool

The tool can be installed form the standard repository of Ubuntu and Debian flavours, using the command:

sudo apt-get install libts-bin

or the tool can be compiled form sources. The steps described:

1. Clone the repository using the command.

git clone

2. Change to the tslib directory where the code was cloned. And run the command


3. Since tslib is generally used for cross compiled platforms like ARM the step here is described for the same. Run the command

./configure --prefix=/home/test-box/Project/tslib/output --host=arm-linux-gnueabi

Where the prefix denote the folder location of the build output will me stored.

4. Run the make and make install. This will copy the executables and the libraries in the prefix folder mentioned above.

Calibrating the touch

To calibrate the touch, follow the steps below:
1. Set the display (frame buffer), input device and config file to be used with the commands

export TSLIB_FBDEVICE=/dev/fbX
export TSLIB_TSDEVICE=/dev/input/eventY
export TSLIB_CONFFILE=/etc/ts.conf

X should be the number of the framebuffer mapped.
Y should be the event number.

2. Run the command ts_calibrate. A dark screen with cross hairs as shown is displayed. Touch at the 5 cross hairs to complete the calibration process.


3. The calibration can be tested using the ts_test utiliy.


4. The calibration is stored in the configuration file. Filters and plugins can be enabled using the ts.conf file.

module pthres pmin=1
module variance delta=30
module dejitter delta=100
module linear

5. The X – Window system can be configure to use the touchscreen driver by adding a InputDevice section to /etc/x11/xorg.conf

Section "InputDevice"
    Identifier "tslib"
    Driver "tslib"
    Option "ScreenNumber"   "0"
    Option "Width"      "800"
    Option "Height"     "480"
    Option "Rotate"     "NONE"
    Option "TslibDevice"    "/dev/input/event0"
    Option "CorePointer"

One thought on “Calibrating touch using tslib in Linux

  1. Pingback: Calibrating touch in Linux | Nibbling the bits

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s