Leapster Explorer: tslib Touchscreen Library

From eLinux.org
Revision as of 20:45, 23 September 2010 by Reggie (Talk | contribs)

Jump to: navigation, search

Background

Tslib is an abstraction layer for touchscreen panel events, as well as a filter stack for the manipulation of those events. Examples of implemented filters include jitter smoothing and the calibration transform. Tslib is generally used on embedded devices to provide a common user space interface to touchscreen functionality.

Building tslib

Follow the steps below to build tslib for Leapster Explorer. (We leverage the existing event device)

Download tslib from the github repository:

git clone http://github.com/kergoth/tslib.git


In the tslib directory, create a folder called build:

cd tslib
mkdir build


Set up your cross compiler's environment variables accordingly (ex: source crosscompile)

First time configuration requires that you run tslib autogen.sh script to generate configure script:

./autogen.sh


Now you can configure the compilation:

./configure --build=i386-linux --host=arm-linux --target=arm --prefix=$PWD/build

Compile tslib

make

Populate the build directory with the result

make install

edit .build/etc/ts.conf file and change line 2 so it looks like this:

module_raw input

Copy the etc/ts.conf file to the LX in the /etc directory.

Copy the contents of lib to the LX in the /usr/lib directory.

Copy the contents of bin to the LX into a directory of your choosing.


Add the following lines to the LX file called /etc/profile:

export TSLIB_TSEVENTTYPE=INPUT
export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_TSDEVICE=/dev/input/event3                                         
export TSLIB_CALIBFILE=/etc/pointercal                                          
export TSLIB_CONFFILE=/etc/ts.conf                                              
export TSLIB_PLUGINDIR=/usr/lib/ts

Then, 'source' the file:

. /etc/profile

Once that is done, boot the fbdev kernel, modprobe lf1000_ts, then run ts_calibrate and ts_test.

To include this library in your applications: Copy the contents of lib to your compiler's lib directory (in buildcross: sys-root/usr/lib) Copy the contents of include to your compiler's include directory (in buildcross: sys-root/usr/include)

To Do

Using tslib in your applications.