tslib1.4的编译与移植

来源:互联网 发布:mac ps6 抠图插件下载 编辑:程序博客网 时间:2024/05/21 07:50

基于s3c2410的tslib1.4的编译与移植

环境:S3C2410 linux tslib1.41.交叉编译tslib
过程如下:

解压;

#./autogen.sh
#./configure --prefix=/home/duancp/mytslib/ --host=arm-linux(这句所选择安装目录,注意) ac_cv_func_malloc_0_nonnull=yes (可以先生成个shell文件)

#make

#make install-strip //生成瘦身应用程序和库 

可能出现的错误及解答过程:(摘自:http://blog.csdn.net/gfocean/archive/2010/01/2/5266847.aspx)
错误1:
./autogen.sh错误提示:
root@ppcst-desktop:/home/ppcst/software/tslib# ./autogen.sh 
Can't exec "aclocal": 没有该文件或目录 at /usr/bin/autoreconf2.50 line 182.
Use of uninitialized value in pattern match (m//) at /usr/bin/autoreconf2.50 line 182.
Can't exec "automake": 没有该文件或目录 at /usr/bin/autoreconf2.50 line 183.
Use of uninitialized value in pattern match (m//) at /usr/bin/autoreconf2.50 line 183.
Can't exec "aclocal": 没有该文件或目录 at /usr/share/autoconf/Autom4te/FileUtils.pm line 290.
autoreconf2.50: failed to run aclocal: 没有该文件或目录
解决方法:apt-get install automake


错误2:
Can't exec "libtoolize": No such file or directory at /usr/bin/autoreconf line 190.

Use of uninitialized value $libtoolize in pattern match (m//) at /usr/bin/autoreconf line 190.

configure.ac:25: error: possibly undefined macro: AC_DISABLE_STATIC

If this token and others are legitimate, please use m4_pattern_allow.

See the Autoconf documentation.

configure.ac:26: error: possibly undefined macro: AC_ENABLE_SHARED

configure.ac:27: error: possibly undefined macro: AC_LIBTOOL_DLOPEN

configure.ac:28: error: possibly undefined macro: AC_PROG_LIBTOOL

autoreconf: /usr/bin/autoconf failed with exit status: 1

解决方法:在ubuntu下安装libtool.deb或者更新用命令:apt-get install libtool



错误3:

ts_test.o(.text+0x218): In function `main':

: undefined reference to `rpl_malloc'

fbutils.o(.text+0x234): In function `open_framebuffer':

: undefined reference to `rpl_malloc'

collect2: ld returned 1 exit status

make[2]: *** [ts_test] Error 1

make[2]: Leaving directory `/home/gfpeak/Desktop/tslib/tests'

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

make[1]: Leaving directory `/home/gfpeak/Desktop/tslib'

make: *** [all] Error 2

解决方法是在编译的时候./configure后面的参数没有设置对,正确设置如下:

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


错误4:

在开发板上运行校正程序时出现No raw modules loaded

解决方法是把 tslib/etc目录下的ts.conf 的 "#module_raw input"的注释符号“#”去掉。但记住不要在前面留有 空格 ,否则会出现错误4

错误5:
在开发板上运行校正程序时出现Segmentation fault
解决方法是看错误3。

2.tslib的移植
过程如下:
a.到/home/duancp/mytslib/下(你在./configure时设置的目录下)把mytslib下载到开板
/mnt/yaffs/(下载方式可参考文章 下载方式)
b.设置环境变量如下:(或者写成shell形式)
export T_ROOT=/mnt/yaffs/mytslib
export LD_LIBRARY_PATH=$T_ROOT/lib
export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_TSDEVICE=/dev/input/event0
export TSLIB_PLUGINDIR=$T_ROOT/lib/ts
export TSLIB_CONFFILE=$T_ROOT/etc/ts.conf
export TSLIB_CALIBFILE=/mnt/yaffs/pointercal( #tslib配置文件内容)我没有到 这 个文件,应该不设置也行

解释:
TSLIB_TSDEVICE //触摸屏设备文件名 
Default (no inputapi): /dev/touchscreen/ucb1x00 
Default (inputapi): /dev/input/event0 
TSLIB_CALIBFILE //校准的数据文件,由ts_calibrate 校准程序生成 
Default: ${sysconfdir}/pointercal 
TSLIB_CONFFILE //配置文件名 
Default: ${sysconfdir}/ts.conf 
TSLIB_PLUGINDIR //插件目录 
Default: ${datadir}/plugins 
TSLIB_CONSOLEDEVICE //控制台设备文件名 
Default: /dev/tty 
TSLIB_FBDEVICE //FrameBuffer设备名 
Default: /dev/fb0 
以上环境变量在实际开发中的实际配置可以根据实际情况决定。 
c.修改mytslib/etc/ts.conf文件,要不会出现错误2
使ts.conf文件如下:
module_raw input
module pthres pmin=1
module variance delta=30
module dejitter delta=100
module linear 
即把tslib/etc目录下的ts.conf 的 "#module_raw input"的注释符号“#”去掉,不要在前面留有空格。
d. cd bin
./ts_test(执行测试程序即可,你可以在屏幕上看到测试点,则成功了)
注意:触摸屏的前提是你的触摸屏驱动已经写好,并加载进了内核.你可以测试有没有加载触摸屏驱动,cat /dev/input/event0(这只是我的板子上的触摸屏) ,手摸触摸屏,看终端有无显示,若有则表明正确。 如无则要加上触摸屏的驱动 insmod touchscreen.o(此驱动自己找)

编译tslib1.4的错误和解决方法:(摘自:http://blog.csdn.net/gfocean/archive/2010/01/28/5266847.aspx)
错误1:

ts_test.o(.text+0x218): In function `main':

: undefined reference to `rpl_malloc'

fbutils.o(.text+0x234): In function `open_framebuffer':

: undefined reference to `rpl_malloc'

collect2: ld returned 1 exit status

make[2]: *** [ts_test] Error 1

make[2]: Leaving directory `/home/gfpeak/Desktop/tslib/tests'

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

make[1]: Leaving directory `/home/gfpeak/Desktop/tslib'

make: *** [all] Error 2

解决方法是在编译的时候./configure后面的参数没有设置对,正确设置如下:

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


错误2:

在开发板上运行校正程序时出现No raw modules loaded

解决方法是把 tslib/etc目录下的ts.conf 的 "#module_raw input"的注释符号“#”去掉。但记住不要在前面留有 空格 ,否则会出现错误4


错误3:

在开发板上运行校正程序时出现Segmentation fault

解决方法是看错误2

错误4:
ts_open: No such file or directory 
环境变量没有设置好



移植tslib  

系统环境
操作系统:ubuntu 12.0 32位
开发板:TQ2440
交叉工具链:   arm-linux-gcc 4.4.3 天嵌版本

移植Tslib1 下载源码tslib-x.x.tar.gz  地址:http://sourceforge.net/projects/tslib.berlios/?source=directory2 解压,cd tslib3 生成configure  ./autogen.sh
4 配置,生成Makefile  ./configure --host=arm-none-linux-gnueabi(平台) --prefix=/(安装目录)
  --enable-debug=no ac_cv_func_malloc_0_nonnull=yes
 例:#./configure --prefix=/opt/tslib-1.0 --host=arm-linux --enable-debug=no ac_cv_func_malloc_0_nonnull=yes
5 编译  make6 安装  make install  在指定的安装目录下生成/bin  /etc  /lib /include文件夹,并放入相应的文件。如果
相应的文件夹已经在,则把相应的文件放入对应的文件夹。7 运行测试程序,配置参数

prefix后面是安装目录,自己随便定义,装好后修改/opt/tslib-1.0/etc/ts.conf,去掉module_raw input 前面的#号,然后把/opt/tslib-1.0里的文件都拷入开发板,比如我放在了/usr/local里。再配置开发板的环境变量,让tslib能正常工作。

1
2
3
4
5
export set TSLIB_FBDEVICE=/dev/fb0
export set TSLIB_TSDEVICE=/dev/event4
export set TSLIB_CONFFILE=/usr/local/etc/ts.conf
export set TSLIB_CALIBFILE=/etc/pointercal
export set TSLIB_PLUGINDIR=/usr/local/lib/ts

运行/usr/local/bin中的ts_calibrate进行校准,成功的话会出现界面,并让你点击十字符号,完成后会生成/etc/pointercal文件,这是触摸屏的校准配置文件。


遇到的问题:
1.在autogen时出错,提示

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

这是因为系统没有安装automake,装上就行了。

1
aptitude install autoconf automake libtool

2.在make时出错,提示

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

这是因为open函数的语法不符合最新的gcc,在/tests/ts_calibrate.c中加入open的第三个参数:

1
2
3
4
5
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);
}
TsLib介绍:tslib背景:在采用触摸屏的移动终端中,触摸屏性能的调试是个重要问题之一,因为电磁噪声的缘故,
触摸屏容易存在点击不准确、有抖动等问题。tslib是一个开源的程序,能够为触摸屏驱动获
得的采样提供诸如滤波、去抖、校准等功能,通常作为触摸屏驱动的适配层,为上层的应用
提供了一个统一的接口。Tslib较准原理:在Qtopia 中,就触摸屏的调试问题主要涉及到以下三个部分:触摸屏驱动、Tslib、QTslibTPanelHandlerPrivate 封装。触摸屏驱动为与硬件直接接触部分,为上层的Tslib 提供最原始的设备坐标数据,并可以配置
采样间隔、屏幕灵敏度等。采样间隔决定了单位时间内的采样数量,在其他参数不变的情况下,
采样间隔越小意味着单位时间内的采样数量越多,也就意味着采样越逼真、越不容易出现采样
信息丢失如输入法书写时丢笔划的情况,但因为噪声的影响,采样间隔越小同时也意味着显示
出来的图形的效果越差。 Tslib 为触摸屏驱动和应用层之间的适配层,其从驱动处获得原始的设备坐标数据,通过
一系列的去噪、去抖、坐标变换等操作,来去除噪声并将原始的设备坐标转换为相应的屏幕坐标。 在tslib 中为应用层提供了2 个主要的接口ts_read()和ts_read_raw(),其中ts_read()为
正常情况下的借口,ts_read_raw()为校准情况下的接口。 正常情况下,tslib 对驱动采样到的设备坐标进行处理的一般过程如下:raw device --> variance --> dejitter --> linear --> applicationmodule module module 校准情况下,tslib 对驱动采样到的数据进行处理的一般过程如下:raw device--> CalibrateQTslibTPanelHandlerPrivate 为tslib 提供了应用层封装,为tslib 与应用层的接口部分。 在触摸屏调试过程中,涉及到的参数主要有采样间隔(驱动)、灵敏度(驱动)、去噪算法及约束(tslib)、去抖算法及约束(tslib)、ts 门槛值(tslib)。 由于各种相关期间的影响,在不同的硬件平台上,相关参数可能需要调整。以上参数的相互关系为:采样间隔越大,采样点越少,采样越失真,但因为信息量少,容易出现丢笔划等丢失信息情况,但表现出来的图形效果将会越好;去噪算法跟采样间隔应密切互动,采样间隔越大,去噪约束应越小,反之采样间隔越小,去噪约束应越大。去抖算法为相对独立的部分,去抖算法越复杂,带来的计算量将会变大,系统负载将会变重,但良好的去抖算法可以更好的去除抖动,在进行图形绘制时将会得到更好的效果;灵敏度和ts 门槛值为触摸屏的
灵敏指标,一般不需要进行变动,参考参考值即可。pthres 为Tslib 提供的触摸屏灵敏度门槛插件;variance 为Tslib 提供的触摸屏滤波算法插件;
dejitter 为Tslib 提供的触摸屏去噪算法插件;linear 为Tslib 提供的触摸屏坐标变换插件

参考:http://wuyuans.com/2012/11/qt4-8-3-transplant/
      http://www.cnblogs.com/uvsjoh/archive/2011/08/25/2152947.html

QT移植(4.8.5)  

一.移植QT库:
系统环境
操作系统: ubuntu 12.0 32位
开发板: TQ2440
交叉工具链:   arm-linux-gcc 4.4.3 天嵌版本

1.下载源码: Qt libraries 4.8.5 for embedded Linux (230 MB) (Info)
  下载地地址:http://qt-project.org/downloads

2.配置
./configure-prefix/opt/qt-4.8.3-arm -embedded arm -release -shared -fast -no-largefile -qt-sql-sqlite -qt3support -no-xmlpatterns -no-glib -no-phonon -no-mmx -no-3dnow -no-sse -no-sse2 -no-svg -webkit -qt-zlib -qt-libtiff -qt-libpng -qt-libjpeg -makelibs -nomake examples -nomake docs -nomake demo -no-nis -no-cups -iconv -no-dbus -openssl -xplatform qws/linux-arm-g++ -little-endian -qt-freetype -depths 16,24,32 -qt-gfx-linuxfb -qt-gfx-transformed -qt-gfx-multiscreen -no-gfx-vnc -no-gfx-qvfb -qt-kbd-linuxinput -no-kbd-qvfb -armfpa -no-mouse-qvfb -qt-mouse-linuxtp -qt-mouse-tslib -DQT_QLOCALE_USES_FCVT-I/opt/tslib-1.0/include-L/opt/tslib-1.0/lib

PS:-prefix/opt/qt-4.8.3-arm(第4步执行make install 安装目录)
-I/opt/tslib-1.0/include-L/opt/tslib-1.0/lib(tslib 的相应目录(请参考上一篇文章《移植tslib》))

3.编译
make

4.安装
make install
5.运行

配置选项要根据自己的硬件选取,这样编译出来的库文件才会比较小。装好后把目录下的imports、lib、mkspecs 、plugin文件夹拷到开发板上的/opt/Qt目录下,目录随便,和环境变量里的一致就行。然后配置开发板的环境变量(vi /etc/profile),让他能找到Qt。

1
2
3
4
5
6
7
8
9
10
11
exportset QTDIR=/opt/Qt
exportset QPEDIR=/opt/Qt
exportset LD_LIBRARY_PATH=$QTDIR/lib:/usr/local/lib:$LD_LIBRARY_PATH
exportset QT_QWS_FONTDIR=$QTDIR/lib/fonts/
exportset QWS_SIZE=800x480
exportset QWS_DISPLAY="LinuxFb:mmWidth80:mmHeight120:0"
exportset QWS_DISPLAY="LinuxFB:/dev/fb0"
exportset QT_PLUGIN_PATH=$QTDIR/plugins/
exportset QWS_KEYBOARD="TTY:/dev/tty1"
exportset QWS_MOUSE_PROTO="TSLIB:/dev/event4"
exportPATH=$QTDIR/bin:$PATH



二.配置Qt creator:
1.添加编译器:
QT移植(4.8.5) - dengbenling - dengbenling的博客
点击:添加-》GCC
填写:名称(如:arm-linux-)
加入编译器路径(交叉工具链名称):(如:/opt/EmbedSky/4.3.3/bin/arm-linux-gcc)
2.添加Qt版本
QT移植(4.8.5) - dengbenling - dengbenling的博客
点击:添加
填写:名称(如:qmake-4.8)
加入qmake路径(上面移植QT库时的安装路径(可以先把bin/qmake改名为 qamke-4.8(自我感觉这样会方便一点))):(如:/opt/qt-4.8.3-arm/bin/qmake-4.8)
3.添加构建套件:
QT移植(4.8.5) - dengbenling - dengbenling的博客
点击添加然后按上图配置把前两步添加的Qt版本和编译器加入即可。
4.为项目添加构建:
QT移植(4.8.5) - dengbenling - dengbenling的博客
新建一个项目后,打开上图页面,点击添加构建套件,把上一步完成的“构建套件”加入即可。编译出来的Qt project 即为嵌入式版本的Qt project 

参考:http://wuyuans.com/2012/11/qt4-8-3-transplant/

0 0
原创粉丝点击