Difference between revisions of "Tslib"

From ArmadeusWiki
Jump to: navigation, search
(Compiling)
(Configuration details)
 
(30 intermediate revisions by 3 users not shown)
Line 1: Line 1:
Library to provide a common interface to touchscreen and allow touchscreen events filtering or calibrating...
+
Library which provides a common interface to touchscreen and allows touchscreen events filtering or calibrating...
  
==Compiling==
+
==Installation==
 +
Tslib is now installed by default on Armadeus SDK. For reference, installation instructions are kept [[Talk:Tslib|here]].
  
<span style="color:red">
+
==Configuration details==
This part is normaly not required on following distribution: ??
+
Most are now automatically done in recent Armadeus SDK releases. If you are interested, history is kept [[Talk:Tslib|here]].
This part is required on: Ubuntu 6.04, KUbuntu 6.10...
+
</span>
+
  
* Be sure to have '''libtool''' package installed (tested with 1.5.22-4 version). Otherwise you will have following errors:
+
{{Note| to work, Tslib requires that the corresponding touchscreen Linux driver has been loaded before. On APF9328/APF27, please have a look to [[TSC2102_Linux_driver]] if not already done. On [[APF51]](Wolfson) / [[APF28]](internal) / [[APF6Dev]](SX8654) driver is statically built inside Linux kernel and should auto detect the touchscreen controller.}}
configure.ac:25: error: possibly undefined macro: AC_DISABLE_STATIC
+
      If this token and others are legitimate, please use m4_pattern_allow.
+
      See the Autoconf documentation.
+
configure.ac:26: error: possibly undefined macro: AC_ENABLE_SHARED
+
configure.ac:27: error: possibly undefined macro: AC_LIBTOOL_DLOPEN
+
configure.ac:28: error: possibly undefined macro: AC_PROG_LIBTOOL
+
 
+
* Be sure to have '''automake-1.6 or higher''' package installed (tested with 1.7 version -> working and 1.9.6 -> not working !). After automake package installation don't forget to update your ''/etc/alternatives/automake'' and ''/etc/alternatives/aclocal'' symlinks (tested on Ubuntu).
+
lrwxrwxrwx 1 root root 20 2007-06-27 21:43 /etc/alternatives/aclocal -> /usr/bin/aclocal-1.7
+
lrwxrwxrwx 1 root root 21 2007-06-27 21:39 /etc/alternatives/automake -> /usr/bin/automake-1.7
+
 
+
<span style="color:red">
+
This part is MANDATORY
+
</span>
+
 
+
* In Buildroot, if you don't have configured the C++ cross-compiler yet, then:
+
$ make menuconfig
+
Toolchain Options  --->
+
  [*] Build/install c++ compiler and libstdc++?
+
  [*] Build/install a shared libgcc?
+
 
+
* After all these checks, then activate Tslib in Buildroot:
+
$ make menuconfig
+
[[Image:Menuconfig_package.png]]
+
$ make
+
 
+
* Or compile it directly:
+
$ make tslib
+
 
+
==Configuration details (automatically done)==
+
  
 
===Config file===
 
===Config file===
* To work, Tslib needs a valid config file ''/etc/ts.conf'':
+
* Tslib plugins can be tuned with ''/etc/ts.conf''. A default one is provided in all rootfs:
 +
<pre class="apf">
 
  # cat /etc/ts.conf
 
  # cat /etc/ts.conf
 
   
 
   
Line 49: Line 19:
 
  module dejitter delta=100
 
  module dejitter delta=100
 
  module linear
 
  module linear
 +
</pre>
  
 
===Envt variables===
 
===Envt variables===
* You should define some ENVT variables too:
+
* Some ENVT variables are needed too. By default they are defined in ''/etc/profile'':
 +
<pre class="apf">
 
  export TSLIB_TSDEVICE=/dev/input/event0
 
  export TSLIB_TSDEVICE=/dev/input/event0
 
  export TSLIB_TSEVENTTYPE=INPUT
 
  export TSLIB_TSEVENTTYPE=INPUT
 
  export TSLIB_CONFFILE=/etc/ts.conf
 
  export TSLIB_CONFFILE=/etc/ts.conf
 
  export TSLIB_CALIBFILE=/etc/pointercal
 
  export TSLIB_CALIBFILE=/etc/pointercal
 
+
</pre>
===Device file===
+
* If you have other input devices (like mouse or keyboard) and they have been detected by Linux before your touchscreen device, then you will probably need to adapt TSLIB_TSDEVICE variable.
* ''/dev/input/event0'' is created from the infos got from:
+
# cat /sys/class/input/event0/dev
+
13:64
+
# mkdir /dev/input
+
# cd /dev/input/
+
# mknod event0 c 13 64
+
# ls -al
+
drwxr-xr-x    2 root    root            0 Jan  1 00:39 .
+
drwxr-xr-x    5 root    root            0 Jan  1 00:39 ..
+
crw-r--r--    1 root    root      13,  64 Jan  1 00:39 event0
+
#
+
  
 
===Calibration===
 
