1、Tslib简介
在采用触摸屏的移动终端中,触摸屏性能的调试是个重要问题之一,因为电磁噪声的缘故,触摸屏容易存在点击不准确、有抖动等问题。
Tslib是一个开源的程序,能够为触摸屏驱动获得的采样提供诸如滤波、去抖、校准等功能,通常作为触摸屏驱动的适配层,为上层的应用提供了一个统一的接口。
2、交叉编译Tslib可能遇到问题
step-1 ./autogen.sh
可能会遇到找不到autoconf 和 automake的问题。
解决办法:
apt-get install autoconf automake libtool
step-2 echo "ac_cv_func_malloc_0 _nonnull=yes">arm-none-linux-gnueabi.cache
创建一个假的文件arm-none-linux-gnueabi.cache 骗过configure
step-3 ./configure --host=arm-none-linux-gnueabi --cache-file=arm-none-linux-gnueabi.cache --enable-inputapi=no -prefix=/root/targetfs/usr
设置安装目录为 /usr 把文件系统原来自带的tslib程序覆盖掉,有人建议设置目录为 /root/targetfs/usr/local/tslib 也可以的。
step-4 make && make install
可能遇到的问题 libtool 错误 提示的log信息大体如下:
----------------------------------------------------
make[2]: Entering directory `/root/QT_4.6.3/tslib/src'
/bin/sh ../libtool --tag=CC --mode=compile arm-none-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I.. -DPLUGIN_DIR=\"/root/targetfs/usr/local/tslib/lib/ts/\" -DTS_CONF=\"/root/targetfs/usr/local/tslib/etc/ts.conf\" -DTSLIB_INTERNAL -fvisibility=hidden -DGCC_HASCLASSVISIBILITY -O2 -Wall -W -MT ts_attach.lo -MD -MP -MF .deps/ts_attach.Tpo -c -o ts_attach.lo ts_attach.c
../libtool: line 777: X--tag=CC: command not found
../libtool: line 810: libtool: ignoring unknown tag : command not found
../libtool: line 777: X--mode=compile: command not found
../libtool: line 927: *** Warning: inferring the mode of operation is deprecated.: command not found
../libtool: line 928: *** Future versions of Libtool will require -mode=MODE be specified.: command not found
../libtool: line 1071: Xarm-none-linux-gnueabi-gcc: command not found
../libtool: line 1071: X-DHAVE_CONFIG_H: command not found
../libtool: line 1071: X-I.: command not found
../libtool: line 1071: X-I..: command not found
../libtool: line 1071: X-DPLUGIN_DIR="/root/targetfs/usr/local/tslib/lib/ts/": No such file or directory
../libtool: line 1071: X-DTS_CONF="/root/targetfs/usr/local/tslib/etc/ts.conf": No such file or directory
../libtool: line 1071: X-DTSLIB_INTERNAL: command not found
../libtool: line 1071: X-fvisibility=hidden: command not found
../libtool: line 1071: X-DGCC_HASCLASSVISIBILITY: command not found
../libtool: line 1071: X-O2: command not found
../libtool: line 1071: X-Wall: command not found
../libtool: line 1071: X-W: command not found
../libtool: line 1071: X-MT: command not found
../libtool: line 1071: Xts_attach.lo: command not found
../libtool: line 1071: X-MD: command not found
../libtool: line 1071: X-MP: command not found
../libtool: line 1071: X-MF: command not found
../libtool: line 1071: X.deps/ts_attach.Tpo: No such file or directory
../libtool: line 1071: X-c: command not found
../libtool: line 1119: Xts_attach.lo: command not found
../libtool: line 1124: libtool: compile: cannot determine name of library object from `': command not found
make[2]: *** [ts_attach.lo] Error 1
make[2]: Leaving directory `/root/QT_4.6.3/tslib/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/QT_4.6.3/tslib'
make: *** [all] Error 2
----------------------------------------------------
解决办法:
cd ~/QT_4.6.3/tslib
gedit ./libtool & --->打开libtool文件
搜索$echo(注意小写),用$ECHO (大写)代替。
可能遇到的问题: undefined reference to rpl_malloc
----------------------
ts_test.o: In function `main':
ts_test.c:(.text+0x1dc): undefined reference to `rpl_malloc'
fbutils.o: In function `open_framebuffer':
fbutils.c:(.text+0x500): undefined reference to `rpl_malloc'
collect2: ld returned 1 exit status
make[2]: *** [ts_test] Error 1
make[2]: Leaving directory `/root/QT_4.6.3/tslib/tests'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/QT_4.6.3/tslib'
make: *** [all] Error 2
----------------------
解决办法:
gedit ./config.h ,搜索rpl_malloc 在其前面加上如下语句即可
在./config.h里加上#undef rpl_malloc
step-5: 编辑ts.conf文件
按照如下修改
-------------------------------------
module_raw input
module pthres pmin=1
module variance delta=30
module dejitter delta=100
module linear