关于各变量解释详见《TQ-2440触摸屏tslib驱动移植 》#!/bin/sh echo Start Qt-4.5 > /dev/console export set HOME=/root export set QTDIR=/opt/qt-4.5 export set QPEDIR=/opt/qt-4.5 export set QWS_DISPLAY="LinuxFB:/dev/fb0" export set QWS_DISPLAY="LinuxFB:mmWidth130:mmHeight100:0" export set QWS_KEYBOARD="TTY:/dev/tty1" if [ -f /sys/devices/virtual/input/input1/uevent ] ; then export set TSLIB_TSDEVICE=/dev/event1 export set TSLIB_CALIBFILE=/etc/pointercal export set TSLIB_CONFFILE=/etc/ts.conf export set TSLIB_PLUGINDIR=/lib/ts export set QWS_MOUSE_PROTO="TSLIB:/dev/event1 Intellimouse:/dev/mouse0" else
export set QWS_MOUSE_PROTO="Intellimouse:/dev/mouse0" if [ -f /etc/pointercal ] ; then echo only use mouse > console else echo "1 0 1 0 1 1 65536" >/etc/pointercal fi fi
export set QT_PLUGIN_PATH=$QTDIR/plugins/ export set QT_QWS_FONTDIR=$QTDIR/lib/fonts/ export set PATH=$QPEDIR/bin:$PATH export set LD_LIBRARY_PATH=$QTDIR/lib:$QPEDIR/plugins/imageformats:$LD_LIBRARY_PATH if [ -f /etc/pointercal ] ; then $QPEDIR/bin/hello -qws 1>/dev/null 2>/dev/null else ts_calibrate # mousecalibration $QPEDIR/bin/hello -qws 1>/dev/null 2>/dev/null fi
export set QT_QWS_FONTDIR=$QTDIR/lib/fonts/
export set PATH=$QPEDIR/bin:$PATH
export set LD_LIBRARY_PATH=$QTDIR/lib:$QPEDIR/plugins/imageformats:$LD_LIBRARY_PATH
if中判断触屏是否存在并可用,以确定是否设置触屏方式,如果存在则设置成触屏、鼠标共存方式:if [ -f /sys/devices/virtual/input/input1/uevent ] ; then export set TSLIB_TSDEVICE=/dev/event1 export set TSLIB_CALIBFILE=/etc/pointercal export set TSLIB_CONFFILE=/etc/ts.conf export set TSLIB_PLUGINDIR=/lib/ts export set QWS_MOUSE_PROTO="TSLIB:/dev/event1 Intellimouse:/dev/mouse0" else export set QWS_MOUSE_PROTO="Intellimouse:/dev/mouse0" if [ -f /etc/pointercal ] ; then echo only use mouse > console else echo "1 0 1 0 1 1 65536" >/etc/pointercal fi fi
这里是判断是否需要对触屏进行校准,主要是判断校准后的数据文件(/etc/pointercal)是否存在,如果此文件存在则说明已经校准,这是无需再校准,直接运行hello程序。如果不存在则说明还未校准,这时会先运行ts_calibrate程序进行校准(mousecalibration也是一个Qt4自带的校准程序),然后再运行hello程序。if [ -f /etc/pointercal ] ; then $QPEDIR/bin/hello -qws 1>/dev/null 2>/dev/null else ts_calibrate # mousecalibration $QPEDIR/bin/hello -qws 1>/dev/null 2>/dev/null fi