Porting the generic touch screen calibration program tslib

1. Download tslib-1.4.tar.gz

http://download.csdn.net/source/3177449 

2. Unzip and install tslib

# tar -zxvf tslib-1.4.tar.gz
# cd tslib
# ./autogen.sh echo "ac_cv_func_malloc_0 _nonnull=yes">arm-linux.cache

 

./autogen.sh: 4: ./autogen.sh: autoreconf: not found

Reason: It is generated by executing autogen.sh under different versions of tslib. They are generated for the same reason,
because the automake tool is not installed
sudo apt-get install autoconf automake libtool

# ./configure --host=arm-linux --cache-file=arm-linux.cache --enable-inputapi=no -prefix=/home/edu/share/foif_lcd_touch 
# make

Error:


ts_test.o: In function `main':
ts_test.c:(.text+0x1d8): undefined reference to `rpl_malloc'
fbutils.o: In function `open_framebuffer':
fbutils.c:(.text+0xa20): undefined reference to `rpl_malloc'
collect2: ld returned 1 exit status
解决办法:在./configure中加入ac_cv_func_malloc_0_nonnull=yes

./configure --host=arm-linux --prefix=/home/edu/sgare/foif_lcd_touch ac_cv_func_malloc_0_nonnull=yes --enable-inputapi=no

# make install

illustrate:

(1)  The red "0" is the number 0 ; (2)   /home/edu/share/foif_lcd_touch indicates the path after tslib is installed

3. Modify the content of ts.conf

# vi /usr/local/tslib/etc/ts.conf

module_raw input
module pthres pmin=1
module variance delta=30
module dejitter delta=100
module linear

然后将整个tslib文件夹,下载到开发板的对应路径下(/usr/local)。

4、开发板配置环境变量

通过超级终端,# vi /etc/profile

添加如下内容(绿色):

export TSLIB_ROOT=/usr/local/tslib
export TSLIB_TSDEVICE=/dev/input/event0 指定触屏设备
export TSLIB_CALIBFILE=/etc/pointercal
 指定触摸屏校准文件 pintercal 的存放位置
export TSLIB_CONFFILE=$TSLIB_ROOT/etc/ts.conf 指定 TSLIB 配置文件的位置
export TSLIB_PLUGINDIR=$TSLIB_ROOT/lib/ts 指定触摸屏插件所在路径
export TSLIB_FBDEVICE=/dev/fb0 指定帧缓冲设备
export TSLIB_CONSOLEDEVICE=none 设定控制台设备为 none ,否则默认为 /dev/tty ,这样可以避免出现 open consoledevice: No such file or directoryKDSETMODE: Bad file descriptor  的错误
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$TSLIB_ROOT/lib

另外,要确保在/dev/input/目录下有event0设备文件,在/dev/目录下有fb0设备文件,如果没有,在执行下面./ts_calibrate 的时候,会报出“open *: No such file or directory ”的错误,这时,我们需要手动创建设备文件:

# mknod /dev/input/event0 c 13 64
# mknod /dev/fb0 c 29 0

5、执行测试命令

重启开发板,在 /usr/local/tslib/bin 目录下,输入./ts_calibrate,出现tslib的触摸屏五点校准画面,至此,tslib的安装移植成功完成。

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325768774&siteId=291194637