关于嵌入式x86平台tslib1.4+qt4.8.4移植

由于我的嵌入式平台为x86的。网上大多数资料都是ARM平台的。可能x86的更简单些,但是我也遇到不少问题。过程和问题如下:
tslib版本 tslib 1.4
 下载地址:http://download.csdn.net/detail/mmz_xiaokong/4980129
qt版本:4.8.4
 下载地址: http://qt-project.org/downloads
触摸屏控制器:penmount 6000 usb

1、编译tslib 1.4
    ./configure --prefix=/usr/local/qte/tslib/
                sudo make;sudo make install
2、修改ts.conf内容

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

           module_raw input
           module pthres pmin=1
           module variance delta=30
           module dejitter delta=100
           module linear
3、开发板配置环境变量

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

      添加如下内容(绿色):


export TSLIB_ROOT=/usr/local/qte/tslib
export TSLIB_TSDEVICE=/dev/input/event4
export TSLIB_CALIBFILE=/etc/pointercal
export TSLIB_CONFFILE=$TSLIB_ROOT/etc/ts.conf  
export TSLIB_PLUGINDIR=$TSLIB_ROOT/lib/ts
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_CONSOLEDEVICE=none
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$TSLIB_ROOT/lib    

如下注释
           export TSLIB_ROOT=/usr/local/qte/tslib
           export TSLIB_TSDEVICE=/dev/input/event4    指定触屏设备
           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 directory KDSETMODE: Bad file descriptor ” 的错误
           export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$TSLIB_ROOT/lib

4、执行测试命令
./bin/ts_calibrate ./bin/test

*********************************************************************** 问题汇总 ***********************************************************************

问题1:

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

    是在不同版本的 tslib 下执行 autogen.sh 产生。它们产生的原因一样,是
    因为没有安装automake 工具,      (ubuntu 10.04)用下面的命令安装好就可以了。

    sudo apt-get install autoconf automake libtool

问题2:

     错误:    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] 错误 1
        make[2]:正在离开目录 `/home/kongdepeng/work/QTE_DSF/tslib/tests'
        make[1]: *** [all-recursive] 错误 1
        make[1]:正在离开目录 `/home/kongdepeng/work/QTE_DSF/tslib'
        make: *** [all] 错误 2
    解决办法:
    gcc 新版本编译器对语法检查严格,在源文件 ./tests/ts_calibrate.c 中
    // 源文件
    // if ((calfile = getenv("TSLIB_CALIBFILE")) != NULL) {
    //     cal_fd = open (calfile, O_CREAT | O_RDWR);
    // } else {
    //   cal_fd = open ("/etc/pointercal", O_CREAT | O_RDWR);
    // }
    // 需要更改成如下形式
    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);

问题3:

     ./ts_calibrate: error while loading shared libraries: libts-0.0.so.0: cannot open shared object file: Error 40
./ts_calibrate: error while loading shared libraries: libts-0.0.so.0: cannot open shared object file: No such file or directory
解决方法:
#echo $LD_LIBRARY_PATH              // 查看lib路径
#export LD_LIBRARY_PATH=$TSLIB_ROOT/lib

问题4:
ts_open: No such file or directory
解决方法:
#export TSLIB_TSDEVICE=/dev/input/event0     // 触摸屏设备路径

问题5:
Couldnt open tslib config file: No such file or directory
ts_config: Illegal seek
解决方法:
#export TSLIB_CONFFILE=$TSLIB_ROOT/etc/ts.conf

问题6:
Couldnt load module pthres No raw modules loaded.
ts_config: Success
解决方法:
#export TSLIB_PLUGINDIR=$TSLIB_ROOT/lib/ts

问题7:
No raw modules loaded.
ts_config: No such file or directory
解决方法:
修改$TSLIB_ROOT/etc/ts.conf,至少放开一个module_raw,打开tslib-1.4/etc/ts.conf文件,
去掉其中一个modules_raw前面的#符号,并删除空格即可并去掉前面空格

问题8:
framebuf cannot connect
需要打开framebuf
就是在grub.conf启动列表的kernel最后添加vga参数
如 kernel /bzImage vga=789 root=/dev/ram rw splash=silent quiet
色彩     640x400     640x480     800x600     1024x768     1280x1024     1600x1200
4bits     ?     ?     0x302     ?     ?     ?
8bits     0x300     0x301     0x303     0x305     0x307     0x31C
15bits     ?     0x310     0x313     0x316     0x319     0x31D
16bits     ?     0x311     0x314     0x317     0x31A     0x31E
24bits     ?     0x312     0x315     0x318     0x31B     0x31F
32bits     ?     ?     ?     ?     ?     ?

