linux 下:
adb shell getevent | grep "0035\|0036" > info.txt
windows下:
adb shell getevent | findstr "0035 0036" > info.txt
python读取坐标:
x_dict = {}
y_dict = {}
with open("info.txt", "r") as f:
lines= f.readlines():
for line in lines:
if "0035" in line:
x_dict[x] = line.split(" ")[-1] #字典中key具有不可重复性,借此取得最新的x值
if "0036" in line:
y_dict[y] = line.split(" ")[-1] #同上
x = x_dict[x]
y = y_dict[y]