Android getevent用法详解

本文介绍了在QualcommSDM710平台上,针对Android9.0系统中采用I2C方式通信的触摸屏(TP)驱动的调试方法。通过使用getevent工具,展示如何查看TP报点率、输入设备信息以及事件上报的详细数据,包括时间戳、不换行打印、开关状态和事件速率等,从而帮助理解和优化触摸屏的性能。
摘要由CSDN通过智能技术生成

TP驱动调试分享——基于Qualcomm SDM710平台Android9.0,TP 采用I2C方式和CPU进行通信_高通tp驱动_永恒小青青的博客-CSDN博客

手机触摸屏扫描信号实测波形_触摸屏报点率_AirCity123的博客-CSDN博客

如何查看TP报点率?触摸TP查看详细信息

adb shell
getevent -r

 

getevent 指令用于获取 input 输入事件,比如获取按键上报信息、获取触摸屏上报信息等。

指令源码路径:/system/core/toolbox/getevent.c

getevent -h:查看 getevent 帮助信息

root@rk3288:/ # getevent -h
getevent -h
Usage: getevent [-t] [-n] [-s switchmask] [-S] [-v [mask]] [-d] [-p] [-i] [-l] [-q] [-c count] [-r] [device]
    -t: show time stamps
    -n: don't print newlines
    -s: print switch states for given bits
    -S: print all switch states
    -v: verbosity mask (errs=1, dev=2, name=4, info=8, vers=16, pos. events=32, props=64)
    -d: show HID descriptor, if available
    -p: show possible events (errs, dev, name, pos. events)
    -i: show all device info and possible events
    -l: label event types and names in plain text
    -q: quiet (clear verbosity mask)
    -c: print given number of events then exit
    -r: print rate events are received

getevent:显示当前有那些输入设备,数量与 /dev/input 目录下相同

root@rk3288:/ # getevent
getevent
add device 1: /dev/input/event3
  name:     "ILITEK Multi-Touch-V3020"
add device 2: /dev/input/event2
  name:     "PC Camera"
add device 3: /dev/input/event1
  name:     "gsensor"
add device 4: /dev/input/event0
  name:     "rk29-keypad"

root@rk3288:/ # ls /dev/input
ls /dev/input
event0
event1
event2
event3

查看默认上报数据

root@rk3288:/ # getevent /dev/input/event3
getevent /dev/input/event3
0003 0039 00000004
0003 0035 00002324
0003 0036 00001a9f
0001 014a 00000001
0003 0000 00002324
0003 0001 00001a9f
0000 0000 00000000
0003 0039 ffffffff
0001 014a 00000000
0000 0000 00000000

-t:显示时间戳

// 读取 event3 数据(触摸屏)
root@rk3288:/ # getevent -t /dev/input/event3
getevent -t /dev/input/event3
[    1141.248434] 0003 0039 0000000e
[    1141.248434] 0003 0035 00002cd4
[    1141.248434] 0003 0036 00001a09
[    1141.248434] 0001 014a 00000001
[    1141.248434] 0003 0000 00002cd4
[    1141.248434] 0003 0001 00001a09
[    1141.248434] 0000 0000 00000000
[    1141.322181] 0003 0039 ffffffff
[    1141.322181] 0001 014a 00000000
[    1141.322181] 0000 0000 00000000

-n:不换行打印

root@rk3288:/ # getevent -n /dev/input/event3
getevent -n /dev/input/event3
0003 0039 000000020003 0035 00002f000003 0036 00001a4e0001 014a 000000010003 0000 00002f000003 0001 00001a4e0000 0000 000000000003 0039 ffffffff0001 014a 000000000000 0000 000000000003 0039 000000030003 0035 00002e880003 0036 000019b80001 014a 000000010003 0000 00002e880003 0001 000019b80000 0000 000000000003 0039 ffffffff0001 014a 000000000000 0000 000000000003 0039 000000040003 0035 00002d700003 0036 00001a000001 014a 000000010003 0000 00002d700003 0001 00001a000000 0000 000000000003 0039 ffffffff0001 014a 000000000000 0000 000000000003 0039 000000050003 0035 00002d080003 0036 000019a50001 014a 000000010003 0000 00002d080003 0001 000019a50000 0000 000000000003 0039 ffffffff0001 014a 000000000000

-s:显示指定位的开关状态

root@rk3288:/ # getevent -s5 /dev/input/event3
getevent -s5 /dev/input/event3
0000

-S:显示所有位的开关状态

root@rk3288:/ # getevent -S /dev/input/event3
getevent -S /dev/input/event3
0000 

-v:根据 mask 值显示相关信息,执行后会一直显示上报数据

errs=1, dev=2, name=4, info=8, vers=16, pos. events=32, props=64

默认显示 dev| name| info| vers = 30;

root@rk3288:/ # getevent -v /dev/input/event3
getevent -v /dev/input/event3
add device 1: /dev/input/event3
  bus:      0003
  vendor    222a
  product   004d
  version   0110
  name:     "ILITEK Multi-Touch-V3020"
  location: "usb-ff540000.usb-1.3/input0"
  id:       ""
  version:  1.0.1

