tslib在imx6q上的移植

2021-10-05 17:55:36 字數 3586 閱讀 5432

一、配置

目標裝置:迅為imx6q開發板,7.0帶觸控螢幕

軟體版本:tslib-1.4

編譯器:arm-2014.05

二、移植

2.執行以下命令

cd tslib-1.4 

mkdir ../tslib_install

./autogen.sh

./configure cc=arm-none-linux-gnueabi-gcc cxx=arm-none-linux-gnueabi-g++ \

--host=arm-none-linux-gnueabi --prefix=$(pwd)/../tslib_install \

ac_cv_func_malloc_0_nonnull=yes

make

make install

執行完以上步驟之後,在當前目錄的上級目錄有資料夾tslib_install,資料夾tslib_install內即是生成的目標檔案, 包括:bin etc include lib share。其中bin資料夾包含測試的可執行檔案,etc資料夾包含配置檔案ts.conf

3.新增檔案與配置

在tslib_install/etc資料夾內新增檔案pointercal,這是乙個空檔案,無需任何內容

4.更改配置檔案tslib_install/etc/ts.conf

配置檔案內使用項去除注釋#及空格,不使用項加#注釋。

此時配置使用項(使用項前面一定不能有空格)

module_raw input 

module variance delta=30

module dejitter delta=100

#module linear

此處將module linear注釋掉,與迅為官方文件不同;如果不注釋,執行ts_carculate會出現 「couldnt load module linear」錯誤。

5.以上步驟完畢可將tslib_install資料夾拷貝入目標檔案系統的opt目錄下,並打包成rootfs.tgz

6.更改目標檔案系統的環境變數

開啟目標檔案系統的etc/profile,新增以下內容

export tslib_root=/opt/tslib_install 

export qt_root=/opt/qt5.7.0

export tslib_tsdevice=/dev/input/even3

export tslib_calibfile=$tslib_root/etc/pointercal

export tslib_tseventtype=input

export tslib_conffile=/opt/tslib_install/etc/ts.conf

export tslib_plugindir=/opt/tslib_install/lib/ts

export tslib_consoledevice=none

export tslib_fbdevice=/dev/fb0

export qws_mouse_proto=tslib:/dev/input/event3

export ld_library_path=/lib:/usr/lib:/usr/local/lib:$qt_root/lib:$tslib_root/lib:$tslib_root/lib/

export qt_qpa_platform_plugin_path=$qt_root/plugins

export qt_qpa_platform=linuxfb:tty=/dev/fb0

export qt_qpa_fontdir=$qt_root/lib/fonts

export qt_qpa_generic_plugins=tslib

這裡tslib_calibfile是迅為官方文件中沒有的,它指向3.建立的pointercal檔案;同時迅為官方文件的tslib_tsdevice 中event2改為event3

三、測試

將映象燒寫入開發板後,利用串列埠命令列操作開發板

1.#./opt/tslib_install/bin/ts_carculate

在螢幕上進行觸控螢幕的5點校驗。如果在二.3步驟中未新增pointercal,則此時會出現檔案不能開啟的錯誤,事實上ts_carculate 會將校驗結果寫入pointercal。若出現」segmentation fault」錯誤,則是二.4中使用項前面有空格。

2.在三.4中我們將module linear注釋掉,如果沒有注釋掉,執行ts_carculate會出現linear模組不能開啟的錯誤;此時已經執行過ts_carculate,其校驗結果已寫入了pointercal檔案,我們可以去掉module linear的注釋(前面不能有空格)

#vi /opt/tslib_install/etc/ts.conf

3.測試繪畫和拖拽

#./opt/tslib_install/bin/ts_test_mt

執行此測試程式,可以在螢幕拖拽游標和畫線

四、錯誤處理

1.「selected device is not a touchscreen i understand」

tslib不能識別觸控螢幕,這個錯誤主要由兩點引起

1)編譯tslib的交叉編譯器.../arm-2014.05/arm-none-linux-gnueabi/libc/usr/include/linux/input.h的 ev_version 與移植的核心檔案kernel-imx/include/linux/input.h的ev_version 不同造成。tslib中的input版本號是在 交叉編譯的時候指定的,賦值給version,故將交叉編譯器的ev_version直更改與核心的ev_version相同即可。迅為官方提供的 arm-2014.05編譯器ev_version實際與移植的核心ev_version是相同的,如果不是此原因造成,那麼請看2)

2)在二.5中我們配置export tslib_tsdevice=/dev/input/even3,迅為官方文件為event2。串列埠命令列ls /dev/input,檢視開發板的輸入裝置,發現有event0 event1 event2 event3,實際event3對應的觸控螢幕輸入。

在imx6q上移植ubuntu16 04系統

在i.mx6q上移植ubuntu 16.04系統步驟 cd ubuntudev mkdir rootfs cd rootfs wget mkdir ubuntu sudo tar xpf ubuntu base 16.04 core armhf.tar.gz c ubuntu 解壓後,可以ls看看,...

imx6q 驅動開發

一 leds驅動 vim imx6q arm2.dts 根節點中新增 leds led5 led6 測試leds cd sys bus platform devices leds leds led5 echo 1 brightness echo 0 brightness 二 lcd驅動 檢視解析度 ...

imx6q平台的gpio配置方法

這裡介紹一下imx6q平台的gpio配置方式,如下圖所示為原理圖 從原理圖中可看到每個引腳的名稱 比如引腳名稱為gpio 16,開啟kernel imx arch arm boot dts imx6q pinfunc.件 該檔案都是一些巨集定義,固定形式為mx6qdl pad 引腳名 引腳功能描述 ...