最近交叉编译了tslib-1.4,把主要过程和要注意的地方写下来,并在mini2440开发板和友善2.6.29内核实验成功。
1-./autogen.sh
2-echo ac_cv_func_malloc_0_nonnull=yes>$ARCH-linux.cache
3-./configure --host=$ARCH-linux --prefix=/usr/local --cache-file=$ARCH-linux.cache --enable-inputapi=no
--enable-inputapi=no:看你的触摸屏驱动是否支持ioctl操作,如果支持就不用写上,不支持就要添上,如果不添加会有
ts_open:Inappropriate ioctol for device
ts_open: No such file or directory
等错误(网上别人的文档是这么说的,我没有试过不加这个参数会怎样,感兴趣的试一下)
4-编译并安装后会在/usr/local(可以随意指定,但是最好要和你的开发板的路径相同,我试过一次不同时,运行./ts_calibrate,会报not found的错误)下有
bin,etc,include,lib,在你的开发板上的相同路径建立这些文件夹,并把关于tslib的相关东西考到这些文件内。
5-/etc/ts.conf配置
module_raw input
module pthres pmin=1
module variance delta=30
module dejitter delta=100
module linear
6-在你的开发板的/etc/profile文件里添加运行tslib的环境变量(一定要放到/etc/profile,我放到/etc/init.d/rcS里就没有作用,愿因是export只能在当前shell和它的子shell有用,不能影响登录的shell)
# /etc/profile
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/arm/X11R6/bin
export PATH
export TSLIB_ROOT=/usr/local
export TSLIB_TSDEVICE=/dev/event0(你的开发板dev下的触摸屏设备节点文件)
export TSLIB_CALIBFILE=/etc/pointercal
export TSLIB_CONFFILE=$TSLIB_ROOT/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(这句我注释掉的原因是:有一种说法是使用
LD_LIBRARY_PATH这样设置不安全,我的做法是把路径添加到/etc/ld.so.conf文件中,然后执行ldconfig命令,这样就可
以了。ldconfig在你的交叉编译工具里就有)
这样大概就差不多了,运行./ts_calibrate如果还提示ts_open: No such file or directory,用env命令看一下,当前系统是否有你设置的tslib环境变量,
没有的话会提示这个错误的,我在第一次设置/etc/profile文件就没有好使,修改了一下,重启系统就好用了。
运行./ts_calibrate进行触摸屏校准,再运行./ts_test测试效果
以上文档是在参考很多网上的帖子并经过实践后写的,感谢这些帖子的作者和帮助过我的人,谢谢了
tslib-1.4 交叉编译和分析文档
|
|
|
revision:在文章末尾将不断增加新信息,是网上发现的比较好的文章等.以相应日期标出.
操作前提: 本文假定你已经会用交叉工具链(cross chain)。会在客户机上挂载(mount)主机上的文件系统了。 本文是在linux发行版本fedora core 5下进行的,其他linux发行版下如何还没有尝试。 本文只针对arm-linux-gcc交叉工具链。所用的交叉工具链名为arm-linux-gcc-3.4.1,网上很容易找到的二进制包是arm-linux-gcc-3.4.1.tar.bz2。 所用的tslib版本为tslib-1.4,因为它比1.3有大大改进,很多问题都可以避免了,用tslib-1.4,难度大大降低。
本文档分为三部分。内容主要集中在三点: I.编译过程。 II.调试成功的一些预备概念(重要)。 III.在开发板上用tslib测试程序进行校准。 IV.tslib-1.4源代码分析。 V.从tslib中还能学到什么:在linux动态链接库编程中的参考价值,编写shell。 VI.attached file 1.the tontext of tslib1.4 $PREFIX/etc/ts.conf 2.the tontext of tslib1.3 $PREFIX/etc/ts.conf 3.config info 4.make info 5.the final files remained on $PREFIX 6.use "set" to check the env variable
正文: I .compile tslib 1.4: #export PREFIX=/path_to_your_tslib_1.4_dir #export CC=/path/to/your/cross-compiler-binary。
/* autogen.sh is an important .sh file,it produce ./configure file according to current env setting */ #./autogen.sh #echo "ac_cv_func_malloc_0_nonnull=yes" >arm-linux.cache /*(it is better to see what parameter that the ./configure program take,use "./configure --help") *you can add "--enable-debug"([default=no]),and/or "--enable-static"([default=no]) */ #./configure --host=arm-linux --prefix=$PREFIX --cache-file=arm-linux.cache #make #make install
II .important tips on testing tslib on target board 1.check and "mknod" your device driver file . the tslib uses linux (udev type driver?) input-event interface and tslib-plugins to support different ts.(e.g: collie,to support a ts named Sharp Zaurus SL-5500/SL-5000d). but pay attention that intslib-1.3 ,no "input.so" plugin compile even configured with --enable-inputapi. And in tslib-1.4,the input.so is built defaultly when configured(see your $PREFIX/lib/ts/,after make install).if your ts uses linux input-event interface,then uncomment the line #module_raw input in $PREFIX/etc/ts.conf ,otherwise uncomment the corresponding line # module_raw xxxxx in $PREFIX/etc/ts.conf. note: only when your linux support input-event interface ,can you use the "input.so".in my arm board,the kernel shows some messages(detailed:http://blog.chinaunix.net/u2/61322/showart_1313716.html, http://blog.chinaunix.net/u2/61322/showart_1309157.html) at boot time ,including : ts: Compaq touchscreen protocol output s3c-buttons s3c-buttons: successfully loaded input: s3c-buttons as /class/input/input0 s3c2410 TouchScreen successfully loaded input: s3c2410 TouchScreen as /class/input/input1 it means that this ts uses input-event interface,the ts driver is now built in. To use it as a device file ,just mknod the driver-node : mknod /dev/input/event1 c 13 64. (TouchScreen,detailed see above secondary url.number 13 and 64 ,please reference to the $your_LINUX_KERNEL_dir/drivers/devices.txt). another dev file need to make is mknod /dev/fb0 c 29 0
2.check and set correct environment variable. belove is the environment variable of tslib-1.3 and tslib-1.4, note that they differ only in $TSLIB_ROOT and $TSLIB_PLUGINDIR.and this only depends on the author's preference. if you like ,just change the path value in source code .
tslib1.3 ENV_SET 3 export TSLIB_ROOT=/path_to_tslib1.3/build ( it is your $PREFIX dir) 4 export TSLIB_TSDEVICE=/dev/input/event1 5 export TSLIB_CALIBFILE=/etc/pointercal 6 export TSLIB_CONFFILE=$TSLIB_ROOT/etc/ts.conf 7 export TSLIB_PLUGINDIR=$TSLIB_ROOT/share/ts/plugins 8 export TSLIB_CONSOLEDEVICE=none 9 export TSLIB_FBDEVICE=/dev/fb0 10 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$TSLIB_ROOT/lib 11 tslib1.4 ENV_SET 13 export TSLIB_ROOT=/mnt/test/tmp/tslib1.4/build (your $PREFIX dir) 14 export TSLIB_TSDEVICE=/dev/input/event1 15 export TSLIB_CALIBFILE=/etc/pointercal 16 export TSLIB_CONFFILE=$TSLIB_ROOT/etc/ts.conf 17 export TSLIB_PLUGINDIR=$TSLIB_ROOT/lib/ts 18 export TSLIB_CONSOLEDEVICE=none 19 export TSLIB_FBDEVICE=/dev/fb0 20 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$TSLIB_ROOT/lib III .test ts on target board. after mknod and set the env variable in your board linux (and suppose you have mount your program to board),you now need to execute program: $PREFIX_TSLIB_MOUNTED_DIR/bin/ts_calibrate note: if you copy your $PREFIX dir to board ,just run the same program. if ok,a cross with circule and a line of word appear on screen.then you touch the middle of the cross ,and do the same when another corss appear. five times will be ok .then,a file named "pointercal" is created under your $TSLIB_CALIBFILE. this file contains the accurate info about your ts. it is all finished. some other program in "bin" dir ,can be used to test if the ts work correct or not. e.g:run ts_test.and you touch the screen,then a cross with follow the touched point.that will be fine. IV.tslib-1.4源代码分析 续 V.从tslib中还能学到什么: 1.linux动态链接库编程,续 2.编写shell,续
编译输出附件 reference: http://blog.chinaunix.net/u2/61322/showart.php?id=1335340
[补]
2009.3.13: 说明: 今天无意间又看到相关网络文档几篇,把链接记录如下:
触摸屏TSLIB部分主要参考文档: http://blog.chinaunix.net/u1/49993/showart_409612.html
2440 qtopia zz在UTU-2440上移植Qtopia4与TSLIB http://blog.chinaunix.net/u1/39383/showart_1853496.html 该文章的引文也很有价值. #end
2009.4.4
另外一篇,谈到qt3.3.5和tslib的合作编译。 摘要如下: qtopia已经可以使用触摸屏了。但是qtopia里面的qt为qt2,太旧了。为此仍然希望采用qte3来设计应用程序。
要让qte-3.3.5支持触摸屏有两种途径:
l 采用2.4的驱动结构,传送TS_event到qte中,按上面方法配置qte。
l 采用2.6的驱动结构,由于这个驱动传递的信息是到input层,qte不能直接获取,因此需要用到tslib,而此时,需要想办法让qte3.3.5支持tslib。Howto?
3. 使qte3.3.5支持tslib,按照patch的方法,增加两个文件到src/embedded/下,修改相应文件(src/embedded/qmousedriverfactory_qws.cpp, src/embedded/qt_embedded.pri,configure),其余同1。
./configure –embedded arm –thread –qvfb –qconfig-large –qt-mouse-tslib –I$QTDIR/include –L$QTDIR/lib –lts ....
http://blog.chinaunix.net/u2/75270/showart_1793535.html
| |
阅读(5449) | 评论(0) | 转发(0) |