1 下载
版本:1.1
(1)下载:下载地址:https://github.com/kergoth/tslib/releases/download/1.11/tslib-1.11.tar.bz2
(2)解压:
tar xjvf tslib-1.11.tar.bz2
2 准备环境
(1)安装lib32stdc++6
sudo apt install lib32stdc++6
(2)编译
(3)环境准备
执行:./autogen.sh
可能出现的错误:
错误1:
./autogen.sh
Can’t exec “aclocal”: 没有该文件或目录 at /usr/bin/autoreconf2.50 line 182.
Use of uninitialized value in pattern match (m//) at /usr/bin/autoreconf2.50 line 182.
Can’t exec “automake”: 没有该文件或目录 at /usr/bin/autoreconf2.50 line 183.
Use of uninitialized value in pattern match (m//) at /usr/bin/autoreconf2.50 line 183.
Can’t exec “aclocal”: 没有该文件或目录 at /usr/share/autoconf/Autom4te/FileUtils.pm line 290.
autoreconf2.50: failed to run aclocal: 没有该文件或目录
解决方法:apt-get install automake
错误2:
Can't exec "libtoolize": No such file or directory at /usr/bin/autoreconf line 190.
Use of uninitialized value $libtoolize in pattern match (m//) at /usr/bin/autoreconf line 190.
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
autoreconf: /usr/bin/autoconf failed with exit status: 1
解决方法:在ubuntu下安装libtool.deb或者更新用命令:apt-get install libtool
3 build tslib
echo ac_cv_func_malloc_0_nonnull=yes>arm-linux.cache
./configure --prefix=/usr/local/tslib/ --host=arm-linux --cache-file=arm-linux.cache
make
make install
(1)出现错误:
ts_test.o(.text+0x218): In function main': : undefined reference to
rpl_malloc’
这个加上 ac_cv_func_malloc_0_nonnull=yes 的处理就可以了。
配置文件内容:
4 tslib运行环境设置
(1)环境变量设置:可以设置在开机启动脚本中,编辑 rc.local
# Qt environment configure
export QWS_DISPLAY="LinuxFb:mmWidth152:mmHeight126:0"
export QWS_SIZE="640x480"
export TSLIB_ROOT=/usr/local/tslib
export TSLIB_TSDEVICE=/dev/input/event0
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_PLUGINDIR=/usr/local/tslib/lib/ts
export TSLIB_CONSOLEDEVICE=none
export TSLIB_CONFFILE=/etc/ts.conf
export TSLIB_CALIBFILE=/etc/pointercal
export TSLIB_TSEVENTTYPE=INPUT
export QWS_MOUSE_PROTO=tslib:/dev/input/event0
export LD_LIBRARY_PATH=$TSLIB_ROOT/lib:$LD_LIBRARY_PATH
(2)tslib配置文件设置/etc/ts.conf文件:
# Uncomment if you wish to use the linux input layer event interface
module_raw input
# Uncomment if you're using a Sharp Zaurus SL-5500/SL-5000d
# module_raw collie
# Uncomment if you're using a Sharp Zaurus SL-C700/C750/C760/C860
# module_raw corgi
# Uncomment if you're using a device with a UCB1200/1300/1400 TS interface
# module_raw ucb1x00
# Uncomment if you're using an HP iPaq h3600 or similar
# module_raw h3600
# Uncomment if you're using a Hitachi Webpad
# module_raw mk712
# Uncomment if you're using an IBM Arctic II
# module_raw arctic2
module pthres pmin=1
module variance delta=30
module dejitter delta=100
module linear
5 测试
将编译成的tslib 目录复制到目标板上。放在 /usr/local/tslib 位置。
然后执行:
./ts_calibrate
屏幕上将出现屏幕校准的十字图标,点击图标位置进行校准。