不多说,看脚本:
#!/bin/bash
#touch_event="/dev/input/event1"
#touch_event="/dev/input/event2"
touch_event=""
while true
do
#a=`adb shell getevent -c 11 $touch_event | egrep "0035|0036" | awk '{print $3}'`
a=`adb shell getevent -c 11 | egrep "0035|0036" | awk '{print $4}'`
y=`echo $a | sed -n '1p'| awk '{print $2}'`
x=`echo $a | sed -n '1p'| awk '{print $1}'`
a=`echo $x | sed 's/\r//g'`
b=`echo $y | sed 's/\r//g'`
c=$((16#${a}))
d=$((16#${b}))
if [ $c -ne 0 -a $d -ne 0 ];then
echo "The touchscreen positon is x=$c,y=$d, command generate: adb shell input tap $c $d"
echo " "
fi
done