root@rk3288:/ # getevent -v30 /dev/input/event3
getevent -v30 /dev/input/event3
add device 1: /dev/input/event3
  bus:      0003
  vendor    222a
  product   004d
  version   0110
  name:     "ILITEK Multi-Touch-V3020"
  location: "usb-ff540000.usb-1.3/input0"
  id:       ""
  version:  1.0.1

root@rk3288:/ # getevent -v2 /dev/input/event3
getevent -v2 /dev/input/event3
add device 1: /dev/input/event3

root@rk3288:/ # getevent -v8 /dev/input/event3
getevent -v8 /dev/input/event3
  bus:      0003
  vendor    222a
  product   004d
  version   0110
  location: "usb-ff540000.usb-1.3/input0"
  id:       ""

root@rk3288:/ # getevent -v16 /dev/input/event3
getevent -v16 /dev/input/event3
  version:  1.0.1

root@rk3288:/ # getevent -v32 /dev/input/event3
getevent -v32 /dev/input/event3
  events:
    KEY (0001): 014a
    ABS (0003): 0000  : value 12008, min 0, max 16384, fuzz 0, flat 0, resolution 31
                0001  : value 5790, min 0, max 9600, fuzz 0, flat 0, resolution 32
                002f  : value 0, min 0, max 9, fuzz 0, flat 0, resolution 0
                0035  : value 0, min 0, max 16384, fuzz 0, flat 0, resolution 31
                0036  : value 0, min 0, max 9600, fuzz 0, flat 0, resolution 32
                0039  : value 0, min 0, max 65535, fuzz 0, flat 0, resolution 0

-d:如果设备可用,显示设备隐藏的描述信息

-p:显示设备支持的事件类型和编码方式

root@rk3288:/ # getevent -p /dev/input/event3
getevent -p /dev/input/event3
add device 1: /dev/input/event3
  name:     "ILITEK Multi-Touch-V3020"
  events:
    KEY (0001): 014a
    ABS (0003): 0000  : value 13084, min 0, max 16384, fuzz 0, flat 0, resolution 31
                0001  : value 5284, min 0, max 9600, fuzz 0, flat 0, resolution 32
                002f  : value 0, min 0, max 9, fuzz 0, flat 0, resolution 0
                0035  : value 0, min 0, max 16384, fuzz 0, flat 0, resolution 31
                0036  : value 0, min 0, max 9600, fuzz 0, flat 0, resolution 32
                0039  : value 0, min 0, max 65535, fuzz 0, flat 0, resolution 0
  input props:
    INPUT_PROP_DIRECT

-i:显示设备的所有信息和支持的事件,比 -p 显示更多信息

root@rk3288:/ # getevent -i /dev/input/event3

-l:以文本形式输出事件类型和名称,比 -t 更清楚直观

// 读取 event3 数据(触摸屏)
root@rk3288:/ # getevent -l /dev/input/event3
getevent -l /dev/input/event3
// 事件类型      事件码              事件值
EV_ABS       ABS_MT_TRACKING_ID   0000000f
EV_ABS       ABS_MT_POSITION_X    00002bbc
EV_ABS       ABS_MT_POSITION_Y    00001b6d
EV_KEY       BTN_TOUCH            DOWN
EV_ABS       ABS_X                00002bbc
EV_ABS       ABS_Y                00001b6d
EV_SYN       SYN_REPORT           00000000
EV_ABS       ABS_MT_TRACKING_ID   ffffffff
EV_KEY       BTN_TOUCH            UP
EV_SYN       SYN_REPORT           00000000

-q:暂时不会使用

-c:打印固定数量的事件并退出

root@rk3288:/ # getevent -c 10 /dev/input/event3
getevent -c 10 /dev/input/event3
0003 0039 00000012
0003 0035 000038a4
0003 0036 000008f5
0001 014a 00000001
0003 0000 000038a4
0003 0001 000008f5
0000 0000 00000000
0003 0039 ffffffff
0001 014a 00000000
0000 0000 00000000

-r:显示事件上报速率

// 检测触摸屏报点速率
root@rk3288:/ # getevent -r /dev/input/event3
getevent -r /dev/input/event3
0003 0039 00000015
0003 0035 000030d8
0003 0036 00001954
0001 014a 00000001
0003 0000 000030d8
0003 0001 00001954
0000 0000 00000000 rate 0
0003 0039 ffffffff
0001 014a 00000000
0000 0000 00000000 rate 9

参数可以组合使用,一次性查看需要的触摸屏信息

root@rk3288:/ # getevent -tlr /dev/input/event3
getevent -tlr /dev/input/event3
[    2514.550104] EV_ABS       ABS_MT_TRACKING_ID   0000001c
[    2514.550104] EV_ABS       ABS_MT_POSITION_X    00002dac
[    2514.550104] EV_ABS       ABS_MT_POSITION_Y    000018ca
[    2514.550104] EV_KEY       BTN_TOUCH            DOWN
[    2514.550104] EV_ABS       ABS_X                00002dac
[    2514.550104] EV_ABS       ABS_Y                000018ca
[    2514.550104] EV_SYN       SYN_REPORT           00000000             rate 0
[    2514.638845] EV_ABS       ABS_MT_TRACKING_ID   ffffffff
[    2514.638845] EV_KEY       BTN_TOUCH            UP
[    2514.638845] EV_SYN       SYN_REPORT           00000000             rate 11
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值