问题9:elected device is not a touchscreen I understand
查看源码后,将input_raw.c的代码替换为pm6000(触摸屏控制器名)的代码。
http://www.pudn.com/downloads50/sourcecode/embed/detail170685.html
http://people.linux.org.tw/~fred/drivers/pm6000_tslib.tgz
或者编译后,将ts-config中的pm6000打开。
需要了解的可以看readme

问题10:如何得知你的触摸屏设备节点
cat /proc/bus/input/devices
看看哪个是你的  ts 设备。正确设置你的event.


问题11:kernel正确的触摸屏驱动,测试并确认/dev/input中的输入设备,假设测试event1设备文件是否为触摸屏设备文件:

      cat /dev/input/mice | hexdump  触控触摸屏将有数据在终端输出,如下解析了,如何进行测试。不是所有的设备都是一样的节点,这个可以自己进行测试。

/dev/input/mouse4 是我的 。


问题12:由网友测试触摸屏不准确的问题如下:
 -------------------------------------------------------------------------------------------------------------

现象:点击触摸屏有反映,但是触点与鼠标图标之间总是有距离,而且距离随着触控操作变化: 如,点击屏角,使触控点和鼠标位置很接近,

          随后的触控操作能保持这种近距离, 但随着后继触控操作距离会变化.

问题分析:触摸屏有反映说明tslib有触控事件送往QWSTslibMouseHandler,怀疑只是送往QWSTslibMouseHandler的坐标信息未矫正

=> 直接运行tslib的配套工具 ts_calibrate, 并用ts_test验证,坐标校验成功,但是Qt应用程序仍然存在触点偏移。

=> google 类似问题,多为校验问题,有些文章提到QWS_MOUSE_PROTO显示指定鼠标事件来源,结合以上总结,怀疑是否使Qt默认没有使用正确的鼠标事件.  Qt for Embedded Linux Pointer Handling 证明了这点: Note that Qt for Embedded Linux does not support auto-detection of touch panels in which case the driver must be specified explicitly to determine which device to use.

=> QWS_MOUSE_PROTO

    

Specifies the driver for pointer handling. For example, if the current shell is bash, ksh, zsh or sh:
export QWS_MOUSE_PROTO=<driver>[:<driver specific options>]

<driver>  areMouseMan,IntelliMouse,Microsoft,VR41xx,LinuxTP,Yopy,Tslib

                andkeys  identifying custom drivers. (即此参数同对应QMouseDriverFactory或QMouseDriverPlugin的keys()返回的字符串)

<driver specific options> are typically a device, e.g.,/dev/mouse for mouse devices and/dev/ts for touch panels. 确认设备的方法: 如,测试/dev/input/mice 是否是输入设备: cat /dev/input/mice | hexdump, 测试移动鼠标应该有数据输出

Multiple mouse drivers can be specified in one go:
export QWS_MOUSE_PROTO="<driver>[:<driver specific options>] <driver>[:<driver specific options>] <driver>[:<driver specific options>]"

=> 使用cat发现目标设备的触摸屏设备文件为/etc/input/event1, 所以设置export QWS_MOUSE_PROTO=tslib:/etc/input/event1, 累计偏移故障消失

=> 为同时使用USB鼠标,用cat发现/etc/input/mice为USB鼠标输入,所以设置:export QWS_MOUSE_PROTO="tslib:/etc/input/event1 interlliMouse:/etc/input/mice". 此时USB鼠标可用,但是触摸屏鼠标又出现累计偏差,怀疑和mice (mouse的复数)有关,是否mice是一个叠加输入?

应该有单独输入的设备文件.

=> 用cat测试/dev/input下的设备文件,发现USB鼠标的输入文件还有/dev/input/mouse1, 反过来触控触摸屏/dev/input/mice也有输出,但是比较event1与mice的数据发现不同

=> QWS_MOUSE_PROTO中针对USB鼠标和触摸屏分别使用各自独立的设备文件export QWS_MOUSE_PROTO="tslib:/etc/input/event1 interlliMouse:/etc/input/mouse1", 问题解决.

=> 结论: mice是所有鼠标设备的设备文件(USB/PS2鼠标 或 触摸屏鼠标等), 其可能源自mouse1,event1, 并且其数据做了处理, mice作为默认鼠标设备文件优先使用, 而tslib需要的是提供原生触摸屏数据的event1,导致触摸屏定位总有偏差




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

关于qt4.8.4的移植,在下一篇中说明。

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值