下载tslib1.4
解压
修改tslib/plugins/input-raw.c
把其中的ts_input_read 函数改成如下:
static int ts_input_read(struct tslib_module_info *inf,
struct ts_sample *samp, int nr)
{
// printf ("HEAD=== ts_input_read in INPUT-RAW.C\n");
struct tslib_input *i = (struct tslib_input *)inf;
struct tsdev *ts = inf->dev;
struct input_event ev;
int ret = nr;
int total = 0;
unsigned long jjts;
while(total<nr)
{
ret = read(ts->fd, &jjts, sizeof(jjts));
if (ret==-1) continue;
samp->pressure=(jjts>>31) & 0x01;
samp->x=(jjts>>16) & 0xffff;
samp->y=jjts & 0xffff;
samp++;
total++;
}
ret=total;
return ret;
}
然后编译 tslib
./autogen.sh
echo "ac_cv_func_malloc_0_nonnull=yes" >arm-linux.cache
./configure --host=arm-linux --cache-file=arm-linux.cache --enable-inputapi=no --prefix=/usr/local/tslib
make
make install
vi /usr/local/tslib/etc/ts.conf
修改ts.conf为
module_raw input
module pthres pmin=1
module variance delta=30
module dejitter delta=10000
module linear
复制tslib到开发板对应的目录,我这里用的nfs挂载
cp /usr/local/tslib/ /opt/my/rootfs_nfs/usr/local/ -r
修改qt4脚本为:
#!/bin/sh
if [ -e /etc/friendlyarm-ts-input.conf ] ; then
. /etc/friendlyarm-ts-input.conf
fi
true ${TSLIB_TSDEVICE:=/dev/touchscreen}
export TSLIB_ROOT=/usr/local/tslib
TSLIB_CONFFILE=$TSLIB_ROOT/etc/ts.conf
export TSLIB_TSDEVICE
export TSLIB_CONFFILE
export TSLIB_PLUGINDIR=$TSLIB_ROOT/lib/ts
export TSLIB_CALIBFILE=/etc/pointercal
export QWS_DISPLAY=:1
#export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$TSLIB_ROOT/lib:$LD_LIBRARY_PATH
export PATH=/bin:/sbin:/usr/bin/:/usr/sbin:/usr/local/bin
if [ -c /dev/touchscreen ]; then
export QWS_MOUSE_PROTO="Tslib MouseMan:/dev/input/mice"
if [ ! -s /etc/pointercal ] ; then
rm /etc/pointercal
$TSLIB_ROOT/bin/ts_calibrate
fi
else
export QWS_MOUSE_PROTO="MouseMan:/dev/input/mice"
fi
export QWS_KEYBOARD=TTY:/dev/tty1
export HOME=/root
echo "Starting qt4 app.." > /dev/tty1
cd /usr/local/Trolltech/QtEmbedded-4.7.0-arm/demos/embedded/fluidlauncher
./fluidlauncher -qws
hotplug
重启开发析板,进不了qt4,屏上能显示"Starting qt4 app.." ,然后光标一直在那里闪
把 TSLIB_CONFFILE=$TSLIB_ROOT/etc/ts.conf 注释掉就可以进qt4界面了,不知是哪里的原因
我运行/usr/local/tslib/bin下的 ts_calibrate和ts_test都是正常了,应该说tslib是没问题了,但为什么qt会启动不起来
友善的工程师,能不能指导一下