tslib的安装和移植

  tslib,即touch screen library,触摸屏函式库,它提供了滤波、去抖、校准等功能,为上层应用提供了一个统一的接口。

  1)在安装tslib之前需要安装一些工具,执行以下命令。

  sudo apt-get install autoconf

  sudo apt-get install automake

  sudo apt-get install libtool

  2)解压缩文件安装tslib

  tar xzf tslib-1.4.tar.gz

  cd tslib

  ./autogen.sh

  mkdir tmp                                                                          // 新建临时目录tmp

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

  ./configure --host=arm-linux --cache-file=arm-linux.cache --prefix=$(pwd)/tmp      // 指定tslib的安装目录为新建的tmp目录

  make

  make install

  执行完后,在tmp目录下,生成了bin,etc,include,lib四个文件夹。

  3)开发板配置

  在etc目录下存放的是tslib的配置文件,修改配置文件

  vim tmp/etc/ts.conf

  # module_raw input    =>    module_raw input

  将tmp目录下的四个文件夹复制至开发板的网络文件目录

  cd tmp

  cp * -rf /nfsroot

  4)使用

  export TSLIB_TSDEVICE=/dev/event0                       // 指定触摸屏设备

  export TSLIB_CALIBFILE=/etc/pointercal                  // 指定触摸屏校准文件 pintercal 的存放位置

  export TSLIB_CONFFILE=/etc/ts.conf                      // 指定 TSLIB 配置文件的位置

  export TSLIB_PLUGINDIR=/lib/ts                          // 指定触摸屏插件所在路径 

  export TSLIB_CONSOLEDEVICE=none                         // 设定控制台设备为 none ,否则默认为 /dev/tty ,避免出现“ open consoledevice: No such file or directory KDSETMODE: Bad file descriptor ” 的错误 

  export TSLIB_FBDEVICE=/dev/fb0                                    // 指定帧缓冲设备

  另外,要确保在/dev/input/目录下有event0设备文件,在/dev/目录下有fb0设备文件,如果没有,在执行下面./ts_calibrate 的时候,会报出“open *: No such file or directory ”的错误,这时,我们需要手动创建设备文件:

  # mknod /dev/input/event0 c 13 64

  # mknod /dev/fb0 c 29 0 

  5)执行测试

  ts_calibrate

  

————————————————————————————————————————————————————————————————————————————— 无他,唯手熟尔。。。
原文地址:https://www.cnblogs.com/ZXNblog/p/4032063.html