最近在 移植 ssd2533电容屏,遇到了些问题与大家分享下:
驱动在底层能打印了触摸每一点的坐标,但是死活点击屏都没有用,FAE说是上层的应用不支持,最初上层用的是qt,后来把上层的改用android,但是在android也是同样的效果,有数据,死活点不动,最后对比了下以前电容屏驱动发现是数据上报的问题出了点小问题:
input_report_abs(ts->dev, ABS_MT_TOUCH_MAJOR, mt_buf[i].press);//Status);
input_report_abs(ts->dev, ABS_MT_WIDTH_MAJOR, mt_buf[i].press);
input_report_abs(ts->dev, ABS_MT_POSITION_X, mt_buf[i].x>150 ? mt_buf[i].x-150:0);
input_report_abs(ts->dev, ABS_MT_POSITION_Y, mt_buf[i].y);
//input_report_abs(ts->dev,ABS_MT_TOUCH_MAJOR, 1);
input_report_abs(ts->dev,ABS_MT_PRESSURE, 1);
input_report_abs(ts->dev,ABS_MT_TRACKING_ID, i); //Track iD .
input_mt_sync(ts->dev);
printk("x[%d]=%4d y[%d]=%4d \n",i,mt_buf[i].x>150 ? mt_buf[i].x-150:0,i,mt_buf[i].y);
红色部分没有,修改后就OK了!
后又把上层改为QT,QT的触摸通过TSLIB获取驱动数据,编译QT加进去还是不行,联想以前用电阻屏的时候能用而现在又不能用,怪,后面有查看了下以前电阻屏的驱动,和TSLIB源码看了下,
if (ev.type == EV_ABS) switch (ev.code) {
case ABS_X:
if (!got_curr_x && !got_curr_y) {
got_curr_x = 1;
curr_x = ev.value;
} else {
got_next_x = 1;
next_x = ev.value;
}
break;
case ABS_Y:
if (!got_curr_y) {
got_curr_y = 1;
curr_y = ev.value;
} else {
got_next_y = 1;
next_y = ev.value;
}
break;
case ABS_PRESSURE:
got_curr_p = 1;
curr_p = ev.value;
break;
}
晃唔!原来TSLIB接收数据只有ABS_X,ABS_Y, ABS_PRESSURE,
参照电阻屏驱动改动了上报代码如下:
input_report_abs(ts->dev, ABS_X, mt_buf[i].x>150 ? mt_buf[i].x-150:0);
input_report_abs(ts->dev, ABS_Y, mt_buf[i].y);input_report_abs(ts->dev,ABS_PRESSURE, mt_buf[i].press);
input_sync(ts->dev);
这样就OK了,不过多点触摸没有实现,应小弟学浅,不知道TSLIB是否能接收多点的数据,使用QT支持多点触摸,希望有了解的大侠们多多指点哈!