#### adb shell getevent 获取点击事件
100135925:/ # getevent
add device 1: /dev/input/event2name: "mtk-tpd"
/dev/input/event2: 0001 014a 00000001
/dev/input/event2: 0003 0039 00000088
/dev/input/event2: 0003 0035 00000072
/dev/input/event2: 0003 0036 00000163
/dev/input/event2: 0001 0145 00000001
/dev/input/event2: 0000 0000 00000000
/dev/input/event2: 0003 0039 ffffffff
/dev/input/event2: 0001 014a 00000000
/dev/input/event2: 0001 0145 00000000
/dev/input/event2: 0000 0000 00000000#### adb shell getevent -l 获取点击事件名称
130|100135925:/ # getevent -l
add device 1: /dev/input/event2name: "mtk-tpd"
/dev/input/event2: EV_KEY BTN_TOUCH DOWN
/dev/input/event2: EV_ABS ABS_MT_TRACKING_ID 0000008a
/dev/input/event2: EV_ABS ABS_MT_POSITION_X 00000067
/dev/input/event2: EV_ABS ABS_MT_POSITION_Y 00000163
/dev/input/event2: EV_KEY BTN_TOOL_FINGER DOWN
/dev/input/event2: EV_SYN SYN_REPORT 00000000
/dev/input/event2: EV_ABS ABS_MT_TRACKING_ID ffffffff
/dev/input/event2: EV_KEY BTN_TOUCH UP
/dev/input/event2: EV_KEY BTN_TOOL_FINGER UP
/dev/input/event2: EV_SYN SYN_REPORT 00000000#### 使用windows 计算器,把16进制数据转换成10进制
sendevent /dev/input/event2 1 330 1
sendevent /dev/input/event2 3 57 136
sendevent /dev/input/event2 3 53 114
sendevent /dev/input/event2 3 54 355
sendevent /dev/input/event2 1 325 1
sendevent /dev/input/event2 0 0 0
# /dev/input/event2: 0003 0039 ffffffff // 该行数据可以丢弃不使用
sendevent /dev/input/event2 1 330 0
sendevent /dev/input/event2 1 325 0
sendevent /dev/input/event2 0 0 0#### 建sendevent.bash 文件,内容如下
#!/usr/bin/env sh
# 手机已经root
# 拖动“设置”APP 到桌面(com.android.settings), 并找到APP坐标x y。
# 上一步的坐标 替换本文件的
#
# sendevent /dev/input/event2 3 53 114 x替换114
# sendevent /dev/input/event2 3 54 355 y替换355
# adb push 本文件到 /data/local/tmp
##
## 本脚本文件在不同项目机型可能不兼容,使用前请适配
## 点击坐标 114 355
sendevent /dev/input/event2 1 330 1
sendevent /dev/input/event2 3 57 136
sendevent /dev/input/event2 3 53 114
sendevent /dev/input/event2 3 54 355
sendevent /dev/input/event2 1 325 1
sendevent /dev/input/event2 0 0 0
sendevent /dev/input/event2 1 330 0
sendevent /dev/input/event2 1 325 0
sendevent /dev/input/event2 0 0 0#### 建立test.bash 文件,内容如下,执行test.bash即可实现点击操作
#!/usr/bin/env sh
adb shell 'sh /data/local/tmp/sendevent.bash'#### sendevent: Max 4 arguments (see "sendevent --help")
如果Windows电脑在Git Bash Here 运行
test.bash 中直接使用 abd shell sendevent /dev/input/event2 1 330 1
会出现如下报错:
sendevent: Max 4 arguments (see "sendevent --help")
原因:
暂未分析