移植觸摸屏tslib庫遇到的問題,一般存在三種情況:
1.環境變量配置的問題
2.QtE庫環境或者交叉編譯器配置的問題
3.是否加載觸摸屏驅動、event事件以及觸摸屏大小配置是否比對的問題
一、沒有module_raw
No raw modulesloaded.
ts_config:Success
修改QtE庫環境下的etc/ts.conf,将以下第二行的注釋去掉
即:
# module_rawinput
改成:
module_raw input
二、Segmentation fault錯誤
1、etc/ts.conf檔案中的各個設定選項之前不能有空格
2、在pointercal對應的目錄下,不要建立一個空的pointercal檔案
三、運作ts_calibrate出現:ts_open: No such file or directory
1. 先用ls指令試下有多少個event(ls /dev/input/event* 或者 ls/dev/event*)
2. 用cat指令哪個event是觸摸屏的 (cat dev/input/evnet0、1、2…… 或者 cat /dev/event0、1、2…… )
3. 将TSLIB_TSDEVICE配置成相應的event事件
例:我的是/dev/event1 就設定成 exportTSLIB_TSDEVICE=/dev/event1
四、selected device is not a touchscreen I understand
1、cat /proc/bus/input/devices檢視是否有觸摸屏驅動
2、若沒有就要添加驅動
2.1添加input.c元件
Device Drivers -- - >
Inputdevice support -- - >
Generic input layer (needed for keyboard,mouse, ...)
2.2添加evdev.c元件
Device Drivers -- - >
Inputdevice support -- - >
< * > Event interface
2.3添加s3c2410_ts.c觸摸屏驅動(看有沒有現成的驅動)
3.若有驅動,則檢視核心配置的螢幕大小是否比對、是否有event
4.上述操作都不能解決你的問題就可能是因為交叉編譯器和核心中的一個宏的定義不同,Tslib有如此一段代碼:
if(! ((ioctl(ts->fd, EVIOCGVERSION, &version) >= 0) &&
(version == EV_VERSION) &&
(ioctl(ts->fd,EVIOCGBIT(0, sizeof(bit) * 8), &bit) >= 0) &&
(bit& (1 << EV_ABS)) &&
(ioctl(ts->fd,EVIOCGBIT(EV_ABS, sizeof(absbit) * 8), &absbit) >= 0) &&
(absbit& (1 << ABS_X)) &&
(absbit& (1 << ABS_Y)) && (absbit & (1 << ABS_PRESSURE)))){
fprintf(stderr,"selected device is not a touchscreen I understand\n");
return-1;
}
此處規定交叉編譯器和核心配置的EV_VERSION一緻,Kernel源代碼位于driver/input/evdev.c中,交叉編譯器安裝目錄下中使用grep (grep "EV_VERSION" -nR) 在交叉編譯安裝,可以快速找到EV_VERSION的位置。将兩個EV_VERSION比較,若不同,就修改核心中,重新編譯核心即可。
交叉編譯工具linux/input.h中
#define EV_VERSION 0x010001
核心:/include/linux/input.h
#define EV_VERSION 0x010000
改為:
#define EV_VERSION 0x010001
五、進入不了qt菜單畫面(點選menu無反應)
1、首先測試觸摸屏
1.1 cat/proc/bus/input/devices 會出現觸摸屏裝置情況,
1.2 cat /dev/event0然後點選觸摸屏,如果dnw畫面出現亂碼說明觸摸屏工作正常。
2、那麼就是系統或者環境變量沒有設定好。
最後我在這裡給出所有正确的操作結果:
1. 觸摸屏注冊的裝置節點:/dev/event0
2.cat /proc/bus/input/device 的顯示
I: Bus=0013Vendor=dead Product=beef Version=0101
N:Name="s3c TouchScreen"
P:Phys=input(ts)
S:Sysfs=/class/input/input0
H: Handlers=mouse0 vent0 ts0
B: EV=b
B: KEY=400 0 0 00 0 0 0 0 0 0
B: ABS=1000003
3.cat /dev/event0 點選觸摸屏,序列槽端出現亂碼
4.具體的環境變量配置如下
exportQTDIR=$PWD
exportLD_LIBRARY_PATH=$PWD/lib
exportTSLIB_TSDEVICE=/dev/event0
exportTSLIB_PLUGINDIR=$PWD/lib/ts
exportTSLIB_CONSOLEDEVICE=none
exportTSLIB_CONFFILE=$PWD/etc/ts.conf
exportPOINTERCAL_FILE=$PWD/etc/ts-calib.conf
exportQWS_MOUSE_PROTO=tslib:=/dev/event0
exportTSLIB_CALIBFILE=$PWD/etc/ts-calib.conf
exportQT_QWS_FONTDIR=$PWD/lib/fonts
exportLANG=zh_CN
到此,運作QtE庫下的bin目錄下的ts_calibrate,就可進入5 點觸摸屏校準程式并存儲配置檔案.
更多詳情,請通路http://www.100ask.org/