Fire a pinch in/out command to Android phone using adb -
so far i'm able tap, swipe, unlock, install/uninstall , launch app using adb commands not able find how perform zoom in/out using adb command.
i have got coordinates of pinch in/out not understanding how fire them using adb command terminal.
for example , have command --> adb shell input tap x y in can replace x , y values/coordinates want know way simulate pinch in/out.
coordinates pinch-in below.
{"id":0,"dumb":[{"events":[{"id":0,"pressure":1,"x":392.94117647058823,"y":607.4264705882354}],"action":0},{"events":[{"id":0,"pressure":1,"x":392.94117647058823,"y":607.4264705882354},{"id":1,"pressure":1,"x":327.05882352941177,"y":672.5735294117648}],"action":261},{"events":[{"id":0,"pressure":1,"x":392.94117647058823,"y":609.7794117647059},{"id":1,"pressure":1,"x":327.05882352941177,"y":670.2205882352941}],"action":2},{"events":[{"id":0,"pressure":1,"x":392.94117647058823,"y":612.1323529411765},{"id":1,"pressure":1,"x":327.05882352941177,"y":667.8676470588235}],"action":2},{"events":[{"id":0,"pressure":1,"x":392.94117647058823,"y":616.8382352941177},{"id":1,"pressure":1,"x":327.05882352941177,"y":663.1617647058823}],"action":2},{"events":[{"id":0,"pressure":1,"x":392.94117647058823,"y":626.25},{"id":1,"pressure":1,"x":327.05882352941177,"y":653.75}],"action":2},{"events":[{"id":0,"pressure":1,"x":392.94117647058823,"y":630.9558823529412},{"id":1,"pressure":1,"x":327.05882352941177,"y":649.0441176470589}],"action":2},{"events":[{"id":0,"pressure":1,"x":395.29411764705884,"y":635.6617647058823},{"id":1,"pressure":1,"x":324.70588235294116,"y":644.3382352941177}],"action":2},{"events":[{"id":0,"pressure":1,"x":397.64705882352945,"y":642.7205882352941},{"id":1,"pressure":1,"x":322.3529411764706,"y":637.2794117647059}],"action":2},{"events":[{"id":0,"pressure":1,"x":400,"y":649.7794117647059},{"id":1,"pressure":1,"x":320,"y":630.2205882352941}],"action":2},{"events":[{"id":0,"pressure":1,"x":402.3529411764706,"y":656.8382352941177},{"id":1,"pressure":1,"x":317.64705882352945,"y":623.1617647058823}],"action":2},{"events":[{"id":0,"pressure":1,"x":402.3529411764706,"y":661.5441176470589},{"id":1,"pressure":1,"x":317.64705882352945,"y":618.4558823529412}],"action":2},{"events":[{"id":0,"pressure":1,"x":404.7058823529412,"y":668.6029411764706},{"id":1,"pressure":1,"x":315.29411764705884,"y":611.3970588235294}],"action":2},{"events":[{"id":0,"pressure":1,"x":404.7058823529412,"y":673.3088235294118},{"id":1,"pressure":1,"x":315.29411764705884,"y":606.6911764705883}],"action":2},{"events":[{"id":0,"pressure":1,"x":404.7058823529412,"y":680.3676470588235},{"id":1,"pressure":1,"x":315.29411764705884,"y":599.6323529411765}],"action":2},{"events":[{"id":0,"pressure":1,"x":407.05882352941177,"y":685.0735294117648},{"id":1,"pressure":1,"x":312.94117647058823,"y":594.9264705882354}],"action":2},{"events":[{"id":0,"pressure":1,"x":407.05882352941177,"y":687.4264705882354},{"id":1,"pressure":1,"x":312.94117647058823,"y":592.5735294117648}],"action":2},{"events":[{"id":0,"pressure":1,"x":409.4117647058824,"y":689.7794117647059},{"id":1,"pressure":1,"x":310.5882352941177,"y":590.2205882352941}],"action":2},{"events":[{"id":0,"pressure":1,"x":411.7647058823529,"y":694.4852941176471},{"id":1,"pressure":1,"x":308.2352941176471,"y":585.5147058823529}],"action":2},{"events":[{"id":0,"pressure":1,"x":411.7647058823529,"y":699.1911764705883},{"id":1,"pressure":1,"x":308.2352941176471,"y":580.8088235294118}],"action":2},{"events":[{"id":0,"pressure":1,"x":414.11764705882354,"y":706.25},{"id":1,"pressure":1,"x":305.88235294117646,"y":573.75}],"action":2},{"events":[{"id":0,"pressure":1,"x":416.47058823529414,"y":713.3088235294118},{"id":1,"pressure":1,"x":303.5294117647059,"y":566.6911764705883}],"action":2},{"events":[{"id":0,"pressure":1,"x":418.8235294117647,"y":715.6617647058824},{"id":1,"pressure":1,"x":301.1764705882353,"y":564.3382352941177}],"action":2},{"events":[{"id":0,"pressure":1,"x":418.8235294117647,"y":718.0147058823529},{"id":1,"pressure":1,"x":301.1764705882353,"y":561.9852941176471}],"action":2},{"events":[{"id":0,"pressure":1,"x":418.8235294117647,"y":720.3676470588235},{"id":1,"pressure":1,"x":301.1764705882353,"y":559.6323529411765}],"action":2},{"events":[{"id":0,"pressure":1,"x":421.1764705882353,"y":727.4264705882354},{"id":1,"pressure":1,"x":298.8235294117647,"y":552.5735294117648}],"action":2},{"events":[{"id":0,"pressure":1,"x":421.1764705882353,"y":732.1323529411765},{"id":1,"pressure":1,"x":298.8235294117647,"y":547.8676470588235}],"action":2},{"events":[{"id":0,"pressure":1,"x":423.5294117647059,"y":739.1911764705883},{"id":1,"pressure":1,"x":296.47058823529414,"y":540.8088235294118}],"action":2},{"events":[{"id":0,"pressure":1,"x":425.88235294117646,"y":746.25},{"id":1,"pressure":1,"x":294.11764705882354,"y":533.75}],"action":2},{"events":[{"id":0,"pressure":1,"x":425.88235294117646,"y":753.3088235294118},{"id":1,"pressure":1,"x":294.11764705882354,"y":526.6911764705883}],"action":2},{"events":[{"id":0,"pressure":1,"x":428.2352941176471,"y":758.0147058823529},{"id":1,"pressure":1,"x":291.7647058823529,"y":521.9852941176471}],"action":2},{"events":[{"id":0,"pressure":1,"x":435.29411764705884,"y":765.0735294117648},{"id":1,"pressure":1,"x":284.70588235294116,"y":514.9264705882354}],"action":2},{"events":[{"id":0,"pressure":1,"x":440,"y":769.7794117647059},{"id":1,"pressure":1,"x":280,"y":510.22058823529414}],"action":2},{"events":[{"id":0,"pressure":1,"x":440,"y":779.1911764705883},{"id":1,"pressure":1,"x":280,"y":500.80882352941177}],"action":2},{"events":[{"id":0,"pressure":1,"x":444.7058823529412,"y":788.6029411764706},{"id":1,"pressure":1,"x":275.29411764705884,"y":491.39705882352945}],"action":2},{"events":[{"id":0,"pressure":1,"x":451.7647058823529,"y":800.3676470588235},{"id":1,"pressure":1,"x":268.2352941176471,"y":479.63235294117646}],"action":2},{"events":[{"id":0,"pressure":1,"x":456.47058823529414,"y":812.1323529411765},{"id":1,"pressure":1,"x":263.5294117647059,"y":467.86764705882354}],"action":2},{"events":[{"id":0,"pressure":1,"x":461.1764705882353,"y":821.5441176470589},{"id":1,"pressure":1,"x":258.8235294117647,"y":458.4558823529412}],"action":2},{"events":[{"id":0,"pressure":1,"x":465.88235294117646,"y":833.3088235294118},{"id":1,"pressure":1,"x":254.11764705882354,"y":446.69117647058823}],"action":2},{"events":[{"id":0,"pressure":1,"x":470.5882352941177,"y":840.3676470588235},{"id":1,"pressure":1,"x":249.41176470588235,"y":439.63235294117646}],"action":2},{"events":[{"id":0,"pressure":1,"x":475.29411764705884,"y":847.4264705882354},{"id":1,"pressure":1,"x":244.7058823529412,"y":432.5735294117647}],"action":2},{"events":[{"id":0,"pressure":1,"x":477.64705882352945,"y":854.4852941176471},{"id":1,"pressure":1,"x":242.3529411764706,"y":425.5147058823529}],"action":2},{"events":[{"id":0,"pressure":1,"x":482.3529411764706,"y":863.8970588235294},{"id":1,"pressure":1,"x":237.64705882352942,"y":416.1029411764706}],"action":2},{"events":[{"id":0,"pressure":1,"x":484.7058823529412,"y":870.9558823529412},{"id":1,"pressure":1,"x":235.29411764705884,"y":409.04411764705884}],"action":2},{"events":[{"id":0,"pressure":1,"x":489.4117647058824,"y":875.6617647058824},{"id":1,"pressure":1,"x":230.58823529411765,"y":404.3382352941177}],"action":2},{"events":[{"id":0,"pressure":1,"x":489.4117647058824,"y":878.0147058823529},{"id":1,"pressure":1,"x":230.58823529411765,"y":401.9852941176471}],"action":2},{"events":[{"id":0,"pressure":1,"x":491.764705882353,"y":882.7205882352941},{"id":1,"pressure":1,"x":228.23529411764707,"y":397.2794117647059}],"action":2},{"events":[{"id":0,"pressure":1,"x":494.11764705882354,"y":885.0735294117648},{"id":1,"pressure":1,"x":225.88235294117646,"y":394.9264705882353}],"action":2},{"events":[{"id":0,"pressure":1,"x":496.47058823529414,"y":892.1323529411765},{"id":1,"pressure":1,"x":223.52941176470588,"y":387.86764705882354}],"action":2},{"events":[{"id":0,"pressure":1,"x":501.1764705882353,"y":899.1911764705883},{"id":1,"pressure":1,"x":218.82352941176472,"y":380.80882352941177}],"action":2},{"events":[{"id":0,"pressure":1,"x":503.5294117647059,"y":908.6029411764706},{"id":1,"pressure":1,"x":216.47058823529412,"y":371.39705882352945}],"action":2},{"events":[{"id":0,"pressure":1,"x":505.88235294117646,"y":908.6029411764706},{"id":1,"pressure":1,"x":214.11764705882354,"y":371.39705882352945}],"action":2},{"events":[{"id":0,"pressure":1,"x":505.88235294117646,"y":910.9558823529412},{"id":1,"pressure":1,"x":214.11764705882354,"y":369.04411764705884}],"action":2},{"events":[{"id":0,"pressure":1,"x":505.88235294117646,"y":913.3088235294118},{"id":1,"pressure":1,"x":214.11764705882354,"y":366.69117647058823}],"action":2},{"events":[{"id":0,"pressure":1,"x":505.88235294117646,"y":913.3088235294118}],"action":1},{"events":[{"id":0,"pressure":1,"x":505.88235294117646,"y":913.3088235294118},{"id":1,"pressure":1,"x":214.11764705882354,"y":366.69117647058823}],"action":262}],"eventtype":"motion"}
you can using adb getevent
, sendevent
.
connect device using adb
. follow steps below.
identify input device:
open image on device. list input devices, run$ adb shell getevent add device 1: /dev/input/event7 name: "msm8226-tapan9302-snd-card headset jack" add device 2: /dev/input/event6 name: "msm8226-tapan9302-snd-card button jack" add device 3: /dev/input/event2 name: "synaptics_dsx_i2c" add device 4: /dev/input/event4 name: "qpnp_pon"
pinch in/out on image, should see continuous logs
/dev/input/event2: 0003 0030 00000005 /dev/input/event2: 0000 0000 00000000 /dev/input/event2: 0003 002f 00000000 /dev/input/event2: 0003 0036 00000144 /dev/input/event2: 0003 003a 00000079 /dev/input/event2: 0000 0000 00000000 /dev/input/event2: 0003 0036 00000142
confirms
/dev/input/event2
input device name target device.get exact
getevent
, convertgetevent
sendevent
:make sure screen switched on , open image,
run below command on prompt.$ adb shell getevent | grep dev/input/event2 > getevent_input.txt
while above running, pinch in/out on image on phone.
once completed, kill above command ctrl + c
open filegetevent_input.txt
, delete first line"add device x: /dev/input/eventx"
it.since
getevent
returns values in decimal, ,sendevent
takes value in hexadecimal.
have above conversion.
scripthex_to_dec.py
here job. this guy!$./hex_to_dec.py getevent_input.txt
generates file
getevent_input.scr
, rename file.sh
$ mv getevent_input.scr sendevent_input.sh
open file
sendevent_input.sh
, delete second line"echoing – drawing function"
, save it.run on device.
transfersendevent_input.sh
device.$ adb push sendevent_input.sh /sdcard/ 1615 kb/s (64379 bytes in 0.038s)
make sure device has image open, , screen not off.
$ adb shell sh /sdcard/sendevent_input.sh
worked fine me, if looking for.
visible results, enable show touches
in developer options.
environment: motorola moto g (android 4.4.4)
adb (v 1.0.31)
on ubuntu 12.04
.
Comments
Post a Comment