搭建qt环境

一. 什么是QT

   a. Qt是一个1991年由Qt Company开发的跨平台C++图形用户界面应用程序开发框架。它既可以开发GUI程序,也可用于开发非GUI程序,比如控制台工具和服务器

二. tslib移植和测试

  2.1. 什么是tslib

      a. tslib是一个开源的触摸屏支持库。它给上层的应用程序, 为不同的触摸屏提供了一个统一的接口。它提供诸如滤波、去抖、校准之类的功能

  2.2. 部署tslib

    2.2.1. 获取tslib-1.4源文件

      a. 下载地址:https://github.com/kergoth/tslib#setup-and-configure-tslib

      b. tar -xvf tslib-1.4.tar.gz  

root@ubuntu:~/qt_porting# ls
tslib  tslib-1.4.tar.gz
root@ubuntu:~/qt_porting#
View Code

    2.2.2. 配置tslib

      2.2.2.1. cd tslib

      2.2.2.2. ./autogen.sh

        2.2.2.2.1. 问题1

          a. ./autogen.sh时报错:./autogen.sh: 4: autoreconf: not found,是因为系统中没有安装autoconf工具

          b. 解决办法:apt-get install autoconf automake libtool

        2.2.2.2.2. 问题2

          a. 修改config.h.in 把里面的#undef malloc,然后就编译通过了。

ts_test.o: In function `main':
ts_test.c:(.text+0x51c): undefined reference to `rpl_malloc'
fbutils.o: In function `open_framebuffer':
fbutils.c:(.text+0xbb4): undefined reference to `rpl_malloc'
collect2: ld returned 1 exit status
make[2]: *** [ts_test] Error 1
make[2]: Leaving directory `/root/qt_porting/tslib/tests'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/qt_porting/tslib'
make: *** [all] Error 2
View Code

      2.2.2.3. echo "ac_cv_func_malloc_0_nonnull=yes">arm-linux.cache 

        2.2.2.4. mkdir /opt/tslib

    2.2.3. 安装     

      a. make   

      b. make install     

root@ubuntu:/opt# ls
tslib
root@ubuntu:/opt# cd tslib/
root@ubuntu:/opt/tslib# ls
bin  etc  include  lib
root@ubuntu:/opt/tslib# 
View Code

     2.2.4. 修改ts.conf内容

      2.2.4.1. vi tslib/etc/ts.conf

        a. 去掉# module_raw input前面的注释,一定要注意中间的空格也去掉,module顶格。

        b. 注意一定要把 中间的空格也去掉不然就踩雷了,我踩雷被坑了很久

# Uncomment if you wish to use the linux input layer event interface
# module_raw input

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

  2.3. 开发板tslib测试

    2.2.3.1. 测试确认ts驱动部分

      a. cat /proc/bus/input/devices 可知gslX680对应的设备文件是event1
      b. cat /dev/input/event1

    2.3.2. 配置环境变量

        a. # vi /etc/profile

        b. profile添加如下内容

export TSLIB_ROOT=/usr/local/tslib
export TSLIB_TSDEVICE=/dev/input/event
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

    2.3.1. 测试

      2.3.1.1. 重启开发板

      2.3.1.2. 在 /usr/local/tslib/bin 目录下,输入./ts_calibrate

        2.3.1.2.1. 出现问题1

          a. 问题描述

[root@musk210 bin]# ./ts_calibrate 
./ts_calibrate: error while loading shared libraries: libts-0.0.so.0: cannot open shared object file: No such file or diy
[root@musk210 bin]#
View Code

          b. 解决方法

root@ubuntu:~/qt_porting/tslib# find -name "libts-0.0.*"
./src/.libs/libts-0.0.so.0.1.1
./src/.libs/libts-0.0.so.0
root@ubuntu:~/qt_porting/tslib# ls
acinclude.m4      compile        configure.ac  ltmain.sh    README
aclocal.m4        config.guess   COPYING       m4           src
arm-linux.cache   config.h       CVS           Makefile     stamp-h1
AUTHORS           config.h.in    depcomp       Makefile.am  tests
autogen-clean.sh  config.log     etc           Makefile.in  tslib-0.0.pc
autogen.sh        config.status  INSTALL       missing      tslib.pc.in
autom4te.cache    config.sub     install-sh    NEWS
ChangeLog         configure      libtool       plugins
root@ubuntu:~/qt_porting/tslib# cd src/.libs/
root@ubuntu:~/qt_porting/tslib/src/.libs# ls libts-0.0.so.0
libts-0.0.so.0
root@ubuntu:~/qt_porting/tslib/src/.libs# cp libts-0.0.so.0 /root/x210_porting/rootfs/rootfs/usr/lib/
root@ubuntu:~/qt_porting/tslib/src/.libs# 
View Code

        2.3.1.2.2. 出现问题2

          a. 问题描述

[root@musk210 bin]# ls
ts_calibrate  ts_harvest    ts_print      ts_print_raw  ts_test
[root@musk210 bin]# ./ts_test 
selected device is not a touchscreen I understand
^Csignal 2 caught
[root@musk210 bin]#
View Code

          b. 解决办法

            参考:https://www.cnblogs.com/weidongshan/p/8336427.html

            大致是:以下提供两种解决方法

              1.将内核源代码里的include/linux/input.h中的

                #define EV_VERSION 0x010001

                改为:

                #define EV_VERSION 0x010000          

              2.将arm交叉编译工具中的头文件库中的

                linux/input.h中的

                #define EV_VERSION 0x010000

                改为

                #define EV_VERSION 0x010001

              然后再编译tslib库

      2.3.1.2. 在 /usr/local/tslib/bin 目录下,输入./ts_test继续测试。测试OK

          

      

 

转载于:https://www.cnblogs.com/linux-37ge/p/10306583.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值