1.解压:tar zxf
tslib-1.4.tar.gz
2.cd tslib/
3.运行autogen.sh脚本:./autogen.sh,报错: ./autogen.sh: 4: ./autogen.sh: autoreconf: not found,解决方法:sudo apt-get install autoconf automake libtool
4.echo "ac_cv_func_malloc_0_nonnull=yes">arm-linux.cache,指定交叉编译工具链:export CC=arm-linux-gcc,编译完成后清除该环境变量。
5.配置:./configure --host=arm-linux --cache-file=arm-linux.cache --enable-inputapi=no --prefix=$(pwd)/tmp
6.编译: make -j8,报错:
In file included from /usr/include/fcntl.h:252:0,
from /usr/include/x86_64-linux-gnu/sys/fcntl.h:1,
from ts_calibrate.c:20:
In function ‘open’,
inlined from ‘main’ at ts_calibrate.c:227:11:
/usr/include/x86_64-linux-gnu/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
调用open函数,如果在第二个参数中使用了 O_CREAT,就必须添加第三个参数:创建文件时赋予的初始权限。修改tests/ts_calibrate.c文件的第227行和地230行,添加文件的操作模式:
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);
}
7.安装:make install,在tmp目录下会生成如下4个目录:bin etc include lib
8.修改etc/ts.conf文件,将第二行的# module_raw input改为module_raw input,去掉#和#后面的空格,使module_raw input顶格。
9.复制相关文件到根文件系统:
cd tmp
cp bin/* ~/work/TQ2440/rootfs/usr/bin/
cp etc/ts.conf ~/work/TQ2440/rootfs/etc/
cp lib/*so* lib/ts/ ~/work/TQ2440/rootfs/lib/ -rfd
10.设置开发板环境变量,编辑文件/etc/profile,增加如下环境变量:
export TSLIB_TSDEVICE=/dev/event0
export TSLIB_CONFFILE=/etc/ts.conf
export TSLIB_PLUGINDIR=/lib/ts
export TSLIB_CALIBFILE=/etc/pointercal
export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=/dev/fb0
由于2.6.32.2内核没有S3C2440的触摸屏驱动程序,所以需要自己写驱动,驱动下载: s3c2410_ts.c,将其放置到drivers/input/touchscreen/目录下。
修改drivers/input/touchscreen/Makefile文件,添加:
obj-$(CONFIG_TOUCHSCREEN_S3C2410) += s3c2410_ts.o
修改drivers/input/touchscreen/Kconfig文件,添加:
config TOUCHSCREEN_S3C2410
tristate "S3C2410 touchscreen"
default y
配置内核支持触摸屏:make menuconfig
Device Drivers --->
Input device support --->
Touchscreens --->
S3C2410 touchscreen
测试:
[root@hyt /]#ts_calibrate
xres = 480, yres = 272
[root@hyt /]#ts_print
1672.962986: 268 114 1
1672.980670: 271 118 1
1673.000717: 271 116 1
1673.010105: 270 115 0
1673.161616: 254 98 1
1673.180680: 257 99 1
1673.206115: 258 100 0
1673.385819: 237 53 1
1673.405687: 237 54 1
1673.431282: 237 55 0
[root@hyt /]#ts_test
2.cd tslib/
3.运行autogen.sh脚本:./autogen.sh,报错: ./autogen.sh: 4: ./autogen.sh: autoreconf: not found,解决方法:sudo apt-get install autoconf automake libtool
4.echo "ac_cv_func_malloc_0_nonnull=yes">arm-linux.cache,指定交叉编译工具链:export CC=arm-linux-gcc,编译完成后清除该环境变量。
5.配置:./configure --host=arm-linux --cache-file=arm-linux.cache --enable-inputapi=no --prefix=$(pwd)/tmp
6.编译: make -j8,报错:
In file included from /usr/include/fcntl.h:252:0,
from /usr/include/x86_64-linux-gnu/sys/fcntl.h:1,
from ts_calibrate.c:20:
In function ‘open’,
inlined from ‘main’ at ts_calibrate.c:227:11:
/usr/include/x86_64-linux-gnu/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
调用open函数,如果在第二个参数中使用了 O_CREAT,就必须添加第三个参数:创建文件时赋予的初始权限。修改tests/ts_calibrate.c文件的第227行和地230行,添加文件的操作模式:
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);
}
7.安装:make install,在tmp目录下会生成如下4个目录:bin etc include lib
8.修改etc/ts.conf文件,将第二行的# module_raw input改为module_raw input,去掉#和#后面的空格,使module_raw input顶格。
9.复制相关文件到根文件系统:
cd tmp
cp bin/* ~/work/TQ2440/rootfs/usr/bin/
cp etc/ts.conf ~/work/TQ2440/rootfs/etc/
cp lib/*so* lib/ts/ ~/work/TQ2440/rootfs/lib/ -rfd
10.设置开发板环境变量,编辑文件/etc/profile,增加如下环境变量:
export TSLIB_TSDEVICE=/dev/event0
export TSLIB_CONFFILE=/etc/ts.conf
export TSLIB_PLUGINDIR=/lib/ts
export TSLIB_CALIBFILE=/etc/pointercal
export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=/dev/fb0
由于2.6.32.2内核没有S3C2440的触摸屏驱动程序,所以需要自己写驱动,驱动下载: s3c2410_ts.c,将其放置到drivers/input/touchscreen/目录下。
修改drivers/input/touchscreen/Makefile文件,添加:
obj-$(CONFIG_TOUCHSCREEN_S3C2410) += s3c2410_ts.o
修改drivers/input/touchscreen/Kconfig文件,添加:
config TOUCHSCREEN_S3C2410
tristate "S3C2410 touchscreen"
default y
配置内核支持触摸屏:make menuconfig
Device Drivers --->
Input device support --->
Touchscreens --->
S3C2410 touchscreen
测试:
[root@hyt /]#ts_calibrate
xres = 480, yres = 272
[root@hyt /]#ts_print
1672.962986: 268 114 1
1672.980670: 271 118 1
1673.000717: 271 116 1
1673.010105: 270 115 0
1673.161616: 254 98 1
1673.180680: 257 99 1
1673.206115: 258 100 0
1673.385819: 237 53 1
1673.405687: 237 54 1
1673.431282: 237 55 0
[root@hyt /]#ts_test