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 https://github.com/kergoth/tslib.git
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 &quot;InputDevice&quot; Identifier &quot;tslib&quot; Driver &quot;tslib&quot; Option &quot;ScreenNumber&quot; &quot;0&quot; Option &quot;Width&quot; &quot;800&quot; Option &quot;Height&quot; &quot;480&quot; Option &quot;Rotate&quot; &quot;NONE&quot; Option &quot;TslibDevice&quot; &quot;/dev/input/event0&quot; Option &quot;CorePointer&quot; EndSection