天天看點

tslib編譯使用方法(selected device is not a touchscreen I understand)

出現這個問題花了我兩個小時的時間才去解決掉,原因修改版本後忘了重新編譯lcd。

下面是我一直tslib 的詳細步驟:

tslib-1.4.tar.gz源碼下載下傳位址:tslib-1.4.tar.gz

# tar -xzvf tslib-1.4.tar.gz 

# cd tslib

# ./autogen.sh

# mkdir tmp

# echo "ac_cv_func_malloc_0_nonnull=yes" >arm-linux.cache    (必須加,具體原因看文章最後)

# ./configure --host=arm-linux --enable-inputapi=no --cache-file=arm-linux.cache --prefix=$(pwd)/tmp

# make && make install

make install後,會在tmp目錄生成4個子目錄:

include  lib  etc  bin

生成的庫位于lib中,該目錄下還有一個子目錄ts,它包含了許多校準用到的庫(如input.so等)。

etc下的ts.conf為配置檔案,bin目錄下為校準、測試工具(如校準的ts_calibrate,測試用的ts_test)。

然後把這個四個檔案複制到根檔案系統的根目錄下。

配置檔案ts.conf内容如下:

module_raw input     (去掉前面的# 和空格,其他的保持不變)

module pthres pmin=1

module variance delta=30

module dejitter delta=100

module linear

module_raw有許多種,這裡隻使用input(即linux的input子系統,裝置檔案名稱為/dev/event1)/dev/event0為觸模屏的裝置節點

vi /etc/profile 中添加如下指令

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=/dev/tty1 設定控制台裝置為 none ,否則預設為 /dev/tty ,這樣可以避免出現“open

consoledevice: no such file or directory kdsetmode: bad file descriptor ” 的錯誤 

export tslib_fbdevice=/dev/fb0             指定幀緩沖裝置 

當我執行 ts_calibrate 出現了如下錯誤:

selected device is not a touchscreen i understand

在網上找了找到文章後發現原因是核心用的ev_version為0x0100001,交叉編譯工具ev_version為0x0100000

把這兩個修改成一樣就可以了。(其實正解也是這樣)

方法一:

我修改# vi include/linux/input.h  ev_version為0x0100000,重新編譯核心還是出現相同的錯誤,這兒花了我大把的時間,後來才發現我這個 ev_version宏改變了,而我的lcd驅動程式卻沒有重新編譯,我就在lcd驅動程式中随便移動一下,就是為了網編譯器檢測到我這個驅動是修改過的,然後lcd驅動也重新編譯了,再次測試就ok了,心碎啊,花了兩個小時時間才解決掉。

方法二:

交叉編譯中修改/usr/local/arm/4.3.2/arm-none-linux-gnueabi/libc/usr/include/linux/input.h中ev_versin為0x0100001

提示下這個交叉編譯下的input.h有可能你的路徑跟我的不一樣,你可以在你交叉編譯路徑下用如下指令搜尋:

find -name "input.h"

在make時候可能出現如下錯誤:

ts_test.o(.text 0x218): in function `main':

: undefined reference to `rpl_malloc'

在目前目錄查找了rpl_malloc,發現configure裡有#define malloc rpl_malloc一行。分析configure 腳本相關的代碼,原來是ac_cv_func_malloc_0_nonnull引起的,ok我們不讓它檢查了,産生一個cache檔案arm-linux.cache,欺騙configure:

解決辦法:

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

繼續閱讀