天天看点

tslib-1.4移植记录

sudo apt-get install autoconf

sudo apt-get install automake

sudo apt-get install libtool

将tslib-1.4.tar.gz解压路径/share/freescale/appdir/tslib

./autogen.sh

./configure --prefix=/usr/local/tslib --host=arm-linux ac_cv_func_malloc_0_nonnull=yes

make

make install-strip

将output打包,拷贝到文件系统制作目录usr/local/tslib,解压。

将bin文件中的ts_calibrate,ts_test拷贝到rootfs/bin中,删除etc

在etc下加入文件pointercal、ts.conf

在etc/profile中添加(不能有空格)

export TSLIB_ROOT=/usr/local/tslib

export TSLIB_TSDEVICE=/dev/event0

export TSLIB_CALIBFILE=/etc/pointercal

export TSLIB_CONFFILE=/etc/ts.conf

export TSLIB_PLUGINDIR=$TSLIB_ROOT/lib/ts

export TSLIB_CONSOLEDEVICE=none

export TSLIB_FBDEVICE=/dev/fb0

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$TSLIB_ROOT/lib

遇到的问题

In file included from /usr/include/fcntl.h:252:0,

                 from /usr/include/sys/fcntl.h:1,

                 from ts_calibrate.c:20:

In function ‘open’,

    inlined from ‘main’ at ts_calibrate.c:227: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

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

make[2]: Leaving directory `/home/ouyang/Downloads/tslib/tests'

make[1]: *** [all-recursive] Error 1

make[1]: Leaving directory `/home/ouyang/Downloads/tslib'

make: *** [all] Error 2

gcc 新版本编译器对语法检查严格,在源文件 ./tests/ts_calibrate.c 中

// 源文件

// if ((calfile = getenv("TSLIB_CALIBFILE")) != NULL) {

//     cal_fd = open (calfile, O_CREAT | O_RDWR);

// } else {

//   cal_fd = open ("/etc/pointercal", O_CREAT | O_RDWR);

// }

// 需要更改成如下形式

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);

}