米尔MYD-YG2开发板触摸屏测试

描述

我们连接RGB的LCD屏后,先进入终端把开机启动的mxapp2关闭。有两种方式,一是killall mxapp2,二是用top查到mxapp2的进程,然后用kill 进程ID

执行测试

root@myir-yg2lx:~# framebuffer_test
The framebuffer device was opened successfully.
vinfo.xres=800
vinfo.yres=480
vinfo.bits_per_bits=32
vinfo.xoffset=0
vinfo.yoffset=0
red.offset=16
green.offset=8
blue.offset=0
transp.offset=0
finfo.line_length=3200
finfo.type = PACKED_PIXELS
The framebuffer device was mapped to memory successfully.
color: red   rgb_val: 00FF0000
color: green   rgb_val: 0000FF00
color: blue   rgb_val: 000000FF
color: r & g   rgb_val: 00FFFF00
color: g & b   rgb_val: 0000FFFF
color: r & b   rgb_val: 00FF00FF
color: white   rgb_val: 00FFFFFF
color: black   rgb_val: 00000000

注意 如果有上述输出,但是屏没有显示,是因为设备树没有更新,需要进入uboot执行:

= > setenv fdt_file myb-rzg2l-disp.dtb
= > saveenv

触摸测试

需要连接带触摸的屏,我这里是MY-TFT070-K

终端执行行“evtest”进入测试界面

root@myir-yg2lx:~# evtest
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0:      keyboard
/dev/input/event1:      generic ft5x06 (79)
/dev/input/event2:      A4TECH USB Device Keyboard
/dev/input/event3:      A4TECH USB Device System Control
/dev/input/event4:      A4TECH USB Device Consumer Control
/dev/input/event5:      A4TECH USB Device
/dev/input/event6:      A4TECH USB Device
Select the device event number [0-6]:

从结果我看到,触摸屏ft5x06为event1。我们输入1

Select the device event number [0-6]: 1
Input driver version is 1.0.1
Input device ID: bus 0x18 vendor 0x0 product 0x0 version 0x0
Input device name: "generic ft5x06 (79)"
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    155
      Min        0
      Max      799
    Event code 1 (ABS_Y)
      Value    476
      Min        0
      Max      479
    Event code 47 (ABS_MT_SLOT)
      Value      0
      Min        0
      Max        4
    Event code 53 (ABS_MT_POSITION_X)
      Value      0
      Min        0
      Max      799
    Event code 54 (ABS_MT_POSITION_Y)
      Value      0
      Min        0
      Max      479
    Event code 57 (ABS_MT_TRACKING_ID)
      Value      0
      Min        0
      Max    65535
Properties:
  Property type 1 (INPUT_PROP_DIRECT)
Testing ... (interrupt to exit)

然后我们点击屏就有相应的输出:

Event: time 3029532101.3029532101, type 3 (EV_ABS), code 57 (ABS_MT_TRACKING_ID), value 34
Event: time 3029532101.3029532101, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 486
Event: time 3029532101.3029532101, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 172
Event: time 3029532101.3029532101, type 1 (EV_KEY), code 330 (BTN_TOUCH), value 1
Event: time 3029532101.3029532101, type 3 (EV_ABS), code 0 (ABS_X), value 486
Event: time 3029532101.3029532101, type 3 (EV_ABS), code 1 (ABS_Y), value 172
Event: time 3029532101.3029532101, -------------- SYN_REPORT ------------
Event: time 3029532101.3029532101, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 485
Event: time 3029532101.3029532101, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 171
Event: time 3029532101.3029532101, type 3 (EV_ABS), code 0 (ABS_X), value 485
Event: time 3029532101.3029532101, type 3 (EV_ABS), code 1 (ABS_Y), value 171
Event: time 3029532101.3029532101, -------------- SYN_REPORT ------------
Event: time 3029532101.3029532101, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 484
Event: time 3029532101.3029532101, type 3 (EV_ABS), code 0 (ABS_X), value 484
Event: time 3029532101.3029532101, -------------- SYN_REPORT ------------
Event: time 3029532101.3029532101, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 485
Event: time 3029532101.30295322
Event: time 3029532101.3029532101, -------------- SYN_REPORT ------------
Event: time 3029532101.3029532101, type 3 (EV_ABS), code 57 (ABS_MT_TRACKING_ID), value -1
Event: time 3029532101.3029532101, type 1 (EV_KEY), code 330 (BTN_TOUCH), value 0
Event: time 3029532101.3029532101, -------------- SYN_REPORT ------------

由上面可知,主要显示坐标值、键值,具体信息如下:

EV_SYN:同步事件

EV_KEY:按键事件,如 BTN_TOUCH 表示是触摸按键

EV_ABS:绝对坐标,如触摸屏上报的坐标

BTN_TOUCH:触摸按键

ABS_MT_SLOT:事件中对应的 value

ABS_MT_TRACKING_ID 表示采集信息开始

单点触摸信息是以 ABS 承载并按一定顺序发送,如:

ABS_X:是相对于屏幕绝对坐标 X

ABS_Y:是相对于屏幕绝对坐标 Y

而多点触摸信息则是以 ABS_MT 承载并按一定顺序发送,如:

ABS_MT_POSITION_X:表示屏幕接触面的中心点 x 坐标位置.

ABS_MT_POSITION_Y:表示屏幕接触面的中心点 Y 坐标位置

审核编辑:汤梓红

打开APP阅读更多精彩内容
声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉

全部0条评论

快来发表一下你的评论吧 !

×
20
完善资料,
赚取积分