tslib移植

环境:Ubuntu,交叉编译器,tslib-1.4

移植步骤:

第一步:获取tslib的源码

使用git获取tslib源码:

$ git clone https://github.com/15903016222/tslib.git
$ cd tslib

第二步:编译,安装tslib-1.4

注意:在编译tslib之前确认自己的电脑上已经安装了automake autoconf libtool libsysfs-dev软件

sudo apt-get install automake autoconf libtool libsysfs-dev

开始编译,安装

  1. clean源码

./autogen-clean.sh

  1. 自动配置

./autogen.sh

注意:如果没有安装automake autoconf,则这一步会报以下错误

如果没有安装libtool libsysfs-dev,则会报以下错误

ws@ws:~/project/tslib$ ./autogen.sh 
configure.ac:24: 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:25: error: possibly undefined macro: AC_ENABLE_SHARED
configure.ac:26: error: possibly undefined macro: AC_LIBTOOL_DLOPEN
configure.ac:27: error: possibly undefined macro: AC_PROG_LIBTOOL
autoreconf: /usr/bin/autoconf failed with exit status: 1

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

If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
autoreconf: /usr/bin/autoconf failed with exit status: 1
  1. 为configure做准备, 防止编译时出错

    echo “ac_cv_func_malloc_0_nonnull=yes” > tmp.cache

  2. 配置

./configure –host=arm-linux –cache-file=tmp.cache –prefix=/opt/project/tslib CC=/stuff/bitbake/bin/tmp/sysroots/i686-linux/usr/armv7a/bin/arm-linux-gcc

–prefix=/opt/project/tslib // 安装路径 (注意一定要写自己的安装路径)

CC=/stuff/bitbake/bin/tmp/sysroots/i686-linux/usr/armv7a/bin/arm-angstrom-linux-gnueabi-gcc // 指定编译器的绝对路径(注意:必须是绝对路径,否则报错) (注意一定是你交叉编译器的arm-linux-gcc的绝对安装路径)

  1. 编译 安装

make && make install

如果你的安装路径需要权限,可以使用下边的命令

sudo make install

这一步也可能出错,对于一些编译器可能会出错

如果一直报 以下错误

tslib line 8968: arm-angstrom-linux-gnueabi-gcc: command not found

install: error: relink `linear.la’ with the above command before install
说明你的3. ./configure 没有正确配置CC这个环境变量

第三步:配置,测试移植的tslib

测试移植网上有很多,以下参考:

将安装路径下的整个tslib文件夹,下载至开发班的上,我存放的路径为/usr/local

$ vi /etc/profile

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

其中,TSLIB_ROOT更换为自己实际存放的路径;

另外,TSLIB_TSDEVICE 和QWS_MOUSE_PROTO这两项需要查看自己的板子的触摸屏设备对应/dev/input/下那个文件

测试:

重启开发板

使用ts_calibare 测试触摸屏是否可以校准即可

tslib移植,测试参考网址:http://blog.163.com/zhuandi_h/blog/static/180270288201222310291262/

猜你喜欢

转载自blog.csdn.net/kang99827765/article/details/80946083
今日推荐