Linux Qt5.6 触摸屏不工作

zc_5200 2016-12-07 08:41:52
平台:Linux + Qt5.6(evdevtouch,linuxfb) + TiAM437x
触摸屏: GT5688_000119
问题:Qt写的App控件不能识别触摸,比如触摸按键不能实现点击
在Linux下用evtest测试触摸屏,感觉坐标什么的都是对的:
root@am437x-evm:~# evtest
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0: adp5585-keys
/dev/input/event1: goodix-ts
Select the device event number [0-1]: 1
Input driver version is 1.0.1
Input device ID: bus 0x18 vendor 0xdead product 0xbeef version 0x28bb
Input device name: "goodix-ts"
Supported events:
Event type 0 (EV_SYN)
Event type 1 (EV_KEY)
Event code 330 (BTN_TOUCH)
Event type 3 (EV_ABS)
Event code 0 (ABS_X)
Value 213
Min 0
Max 720
Event code 1 (ABS_Y)
Value 246
Min 0
Max 1280
Event code 24 (ABS_PRESSURE)
Value 0
Min 0
Max 255
Event code 48 (ABS_MT_TOUCH_MAJOR)
Value 0
Min 0
Max 255
Event code 53 (ABS_MT_POSITION_X)
Value 0
Min 0
Max 720
Event code 54 (ABS_MT_POSITION_Y)
Value 0
Min 0
Max 1280
Event code 57 (ABS_MT_TRACKING_ID)
Value 0
Min 0
Max 255
Event code 58 (ABS_MT_PRESSURE)
Value 0
Min 0
Max 255
Properties:
Property type 1 (INPUT_PROP_DIRECT)
Testing ... (interrupt to exit)
Event: time 1480918441.845968, type 1 (EV_KEY), code 330 (BTN_TOUCH), value 1
Event: time 1480918441.845968, type 3 (EV_ABS), code 58 (ABS_MT_PRESSURE), value 7
Event: time 1480918441.845968, type 3 (EV_ABS), code 48 (ABS_MT_TOUCH_MAJOR), value 7
Event: time 1480918441.845968, type 3 (EV_ABS), code 57 (ABS_MT_TRACKING_ID), value 0
Event: time 1480918441.845968, type 3 (EV_ABS), code 0 (ABS_X), value 25
Event: time 1480918441.845968, type 3 (EV_ABS), code 1 (ABS_Y), value 22
Event: time 1480918441.845968, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 25
Event: time 1480918441.845968, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 22
Event: time 1480918441.845968, ++++++++++++++ SYN_MT_REPORT ++++++++++++

但是在Qt应用程序里面控件无法捕获到touch事件,坐等高手解惑,多谢各位了!
我的App运行命令: ./test -platform linuxfb -plugin evdevtouch
...全文
881 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
qq_32651317 2018-05-08
  • 打赏
  • 举报
回复
帅哥,我也遇到跟你类似的问题. 也是TI的芯片,am335x,移植了qt5.6之后触摸屏不识别,evtest可以识别触摸屏. 不过我的触摸屏控制器跟你的不同. 请问你能不能分享一下你完整的触摸测试用例? 我完全是搞驱动的,所以没写过qt的测试用例.想找个测试用例学习下怎么测qt.
zc_5200 2016-12-08
  • 打赏
  • 举报
回复
不需要tslib的,Qt里面的evdevtouch就可以了 而且ts_calibrate在我的板子上有问题,我点击十字架没有任何反应,evtest正常
Little柯南 2016-12-08
  • 打赏
  • 举报
回复
第一,板子需要tslib库用上; 第二,实在不行那就重写touchEvent事件
zc_5200 2016-12-08
  • 打赏
  • 举报
回复
搞定了,虽然不知道为什么。。。 是驱动的问题,最重要的改动的是GTP_ICS_SLOT_REPORT这个。 diff --git a/drivers/input/touchscreen/gt1x/gt1x_generic.h b/drivers/input/touchscreen/gt1x/gt1x_generic.h index 5a0dcdc..7b6b6e4 100644 --- a/drivers/input/touchscreen/gt1x/gt1x_generic.h +++ b/drivers/input/touchscreen/gt1x/gt1x_generic.h @@ -52,7 +52,7 @@ /***************************PART1:ON/OFF define*******************************/ #define GTP_INCELL_PANEL 0 #define GTP_DRIVER_SEND_CFG 1 // send config to TP while initializing (for no config built in TP's flash) -#define GTP_CUSTOM_CFG 0 // customize resolution & interrupt trigger mode +#define GTP_CUSTOM_CFG 1 // customize resolution & interrupt trigger mode #define GTP_CHANGE_X2Y 0 // exchange xy #define GTP_WARP_X_ON 0 @@ -83,7 +83,7 @@ #define GTP_HAVE_STYLUS_KEY 0 // #define GTP_POWER_CTRL_SLEEP 0 // turn off power on suspend -#define GTP_ICS_SLOT_REPORT 0 +#define GTP_ICS_SLOT_REPORT 1 #define GTP_CREATE_WR_NODE 1 // create the interface to support gtp_tools #define GTP_PROXIMITY 0 // proximity module (function as the p-sensor) @@ -230,8 +230,8 @@ } #if GTP_CUSTOM_CFG -#define GTP_MAX_HEIGHT 1280 -#define GTP_MAX_WIDTH 720 +#define GTP_MAX_HEIGHT 640 +#define GTP_MAX_WIDTH 480 #define GTP_INT_TRIGGER 1 //0:Rising 1:Falling #define GTP_WAKEUP_LEVEL 1 #else
zc_5200 2016-12-07
  • 打赏
  • 举报
