7.1 tslib安装以及使用

交叉编译

下载地址:https://github.com/kergoth/tslib/releases?after=1.5

平台:NXP IMX6UL

1.配置

➜  tslib-1.4 ./autogen.sh
➜  tslib-1.4 source ../../set_env.sh
➜  echo "ac_cv_func_malloc_0_nonnull=yes" > arm-linux.cache 
➜ ./configure --host=arm-linux --cache-file=arm-linux.cache --prefix=$(pwd)/_install 
CC=arm-linux-gnueabihf-gcc
  1. 编译安装
make 
make install

3.查看

➜  cd _install/bin 
➜  file ts_calibrate 
ts_calibrate: ELF 32-bit LSB  executable, ARM, EABI5 version 1 (SYSV), 
dynamically linked (uses shared libs), for GNU/Linux 2.6.16, 
BuildID[sha1]=334e4e8989ff1b63e4c97092f8456360d52153c4, not stripped

一步成功。


平台:全志 A40I
库版本:tslib-1.4

1.配置

➜  tslib-1.4 ./autogen.sh
➜  tslib-1.4 source ../../set_env.sh
➜  echo "ac_cv_func_malloc_0_nonnull=yes" > arm-linux.cache 
➜ ./configure --host=arm-linux --cache-file=arm-linux.cache --prefix=$(pwd)/_install
 CC=arm-linux-gnueabihf-gcc
  1. 编译安装
make 

报错

error: ‘ABS_MT_TOOL_X’ undeclared (first use in this function)

解决:
a. 修改config.h文件:

vim config.h +4
+ #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 */ 

b. 修改ts_uinput.c 文件:

vim tools/ts_uinput.c +22
+ #include 
  1. 重新编译安装
make
make install
  1. 查看
➜  cd _install/bin
➜  ls
ts_calibrate  ts_harvest  ts_print_mt   ts_print_raw_mt  ts_test_mt
ts_finddev    ts_print    ts_print_raw  ts_test          ts_uinput
➜  ts_calibrate 
ts_calibrate: ELF 32-bit LSB  executable, ARM, EABI5 version 1 (SYSV), 
dynamically linked (uses shared libs), for GNU/Linux 2.6.16, 
BuildID[sha1]=645eee9813a9230c7212edac1612a359a92e22c5, not stripped

5.arm开发板上测试
报错:
ts_config: No such file or directory



平台:全志 A40I
库版本:tslib-1.14

1.配置

➜  tslib-1.14 ./autogen.sh
➜  tslib-1.14 source ../../set_env.sh
➜  echo "ac_cv_func_malloc_0_nonnull=yes" > arm-linux.cache 
➜ ./configure --host=arm-linux --cache-file=arm-linux.cache --prefix=$(pwd)/_install
 CC=arm-linux-gnueabi-gcc
  1. 编译安装
make 
make install

3.查看

➜  cd _install/bin 
➜  file ts_calibrate 
ts_calibrate: ELF 32-bit LSB  executable, ARM, EABI5 version 1 (SYSV), 
dynamically linked (uses shared libs), for GNU/Linux 2.6.16, 
BuildID[sha1]=f31e63cfd21a4dc747e591d6c4e1d8d582fded36, not stripped

一步成功。

拷贝测试:

cd _install
cp *  /文件系统根目录/   -rfd       
  • -rfd :强制拷贝_install/下所有文件到/文件系统根目录/下,-d:保持链接,原来的是链接,复制过来的还是链接

安装使用

Step1. 修改参数:
vi /etc/ts.conf        

# module_raw input
改为:
module_raw input
Step2. 配置触摸屏环境:
export TSLIB_TSDEVICE=/dev/event0             
export TSLIB_CALIBFILE=/etc/pointercal            
export TSLIB_CONFFILE=/etc/ts.conf          
export TSLIB_PLUGINDIR=/lib/ts               
export TSLIB_CONSOLEDEVICE=none                  
export TSLIB_FBDEVICE=/dev/fb0                        
  • TSLIB_TSDEVICE:ts设备文件(触摸屏),可能为/dev/eventx也可能为/dev/input/eventx;可用使用cat /proc/input/devicesevtest(依赖文件系统中是否包含evtest工具)进行确认;
  • TSLIB_CALIBFILE:校验文件(calibrate file),存放校验
  • TSLIB_CONFFILE:配置文件
  • TSLIB_PLUGINDIR:插件文件,也有可能位于/usr/lib/ts;根据实际情况配置
  • TSLIB_CONSOLEDEVICE:终端控制台设为NULL
  • TSLIB_FBDEVICE:fb设备文件(LCD):fb0
Step3. 校验测试:
ts_calibrate                        

运行校验,屏幕会出现5次小黑点让用户触摸,然后生成/etc/pointercal文件,并存5个小黑点值

你可能感兴趣的:(7.1 tslib安装以及使用)