Tslib是一个开源的程序,能够为触摸屏驱动获得的采样提供诸如滤波、去抖、校准等功能,通常作为触摸屏驱动的适配层,为上层的应用提供了一个统一的接口。在Qtopia 4.*版本中,默认的Tslib版本为Tslib 1.4。在Qtopia 2.*版本中,默认的Tslib版本为Tslib 1.3
把 tslib1.4.tar.gz 文件放到 /tmp/ 目录下
1.解压缩:tar -zxvf tslib1.4.tar.gz
2.运行./autogen.sh
3.运行./configure --prefix=/usr/local/tslib --host=arm-linux(这里不要改,是指运行平台) ac_cv_func_malloc_0_nonnull=yes
4.make
在make之前要修改/tests/ts_calibrate.c文件中的open函数的参数个数问题,如下:
5.make install,在虚拟机下的/usr/local/tslib/下生成触摸屏运行库。
6.编译过程出现的两个问题:
6.1.错误
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
6.2在make时出错,提示
In function ‘open’,
inlined from ‘main’ at ts_calibrate.c:229:11:
/usr/include/bits/fcntl2.h:51:24: error: call to ‘__open_missing_mode’ declared with attribute error: open with O_CREAT in second argument needs 3 arguments
make[2]: *** [ts_calibrate.o] Error 1
解决方法:
这是因为open函数的语法不符合最新的gcc,在/tests/ts_calibrate.c中加入open的第三个参数0777:
if ((calfile = getenv("TSLIB_CALIBFILE")) != NULL) {
cal_fd = open (calfile, O_CREAT | O_RDWR, 0777);
} else {
cal_fd = open ("/etc/pointercal", O_CREAT | O_RDWR, 0777);
}