移植QT以及Tslib要注意的问题

Qt编译配置
echo yes |./configure -prefix $INSTALL_DIR -v -opensource -confirm-license -embedded arm -release -shared -fast -no-largefile -qt-sql-sqlite \
-no-qt3support -no-xmlpatterns -no-mmx -no-3dnow -no-sse -no-sse2 -no-svg -no-webkit -qt-zlib -no-gif -qt-libtiff -qt-libpng \
-qt-libmng -qt-libjpeg -make libs -nomake tools -nomake examples -nomake docs -nomake demos -nomake translations -no-nis -no-cups -no-iconv -no-dbus \
-no-openssl -xplatform qws/linux-arm-gnueabihf-g++ -little-endian -qt-freetype -depths 16,24,32 \
-no-glib \
-xcursor -feature-cursor \
-no-script -no-scripttools -no-declarative -no-declarative-debug -no-opengl -no-openvg -no-sm \
-qt-gfx-linuxfb -qt-gfx-transformed -qt-gfx-multiscreen -qt-kbd-linuxinput -qt-mouse-linuxinput \

-no-mouse-xx 这个选项实在是很让人困扰,刚开始的时候我也是。这个选项的大概意思就是你要使用什么鼠标驱动来触发触摸屏的点击事件。有tslib linuxtp linuxinput 。一般电阻屏的话最好使用Tslib触摸 。电容屏的话就选用linuxinout触摸 显示地声明- 将其它的用不到的全no掉。如果有自己的鼠标驱动,那么在这个选项里就可以添加-qt-mouse-驱动

如果要加上对tslib的支持那么久把-qt-mouse-linuxinput换成-qt-mouse-tslib 另外需要移植Tslib库 编译的时候加上Tslib的库文路径 假设你安装的tslib位置在/opt/tslib-1.4 那么你配置QT的时候就要加上去如下
echo yes |./configure -prefix $INSTALL_DIR -v -opensource -confirm-license -embedded arm -release -shared -fast -no-largefile -qt-sql-sqlite \
-no-qt3support -no-xmlpatterns -no-mmx -no-3dnow -no-sse -no-sse2 -no-svg -no-webkit -qt-zlib -no-gif -qt-libtiff -qt-libpng \
-qt-libmng -qt-libjpeg -make libs -nomake tools -nomake examples -nomake docs -nomake demos -nomake translations -no-nis -no-cups -no-iconv -no-dbus \
-no-openssl -xplatform qws/linux-arm-gnueabihf-g++ -little-endian -qt-freetype -depths 16,24,32 \
-no-glib \
-xcursor -feature-cursor \
-no-script -no-scripttools -no-declarative -no-declarative-debug -no-opengl -no-openvg -no-sm \
-qt-gfx-linuxfb -qt-gfx-transformed -qt-gfx-multiscreen -qt-kbd-linuxinput -qt-mouse-linuxinput \
*-I/opt/tslib-1.4/include -L/opt/tslib-1.4/lib *(注: 记得在qt的mkspecs/qws/相对应得目录下编译加上 -lts 因为要对tslib支持)

环境设置(e tc/profile)
这里主要声明了QT的运行环境
QT_INSTALL_PATH=/opt/Qt
export QTDIR=/opt/Qt
export QPEDIR=/opt/Qt
export QWS_DISPLAY=”LinuxFB:/dev/fb0”
export QWS_DISPLAY=”LinuxFB:mmWidth130:mmHeight100:0”
export QWS_KEYBOARD=”TTY:/dev/tty1”
export QWS_MOUSE_PROTO=”Linuxinput:/dev/input/event1”
export QT_PLUGIN_PATH=/opt/Qt/plugins/
export QT_QWS_FONTDIR=/opt/Qt/lib/fonts/
export LD_LIBRARY_PATH=/opt/Qt/lib
如上为-qt-mouse-linuxinput 时的配置
当qt配置的触摸类型为Tslib的时候 需要注意的是QWS_MOUSE_PROTO要与Tslib的环境要一致 所以要改为export QWS_MOUSE_PROTO=”Tslib:/dev/input/event1”

QT参数配置说明http://www.360doc.com/content/10/0225/22/79031_16834764.shtml

Tslib 编译配置
./configure –host=arm-linux-gnueabihf –prefix=/opt/tslib-1.4 ac_cv_func_malloc_0_nonnull=yes

环境设置 (etc/profile)
export TSLIB_ROOT=/usr
export TSLIB_TSDEVICE=/dev/input/event1(要和QWS_MOUSE_PROTO一一对应)
export TSLIB_CALIBFILE=/etc/pointercal
export TSLIB_CONFFILE=/etc/ts.conf
export TSLIB_PLUGINDIR=$TSLIB_ROOT/lib/ts/
export TSLIB_CONSOLEDEVICE=/dev/tty
export TSLIB_FBDEVICE=/dev/fb0

移植万tslib的时候 测试ts_calibrate 以及ts_test 是针对单点触摸的 所以要修改为单点触摸不然会出现

selected device is not a touchscreen I understand
也就是识别不了触摸模块 可参考如下文章进行诊断
https://blog.csdn.net/liuzijiang1123/article/details/45787901

另外修改驱动为单点触摸的相关操作 一般都支持单点触摸 没有的话就直接按下面操作就行

 input_report_abs(ts->input_dev, ABS_MT_POSITION_X, x);
 input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, y);
 input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, w);
 input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR, w);
 input_report_abs(ts->input_dev, ABS_MT_TRACKING_ID, id);
 input_mt_sync(ts->input_dev);
   去掉上面的多点上报换成如下 
 input_report_abs(ts->input_dev, ABS_X, x);
 input_report_abs(ts->input_dev, ABS_Y, y);
 input_report_key(ts->input_dev, BTN_TOUCH, 1);

如上就是比较要注意的问题

猜你喜欢

转载自blog.csdn.net/u012855539/article/details/80613841
今日推荐