tslib移植筆記(1)2016-04-25
tslib背景【摘自百度】:
在采用觸摸屏的移動終端中,觸摸屏性能的調試是個重要問題之一,因為電磁噪聲的緣故,觸摸屏容易存在點選不準确、有抖動等問題。
Tslib是一個開源的程式,能夠為觸摸屏驅動獲得的采樣提供諸如濾波、去抖、校準等功能,通常作為觸摸屏驅動的适配層,為上層的應用提供了一個統一的接口。
系統環境:
Distributor ID: Ubuntu
Description: Ubuntu 14.04.1 LTS
Release: 14.04
Codename: trusty
交叉編譯工具鍊:
适用于mini2440開發闆的arm-linux-gcc-4.4.3-20100728.tar.gz
源碼位址:
https://github.com/kergoth/tslib
下載下傳源碼方法:
1.通過git直接下載下傳源碼: git clone https://github.com/kergoth/tslib
2.網頁下載下傳源碼,檔案名為 tslib-master.zip,解壓源碼:unzip tslib-master.zip
編譯源碼:
1.下載下傳依賴庫及工具
sudo apt-get install autoconf
sudo apt-get install automake
sudo apt-get install libtool
2.生成configure
執行 ./autogen.sh
遇到錯誤1:
➜ ~/test/tslib-master: ./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
原因:是因為沒有安裝上面的libtool
執行 sudo apt-get install libtool 即可。
安裝後重新執行資訊如下:
➜ ~/test/tslib-master: ./autogen.sh
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./ltmain.sh'
libtoolize: putting macros in `m4/internal'.
libtoolize: copying file `m4/internal/libtool.m4'
libtoolize: copying file `m4/internal/ltoptions.m4'
libtoolize: copying file `m4/internal/ltsugar.m4'
libtoolize: copying file `m4/internal/ltversion.m4'
libtoolize: copying file `m4/internal/lt~obsolete.m4'
libtoolize: Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configure.ac and
libtoolize: rerunning libtoolize, to keep the correct libtool macros in-tree.
configure.ac:18: installing './compile'
configure.ac:27: installing './config.guess'
configure.ac:27: installing './config.sub'
configure.ac:7: installing './install-sh'
configure.ac:7: installing './missing'
plugins/Makefile.am:13: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
plugins/Makefile.am: installing './depcomp'
tests/Makefile.am:12: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
3.生成Makefile
預先配置好環境變量,交叉工具鍊arm-linux-gcc路徑
./configure
--host=arm-linux --prefix=安裝路徑
網上那個有教程有兩種配置方式,但這裡暫時沒設定也能夠編譯通過:
1. ./configure --prefix=安裝路徑 --host=arm-linux
ac_cv_func_malloc_0_nonnull=yes
2. echo "ac_cv_func_malloc_0_nonnull=yes" >arm-linux.cache
./configure --host=arm-linux -cache-file=arm-linux.cache --prefix=安裝路徑
4.編譯源碼
make && make install
最後在輸出目錄下生成 bin etc include lib 四個子目錄。
bin目錄下面為可執行程式 ts_calibrate ts_harvest ts_print ts_print_raw ts_test
etc目錄下面隻有一個檔案 ts.conf
include目錄下面有頭檔案 tslib.h
lib目錄下有 libts-1.0.so.0 libts-1.0.so.0.0.0 libts.la libts.so pkgconfig ts