Android getevent用法详解

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
相关推荐
Python私教2 小时前
model中能定义字段声明不存储到数据库吗
数据库·oracle
Estar.Lee3 小时前
查手机号归属地免费API接口教程
android·网络·后端·网络协议·tcp/ip·oneapi
温辉_xh3 小时前
uiautomator案例
android
sun0077004 小时前
ubuntu dpkg 删除安装包
运维·服务器·ubuntu
oi774 小时前
使用itextpdf进行pdf模版填充中文文本时部分字不显示问题
java·服务器
工业甲酰苯胺4 小时前
MySQL 主从复制之多线程复制
android·mysql·adb
BestandW1shEs4 小时前
谈谈Mysql的常见基础问题
数据库·mysql
重生之Java开发工程师4 小时前
MySQL中的CAST类型转换函数
数据库·sql·mysql