回复
运行test程序的打印: root@am437x-evm:~# ./test -platform linuxfb -plugin evdevtouch [ 137.751604] <<GTP-INF>>[gt1x_resume:2271] Resume start... qt.qpa.input: evdevkeyboard: Using device discovery qt.qpa.input: udev device discovery for type QFlags(0x8) qt.qpa.input: Found matching devices () qt.qpa.input: evdevmouse: Using device discovery qt.qpa.input: udev device discovery for type QFlags(0x1|0x2) qt.qpa.input: Found matching devices () qt.qpa.input: evdevtouch: Using device discovery qt.qpa.input: udev device discovery for type QFlags(0x2|0x4) qt.qpa.input: Found matching devices ("/dev/input/event0") qt.qpa.input: evdevtouch: Adding device at "/dev/input/event0" qt.qpa.input: evdevtouch: Using device /dev/input/event0 qt.qpa.input: evdevtouch: /dev/input/event0: Protocol type A (multi) qt.qpa.input: evdevtouch: /dev/input/event0: min X: 0 max X: 720 qt.qpa.input: evdevtouch: /dev/input/event0: min Y: 0 max Y: 1280 qt.qpa.input: evdevtouch: /dev/input/event0: min pressure: 0 max pressure: 255 qt.qpa.input: evdevtouch: /dev/input/event0: device name: goodix-ts qt.qpa.input: evdevtouch: Using device discovery qt.qpa.input: udev device discovery for type QFlags(0x2|0x4) qt.qpa.input: Found matching devices ("/dev/input/event0") qt.qpa.input: evdevtouch: Adding device at "/dev/input/event0" qt.qpa.input: evdevtouch: Using device /dev/input/event0 evt->type = 217 evt->type = 203 evt->type = 34 evt->type = 75 evt->type = 75 evt->type = 170 evt->type = 69 evt->type = 69 evt->type = 69 evt->type = 69 evt->type = 13 evt->type = 14 evt->type = 13 evt->type = 14 evt->type = 17 evt->type = 26 evt->type = 17 evt->type = 183 evt->type = 12 evt->type = 12 qt.qpa.input: evdevtouch: /dev/input/event0: Protocol type A (multi) qt.qpa.input: evdevtouch: /dev/input/event0: min X: 0 max X: 720 qt.qpa.input: evdevtouch: /dev/input/event0: min Y: 0 max Y: 1280 qt.qpa.input: evdevtouch: /dev/input/event0: min pressure: 0 max pressure: 255 qt.qpa.input: evdevtouch: /dev/input/event0: device name: goodix-ts evt->type = 26 evt->type = 8 evt->type = 74 evt->type = 74 evt->type = 78 evt->type = 78 qt.qpa.input: evdevtouch: Updating QInputDeviceManager device count: 1 touch devices, 0 pending handler(s) qt.qpa.input: evdevtouch: Updating QInputDeviceManager device count: 1 touch devices, 0 pending handler(s) evt->type = 77 evt->type = 12 evt->type = 12 看起来都正常啊。 另外,我在主窗口dialog.cpp里面加了一个eventFilter,然后我触摸屏幕,捕获touch事件,是能看到打印的,就是不明白为什么touch事件没有关联到点击按钮上去,测试代码如下: bool Dialog::eventFilter(QObject *obj, QEvent *evt) { qDebug("evt->type = %d", evt->type()); if (evt->type() == QEvent::TouchBegin || evt->type() == QEvent::TouchUpdate) { QTouchEvent *t = (QTouchEvent *)evt; qDebug("touch, x %f, y %f",t->touchPoints().at(0).pos().x(), t->touchPoints().at(0).pos().y()); qDebug("pb1 3 %f, y %f", ui->pushButton_3->pos().x(), ui->pushButton_3->pos().y()); return QDialog::eventFilter(obj, evt); } 。。。
zc_5200 2016-12-07
  • 打赏
  • 举报
回复
另外,我的平台也支持按键,用按键就可以按那些按钮。。。

16,233

社区成员

发帖
与我相关
我的任务
社区描述
Qt 是一个跨平台应用程序框架。通过使用 Qt,您可以一次性开发应用程序和用户界面,然后将其部署到多个桌面和嵌入式操作系统,而无需重复编写源代码。
社区管理员
  • Qt
  • 亭台六七座
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