===Calibration===
* ''/etc/pointercal'' is created when running Tslib calibration tool:
+
* Before first usage, a touchscreen needs to be calibrated. When starting, Tslib will look at ''/etc/pointercal'' to get calibration data. This file is created when running Tslib's calibration tool:
 +
<pre class="apf">
 
  # /usr/bin/ts_calibrate
 
  # /usr/bin/ts_calibrate
 +
</pre>
 +
[[Image:Tslib_calibrate.png]]
  
 
==Testing it==
 
==Testing it==
 
  # /usr/bin/ts_test
 
  # /usr/bin/ts_test
[[Image:Tslib_test.jpg]]
+
[[Image:Tslib_test.png]]
  
 
==Adding Tslib support to SDL==
 
==Adding Tslib support to SDL==
Work in progress...
+
[[SDL|SDL]] is by default compiled with Tslib support in current Buildroot distribution. You just have to make [[SDL|SDL]] knows the presence of Tslib when launching your  application with:
 +
<pre class="apf">
 +
export SDL_MOUSEDRV=TSLIB
 +
export SDL_MOUSEDEV=$TSLIB_TSDEVICE
 +
</pre>
 +
To have an example of a [[SDL|SDL]] application using Tslib, take a look at ''target/demos/backlight_control/'' sources.
  
 
==Adding Tslib support to Qt==
 
==Adding Tslib support to Qt==
Work in progress...
+
When selecting Qt in Buildroot menuconfig you can choose the input method to be Tslib. See [[Qt/Embedded#Installation|Qt installation]] for more informations.
  
 
==Links==
 
==Links==
Line 89: Line 58:
 
* http://www.openembedded.org/filebrowser/org.openembedded.packaged-staging/packages/tslib
 
* http://www.openembedded.org/filebrowser/org.openembedded.packaged-staging/packages/tslib
 
* http://linux-dvbh.blogspot.com/2006/12/tslib-download-and-cross-compile-for.html
 
* http://linux-dvbh.blogspot.com/2006/12/tslib-download-and-cross-compile-for.html
 +
* [http://www.opentom.org/LibSDL SDL & Tslib page of the OpenTomTom project]
 +
 +
[[Category:Touchscreen]]

Latest revision as of 10:16, 2 August 2019

Library which provides a common interface to touchscreen and allows touchscreen events filtering or calibrating...

Installation

Tslib is now installed by default on Armadeus SDK. For reference, installation instructions are kept here.

Configuration details

Most are now automatically done in recent Armadeus SDK releases. If you are interested, history is kept here.

Note Note: to work, Tslib requires that the corresponding touchscreen Linux driver has been loaded before. On APF9328/APF27, please have a look to TSC2102_Linux_driver if not already done. On APF51(Wolfson) / APF28(internal) / APF6Dev(SX8654) driver is statically built inside Linux kernel and should auto detect the touchscreen controller.


Config file

  • Tslib plugins can be tuned with /etc/ts.conf. A default one is provided in all rootfs:
 # cat /etc/ts.conf
 
 module_raw input
 module pthres pmin=1
 module variance delta=30
 module dejitter delta=100
 module linear

Envt variables

  • Some ENVT variables are needed too. By default they are defined in /etc/profile:
 export TSLIB_TSDEVICE=/dev/input/event0
 export TSLIB_TSEVENTTYPE=INPUT
 export TSLIB_CONFFILE=/etc/ts.conf
 export TSLIB_CALIBFILE=/etc/pointercal
  • If you have other input devices (like mouse or keyboard) and they have been detected by Linux before your touchscreen device, then you will probably need to adapt TSLIB_TSDEVICE variable.

Calibration

  • Before first usage, a touchscreen needs to be calibrated. When starting, Tslib will look at /etc/pointercal to get calibration data. This file is created when running Tslib's calibration tool:
 # /usr/bin/ts_calibrate

Tslib calibrate.png

Testing it

# /usr/bin/ts_test

Tslib test.png

Adding Tslib support to SDL

SDL is by default compiled with Tslib support in current Buildroot distribution. You just have to make SDL knows the presence of Tslib when launching your application with:

 export SDL_MOUSEDRV=TSLIB
 export SDL_MOUSEDEV=$TSLIB_TSDEVICE

To have an example of a SDL application using Tslib, take a look at target/demos/backlight_control/ sources.

Adding Tslib support to Qt

When selecting Qt in Buildroot menuconfig you can choose the input method to be Tslib. See Qt installation for more informations.

Links