網上看到了一篇不錯的tslib移植的文章,特別是裡面提到的錯誤和解決方案很有用,轉載至此。與各位共用。
原帖地址 http://apps.hi.baidu.com/share/detail/19830498 或 http://www.360doc.com/content/11/0807/01/4171006_138590024.shtml
環境:S3C2410 linux tslib1.4
1.交叉編譯tslib
過程如下:
解壓;
#./autogen.sh
#./configure --prefix=/home/duancp/mytslib/ --host=arm-linux(這句所選擇安裝目錄,注意) ac_cv_func_malloc_0_nonnull=yes (可以先產生個shell檔案)
#make
#make install-strip //產生瘦身應用程式和庫
可能出現的錯誤及解答過程:(摘自:http://blog.csdn.net/gfocean/archive/2010/01/2/5266847.aspx)
錯誤1:
./autogen.sh錯誤提示:
root@ppcst-desktop:/home/ppcst/software/tslib# ./autogen.sh
Can't exec "aclocal": 沒有該檔案或目錄 at /usr/bin/autoreconf2.50 line 182.
Use of uninitialized value in pattern match (m//) at /usr/bin/autoreconf2.50 line 182.
Can't exec "automake": 沒有該檔案或目錄 at /usr/bin/autoreconf2.50 line 183.
Use of uninitialized value in pattern match (m//) at /usr/bin/autoreconf2.50 line 183.
Can't exec "aclocal": 沒有該檔案或目錄 at /usr/share/autoconf/Autom4te/FileUtils.pm line 290.
autoreconf2.50: failed to run aclocal: 沒有該檔案或目錄
解決方案:apt-get install automake
錯誤2:
Can't exec "libtoolize": No such file or directory at /usr/bin/autoreconf line 190.
Use of uninitialized value $libtoolize in pattern match (m//) at /usr/bin/autoreconf line 190.
configure.ac:25: 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:26: error: possibly undefined macro: AC_ENABLE_SHARED
configure.ac:27: error: possibly undefined macro: AC_LIBTOOL_DLOPEN
configure.ac:28: error: possibly undefined macro: AC_PROG_LIBTOOL
autoreconf: /usr/bin/autoconf failed with exit status: 1
解決方案:在ubuntu下安裝libtool.deb或者更新用命令:apt-get install libtool
錯誤3:
ts_test.o(.text+0x218): In function `main':
: undefined reference to `rpl_malloc'
fbutils.o(.text+0x234): In function `open_framebuffer':
: undefined reference to `rpl_malloc'
collect2: ld returned 1 exit status
make[2]: *** [ts_test] Error 1
make[2]: Leaving directory `/home/gfpeak/Desktop/tslib/tests'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/gfpeak/Desktop/tslib'
make: *** [all] Error 2
解決方案是在編譯的時候./configure後面的參數沒有設定對,正確設定如下:
./configure --prefix=/usr/local/tslib/ --host=arm-linux ac_cv_func_malloc_0_nonnull=yes
錯誤4:
在開發板上運行校正程式時出現No raw modules loaded
解決方案是把 tslib/etc目錄下的ts.conf 的 "#module_raw input"的注釋符號“#”去掉。但記住不要在前面留有 空格 ,否則會出現錯誤4
錯誤5:
在開發板上運行校正程式時出現Segmentation fault
解決方案是看錯誤3。
2.tslib的移植
過程如下:
a.到/home/duancp/mytslib/下(你在./configure時設定的目錄下)把mytslib下載到開板
/mnt/yaffs/(下載方式可參考文章 下載方式)
b.設定環境變數如下:(或者寫成shell形式)
export T_ROOT=/mnt/yaffs/mytslib
export LD_LIBRARY_PATH=$T_ROOT/lib
export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_TSDEVICE=/dev/input/event0
export TSLIB_PLUGINDIR=$T_ROOT/lib/ts
export TSLIB_CONFFILE=$T_ROOT/etc/ts.conf
export TSLIB_CALIBFILE=/mnt/yaffs/pointercal( #tslib設定檔內容)我沒有到 這 個檔案,應該不設定也行
解釋:
TSLIB_TSDEVICE //觸控螢幕裝置檔案名稱
Default (no inputapi): /dev/touchscreen/ucb1x00
Default (inputapi): /dev/input/event0
TSLIB_CALIBFILE //校準的資料檔案,由ts_calibrate 校準程式產生
Default: ${sysconfdir}/pointercal
TSLIB_CONFFILE //設定檔名
Default: ${sysconfdir}/ts.conf
TSLIB_PLUGINDIR //外掛程式目錄
Default: ${datadir}/plugins
TSLIB_CONSOLEDEVICE //控制台裝置檔案名稱
Default: /dev/tty
TSLIB_FBDEVICE //FrameBuffer裝置名稱
Default: /dev/fb0
以上環境變數在實際開發中的實際配置可以根據實際情況決定。
c.修改mytslib/etc/ts.conf檔案,要不會出現錯誤2
使ts.conf檔案如下:
module_raw input
module pthres pmin=1
module variance delta=30
module dejitter delta=100
module linear
即把tslib/etc目錄下的ts.conf 的 "#module_raw input"的注釋符號“#”去掉,不要在前面留有空格。
d. cd bin
./ts_test(執行測試程式即可,你可以在螢幕上看到測試點,則成功了)
注意:觸控螢幕的前提是你的觸控螢幕驅動已經寫好,並載入進了核心.你可以測試有沒有載入觸控螢幕驅動,cat /dev/input/event0(這隻是我的板子上的觸控螢幕) ,手摸觸控螢幕,看終端有無顯示,若有則表明正確。 如無則要加上觸控螢幕的驅動 insmod touchscreen.o(此驅動自己找)
編譯tslib1.4的錯誤和解決方案:(摘自:http://blog.csdn.net/gfocean/archive/2010/01/28/5266847.aspx)
錯誤1:
ts_test.o(.text+0x218): In function `main':
: undefined reference to `rpl_malloc'
fbutils.o(.text+0x234): In function `open_framebuffer':
: undefined reference to `rpl_malloc'
collect2: ld returned 1 exit status
make[2]: *** [ts_test] Error 1
make[2]: Leaving directory `/home/gfpeak/Desktop/tslib/tests'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/gfpeak/Desktop/tslib'
make: *** [all] Error 2
解決方案是在編譯的時候./configure後面的參數沒有設定對,正確設定如下:
./configure --prefix=/usr/local/tslib/ --host=arm-linux ac_cv_func_malloc_0_nonnull=yes
錯誤2:
在開發板上運行校正程式時出現No raw modules loaded
解決方案是把 tslib/etc目錄下的ts.conf 的 "#module_raw input"的注釋符號“#”去掉。但記住不要在前面留有 空格 ,否則會出現錯誤4
錯誤3:
在開發板上運行校正程式時出現Segmentation fault
解決方案是看錯誤2
錯誤4:
ts_open: No such file or directory
環境變數沒有設定好