tslib移植arm及使用
测试平台
宿主机平台:Ubuntu 12.04.4 LTS
目标机:Easy-ARM IMX283
目标机内核:Linux 2.6.35.3
tslib 1.4 下载 https://gitlab.com/tslib/tslib/-/archive/1.4/tslib-1.4.tar.gz
备注:建议用 tslib 1.0(测试正常)
tslib 1.4编译移植
1.tslib编译
tslib编译依赖
sudo apt-get install autoconf automake autogen libtool libsysfs-dev
解压,automake生成makefile
tar xzf tslib-1.4.tar.gz
cd tslib-1.4
./autogen.sh
出现以下问题
反映的是一些宏定义没有定义,aclocal是个扫描程序, 负责扫描configure.ac中所有的宏定义并展开;
出现上述应该是相关宏定义工具没有安装(但所有依赖工具均安装OK)或者 aclocal 出现问题;
查询 aclocal 路径
aclocal --print-ac-dir
但在对应目录却发现没有次目录 ,应该是不同版本安装、或系统升级导致文件夹丢失
chmod 777 /usr/local/share
将 usr/share/aclocal 文件夹拷贝到 /usr/local/share 下;
在此运行 ./autogen.sh
2. 编译配置、编译及安装
新建安装文件目录
mkdir -p install
chmod 777 install
编译配置
./configure --prefix=$(pwd)/install --host=arm-linux ac_cv_func_malloc_0_nonnull=yes CC=arm-fsl-linux-gnueabi-gcc
然后编译 make,出现错误
input-raw.c: In function 'check_fd':
input-raw.c:188: error: 'ABS_MT_PRESSURE' undeclared (first use in this function)
input-raw.c:188: error: (Each undeclared identifier is reported only once
input-raw.c:188: error: for each function it appears in.)
input-raw.c:199: error: 'ABS_MT_SLOT' undeclared (first use in this function)
input-raw.c: In function 'ts_input_read_mt':
input-raw.c:515: error: 'ABS_MT_PRESSURE' undeclared (first use in this function)
input-raw.c:520: error: 'ABS_MT_TOOL_X' undeclared (first use in this function)
input-raw.c:525: error: 'ABS_MT_TOOL_Y' undeclared (first use in this function)
input-raw.c:540: error: 'ABS_MT_DISTANCE' undeclared (first use in this function)
input-raw.c:577: error: 'ABS_MT_SLOT' undeclared (first use in this function)
make[2]: *** [input-raw.lo] 错误 1
make[2]:正在离开目录 `/home/vmuser/wtools/tslib-1.4/plugins'
make[1]: *** [all-recursive] 错误 1
make[1]:正在离开目录 `/home/vmuser/wtools/tslib-1.4'
make: *** [all] 错误 2
这主要是 tslib 1.4 的 input与 linux 内核的不匹配,使用高版本 linux 内核应该没有该问题
首先 交叉编译工具的 input.h 应该 与 使用Linux 内核 的 input,h 的 ENV_VERSION 一致;
tslib-1.4/plugins/input-raw.h
#ifndef ABS_MT_POSITION_X
#define ABS_MT_SLOT 0x2f /* MT slot being modified */
#define ABS_MT_TOUCH_MAJOR 0x30 /* Major axis of touching ellipse */
#define ABS_MT_TOUCH_MINOR 0x31 /* Minor axis (omit if circular) */
#define ABS_MT_WIDTH_MAJOR 0x32 /* Major axis of approaching ellipse */
#define ABS_MT_WIDTH_MINOR 0x33 /* Minor axis (omit if circular) */
#define ABS_MT_ORIENTATION 0x34 /* Ellipse orientation */
#define ABS_MT_POSITION_X 0x35 /* Center X touch position */
#define ABS_MT_POSITION_Y 0x36 /* Center Y touch position */
#define ABS_MT_TOOL_TYPE 0x37 /* Type of touching device */
#define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */
#define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */
#define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */
#define ABS_MT_DISTANCE 0x3b /* Contact hover distance */
#define ABS_MT_TOOL_X 0x3c /* Center X tool position */
#define ABS_MT_TOOL_Y 0x3d /* Center Y tool position */
#endif
而 Linux 2.6.35的内核的 也就是常用的 linux/input
#define ABS_MT_TOUCH_MAJOR 0x30 /* Major axis of touching ellipse */
#define ABS_MT_TOUCH_MINOR 0x31 /* Minor axis (omit if circular) */
#define ABS_MT_WIDTH_MAJOR 0x32 /* Major axis of approaching ellipse */
#define ABS_MT_WIDTH_MINOR 0x33 /* Minor axis (omit if circular) */
#define ABS_MT_ORIENTATION 0x34 /* Ellipse orientation */
#define ABS_MT_POSITION_X 0x35 /* Center X ellipse position */
#define ABS_MT_POSITION_Y 0x36 /* Center Y ellipse position */
#define ABS_MT_TOOL_TYPE 0x37 /* Type of touching device */
#define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */
#define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */
不支持某些触摸类型的定义,因此需要手动添加到顶层头文件中,因为后面的 ts_test_mt.c 也会使用
#define ABS_MT_SLOT 0x2f /* MT slot being modified */
#define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */
#define ABS_MT_DISTANCE 0x3b /* Contact hover distance */
#define ABS_MT_TOOL_X 0x3c /* Center X tool position */
#define ABS_MT_TOOL_Y 0x3d /* Center Y tool position */
我们将这些添加到 tslib-1.4/config.h 中,后面编译出错的文件 在头部添加 #include "config.h" 即可
我这里主要在以下文件添加
tslib-1.4/tools/ts_uinput.c
tslib-1.4/tests/ts_test_mt.c
tslib-1.4/tests/ts_print_mt.c
tslib-1.4/tests/ts_print_raw_mt.c
然后 make 正常
make inatall
可以看到该指定的安装目录instal下l有4 个文件夹 /bin 、 /etc 、 /lib 、 /include
3. tslib移植及测试
先将上面安装 install 文件见 拷贝到 nfs 调试目录 并命名为 tslib
通过nfs挂载将 tslib 下载到开发板的 /usr/local/下
root@EasyARM-iMX28x /mnt/vm_tools# cp -r tslib /usr/local/
修改开发板的环境变量文件,添加如下内容
vi /etc/profile
#指定 tslib 目录路径
export TSLIB_ROOT=/usr/local/tslib
#指定 tslib 插件文件的路径
export TSLIB_PLUGINDIR=$TSLIB_ROOT/lib/ts
#指定 tslib 配置文件的路径
export TSLIB_CONFFILE=$TSLIB_ROOT/etc/ts.conf
#指定触摸屏设备
export TSLIB_TSDEVICE=/dev/input/ts0
#指定校准文件的存放位置
export TSLIB_CALIBFILE=/etc/pointercal
#指定鼠标设备
export QWS_MOUSE_PROTO=/dev/input/ts0
#指定帧缓冲设备
export TSLIB_FBDEVICE=/dev/fb0
#添加 tslib 库
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$TSLIB_ROOT/lib
tslib测试:校准测试
cd /usr/local/tslib/bin
# ./ts_calibrate
开发板出现校准界面,则至此, tslib 的安装和移植已经成功完成。
触摸设备检测
hexdump /dev/input/event0
最新文章
- Java性能提示(全)
- KD Tree算法
- IDEA 升级14.1提示org/hibernate/build/gradle/publish/auth/maven/AuthenticationManager:Unsupported major.minor version 51.0
- git and github学习笔记
- 触摸与手势学习-swift
- PS仿制图章
- vim 支持gb2312
- 代码混淆 GSON完满解决
- Oracle数据库 拾漏补缺
- uva 1418 - WonderTeam
- 堪称神器的Chrome插件
- Ext z自写checkbox
- Ubuntu中eclipse端口被占
- LeetCode算法历程-01
- 【python小练】0014题 和 0015 题
- Unity骨骼动画资源解析与优化
- VS2015和SVN合作
- poj-1195(二维树状数组)
- android音乐播放器开发 SweetMusicPlayer 摇一摇换歌
- Highcharts.Chart