一、首先編譯東山老師之前在linux-2.6.22.6寫的s3c_ts.c及其Makefile,以便測試tslib:
修改Makefile:
把: KERN_DIR = /work/system/linux-2.6.22.6
改爲:KERN_DIR = /work/system/linux-3.4.2
make,出現下面錯誤:
/work/drivers_and_test/11th_ts/8th/s3c_ts.c:14:33: error: asm/plat-s3c24xx/ts.h: No such file or directory
/work/drivers_and_test/11th_ts/8th/s3c_ts.c:16:31: error: asm/arch/regs-adc.h: No such file or directory
/work/drivers_and_test/11th_ts/8th/s3c_ts.c:17:32: error: asm/arch/regs-gpio.h: No such file or directory
修改s3c_ts.c,去掉下面幾行
14 //#include <asm/plat-s3c24xx/ts.h>
15
16 //#include <asm/arch/regs-adc.h>
17 //#include <asm/arch/regs-gpio.h>
再make,即可。
把s3c_ts.ko拷貝到開發板文件系統下。
二、編譯安裝tslib:
tar xzf tslib-1.4.tar.gz
cd tslib
./autogen.sh
mkdir tmp
echo "ac_cv_func_malloc_0_nonnull=yes" >arm-linux.cache
./configure --host=arm-linux --cache-file=arm-linux.cache --prefix=$(pwd)/tmp
make
make install
安裝:
cp tmp/* -rfd /work/nfs_root/fs_mini_mdev_new
測試:
insmod s3c_ts.ko
ts_calibrate
ts_open: No such file or directory
需重新exprot 一下這些東東:
export TSLIB_TSDEVICE=/dev/event0
export TSLIB_CALIBFILE=/etc/pointercal
export TSLIB_CONFFILE=/etc/ts.conf
export TSLIB_PLUGINDIR=/lib/ts
export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=/dev/fb0
ts_calibrate
Segmentationfault //或No raw modules loaded.
vi /etc/ts.conf, 增加:
module_raw input //要頂格,否則會Segmentationfault
ts_calibrate
selected device is not a touchscreen I understand
查看下面兩個input.h文件的EV_VERSION
/usr/local/arm/4.3.2/arm-none-linux-gnueabi/libc/usr/include/linux/input.h
#define EV_VERSION 0x010000
linux-3.4.2/include/linux/input.h
#define EV_VERSION 0x010001
修改其中一個EV_VERSION,使之與另一個一樣。
rm tmp/* -rf
重新編譯tslib
執行ts_calibrate,OK。
執行ts_test,效果: