消防用ADB /输出命令捏到Android手机 [英] Fire a pinch in/out command to Android phone using adb

查看:208
本文介绍了消防用ADB /输出命令捏到Android手机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

到目前为止,我可以挖掘,刷一下,开锁,利用亚行命令安装/卸载和启动应用程序,但无法找到如何执行放大/缩小使用ADB命令。

我在输入/输出,但不明白怎么使用ADB命令从终端到解雇他们捏了坐标。

例如,我们有命令 - >亚行外壳输入抽头XY所以在此我们可以替换x和y的值/坐标同样地,我想知道,模拟捏的方式输入/输出

协调,我得到了夹在如下。

<$p$p><$c$c>{"id":0,"dumb":[{"events":[{"id":0,"$p$pssure":1,"x":392.94117647058823,"y":607.4264705882354}],"action":0},{"events":[{"id":0,"$p$pssure":1,"x":392.94117647058823,"y":607.4264705882354},{"id":1,"$p$pssure":1,"x":327.05882352941177,"y":672.5735294117648}],"action":261},{"events":[{"id":0,"$p$pssure":1,"x":392.94117647058823,"y":609.7794117647059},{"id":1,"$p$pssure":1,"x":327.05882352941177,"y":670.2205882352941}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":392.94117647058823,"y":612.1323529411765},{"id":1,"$p$pssure":1,"x":327.05882352941177,"y":667.8676470588235}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":392.94117647058823,"y":616.8382352941177},{"id":1,"$p$pssure":1,"x":327.05882352941177,"y":663.1617647058823}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":392.94117647058823,"y":626.25},{"id":1,"$p$pssure":1,"x":327.05882352941177,"y":653.75}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":392.94117647058823,"y":630.9558823529412},{"id":1,"$p$pssure":1,"x":327.05882352941177,"y":649.0441176470589}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":395.29411764705884,"y":635.6617647058823},{"id":1,"$p$pssure":1,"x":324.70588235294116,"y":644.3382352941177}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":397.64705882352945,"y":642.7205882352941},{"id":1,"$p$pssure":1,"x":322.3529411764706,"y":637.2794117647059}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":400,"y":649.7794117647059},{"id":1,"$p$pssure":1,"x":320,"y":630.2205882352941}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":402.3529411764706,"y":656.8382352941177},{"id":1,"$p$pssure":1,"x":317.64705882352945,"y":623.1617647058823}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":402.3529411764706,"y":661.5441176470589},{"id":1,"$p$pssure":1,"x":317.64705882352945,"y":618.4558823529412}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":404.7058823529412,"y":668.6029411764706},{"id":1,"$p$pssure":1,"x":315.29411764705884,"y":611.3970588235294}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":404.7058823529412,"y":673.3088235294118},{"id":1,"$p$pssure":1,"x":315.29411764705884,"y":606.6911764705883}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":404.7058823529412,"y":680.3676470588235},{"id":1,"$p$pssure":1,"x":315.29411764705884,"y":599.6323529411765}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":407.05882352941177,"y":685.0735294117648},{"id":1,"$p$pssure":1,"x":312.94117647058823,"y":594.9264705882354}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":407.05882352941177,"y":687.4264705882354},{"id":1,"$p$pssure":1,"x":312.94117647058823,"y":592.5735294117648}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":409.4117647058824,"y":689.7794117647059},{"id":1,"$p$pssure":1,"x":310.5882352941177,"y":590.2205882352941}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":411.7647058823529,"y":694.4852941176471},{"id":1,"$p$pssure":1,"x":308.2352941176471,"y":585.5147058823529}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":411.7647058823529,"y":699.1911764705883},{"id":1,"$p$pssure":1,"x":308.2352941176471,"y":580.8088235294118}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":414.11764705882354,"y":706.25},{"id":1,"$p$pssure":1,"x":305.88235294117646,"y":573.75}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":416.47058823529414,"y":713.3088235294118},{"id":1,"$p$pssure":1,"x":303.5294117647059,"y":566.6911764705883}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":418.8235294117647,"y":715.6617647058824},{"id":1,"$p$pssure":1,"x":301.1764705882353,"y":564.3382352941177}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":418.8235294117647,"y":718.0147058823529},{"id":1,"$p$pssure":1,"x":301.1764705882353,"y":561.9852941176471}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":418.8235294117647,"y":720.3676470588235},{"id":1,"$p$pssure":1,"x":301.1764705882353,"y":559.6323529411765}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":421.1764705882353,"y":727.4264705882354},{"id":1,"$p$pssure":1,"x":298.8235294117647,"y":552.5735294117648}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":421.1764705882353,"y":732.1323529411765},{"id":1,"$p$pssure":1,"x":298.8235294117647,"y":547.8676470588235}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":423.5294117647059,"y":739.1911764705883},{"id":1,"$p$pssure":1,"x":296.47058823529414,"y":540.8088235294118}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":425.88235294117646,"y":746.25},{"id":1,"$p$pssure":1,"x":294.11764705882354,"y":533.75}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":425.88235294117646,"y":753.3088235294118},{"id":1,"$p$pssure":1,"x":294.11764705882354,"y":526.6911764705883}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":428.2352941176471,"y":758.0147058823529},{"id":1,"$p$pssure":1,"x":291.7647058823529,"y":521.9852941176471}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":435.29411764705884,"y":765.0735294117648},{"id":1,"$p$pssure":1,"x":284.70588235294116,"y":514.9264705882354}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":440,"y":769.7794117647059},{"id":1,"$p$pssure":1,"x":280,"y":510.22058823529414}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":440,"y":779.1911764705883},{"id":1,"$p$pssure":1,"x":280,"y":500.80882352941177}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":444.7058823529412,"y":788.6029411764706},{"id":1,"$p$pssure":1,"x":275.29411764705884,"y":491.39705882352945}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":451.7647058823529,"y":800.3676470588235},{"id":1,"$p$pssure":1,"x":268.2352941176471,"y":479.63235294117646}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":456.47058823529414,"y":812.1323529411765},{"id":1,"$p$pssure":1,"x":263.5294117647059,"y":467.86764705882354}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":461.1764705882353,"y":821.5441176470589},{"id":1,"$p$pssure":1,"x":258.8235294117647,"y":458.4558823529412}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":465.88235294117646,"y":833.3088235294118},{"id":1,"$p$pssure":1,"x":254.11764705882354,"y":446.69117647058823}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":470.5882352941177,"y":840.3676470588235},{"id":1,"$p$pssure":1,"x":249.41176470588235,"y":439.63235294117646}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":475.29411764705884,"y":847.4264705882354},{"id":1,"$p$pssure":1,"x":244.7058823529412,"y":432.5735294117647}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":477.64705882352945,"y":854.4852941176471},{"id":1,"$p$pssure":1,"x":242.3529411764706,"y":425.5147058823529}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":482.3529411764706,"y":863.8970588235294},{"id":1,"$p$pssure":1,"x":237.64705882352942,"y":416.1029411764706}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":484.7058823529412,"y":870.9558823529412},{"id":1,"$p$pssure":1,"x":235.29411764705884,"y":409.04411764705884}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":489.4117647058824,"y":875.6617647058824},{"id":1,"$p$pssure":1,"x":230.58823529411765,"y":404.3382352941177}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":489.4117647058824,"y":878.0147058823529},{"id":1,"$p$pssure":1,"x":230.58823529411765,"y":401.9852941176471}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":491.764705882353,"y":882.7205882352941},{"id":1,"$p$pssure":1,"x":228.23529411764707,"y":397.2794117647059}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":494.11764705882354,"y":885.0735294117648},{"id":1,"$p$pssure":1,"x":225.88235294117646,"y":394.9264705882353}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":496.47058823529414,"y":892.1323529411765},{"id":1,"$p$pssure":1,"x":223.52941176470588,"y":387.86764705882354}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":501.1764705882353,"y":899.1911764705883},{"id":1,"$p$pssure":1,"x":218.82352941176472,"y":380.80882352941177}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":503.5294117647059,"y":908.6029411764706},{"id":1,"$p$pssure":1,"x":216.47058823529412,"y":371.39705882352945}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":505.88235294117646,"y":908.6029411764706},{"id":1,"$p$pssure":1,"x":214.11764705882354,"y":371.39705882352945}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":505.88235294117646,"y":910.9558823529412},{"id":1,"$p$pssure":1,"x":214.11764705882354,"y":369.04411764705884}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":505.88235294117646,"y":913.3088235294118},{"id":1,"$p$pssure":1,"x":214.11764705882354,"y":366.69117647058823}],"action":2},{"events":[{"id":0,"$p$pssure":1,"x":505.88235294117646,"y":913.3088235294118}],"action":1},{"events":[{"id":0,"$p$pssure":1,"x":505.88235294117646,"y":913.3088235294118},{"id":1,"$p$pssure":1,"x":214.11764705882354,"y":366.69117647058823}],"action":262}],"eventType":"MOTION"}

解决方案

您可以将其用做亚行getevent 的SendEvent 。照片 使用连接你的设备<​​code>亚洲开发银行。按照下面的步骤。

  1. 了解您的输入设备:
    打开设备上的任何图像。要列出输入设备,执行

      $ ADB壳getevent
    添加设备1是:/ dev /输入/ event7
    名称:msm8226-tapan9302-SND卡耳机插孔
    添加设备2是:/ dev /输入/ event6
      名称:msm8226-tapan9302-SND卡按钮杰克
    添加设备3是:/ dev /输入/ EVENT2
      名称:synaptics_dsx_i2c
    添加设备4是:/ dev /输入/ event4
      名称:qpnp_pon
     

    捏/缩小图片,你应该看到一些连续的日志像

     的/ dev /输入/ EVENT2:0003 0030 00000005
    的/ dev /输入/ EVENT2:0000 0000 00000000
    的/ dev /输入/ EVENT2:0003 002F 00000000
    的/ dev /输入/ EVENT2:0003 0036 00000144
    的/ dev /输入/ EVENT2:0003 003A 00000079
    的/ dev /输入/ EVENT2:0000 0000 00000000
    的/ dev /输入/ EVENT2:0003 0036 00000142
     

    确认的/ dev /输入/ EVENT2 是我的目标设备的输入设备名称。

  2. 获取详细的 getevent 并转换 getevent 的SendEvent

    请确保您的屏幕打开,开放与一些图像,
    运行下面的命令的提示。

      $ ADB壳getevent | grep的开发/输入/ EVENT2&GT; getevent_input.txt
     

    虽然上面运行时,捏住/你的手机上的图像上。

    一旦完成,杀死上面的命令<大骨节病>控制 + <大骨节病> C
    打开文件 getevent_input.txt 键,删除第一行添加设备X:为/ dev /输入/ eventX从它

    由于 getevent 返回十进制值,的SendEvent 取的十六进制值。
    我们要做上面的转换。
    该脚本 hex_to_dec.py 这里做这项工作。感谢<一href="http://qatesttech.word$p$pss.com/2012/06/21/turning-the-output-from-getevent-into-something-something-that-can-be-used/">this家伙!

      $ / hex_to_dec.py getevent_input.txt
     

    生成一个文件 getevent_input.scr ,现在重命名为 .SH

      $ MV getevent_input.scr sendevent_input.sh
     

    打开文件 sendevent_input.sh 键,删除第二行的呼应 - 绘制函数和保存

  3. 在设备上运行。
    转让 sendevent_input.sh 到设备。

      $ ADB推sendevent_input.sh / SD卡/
    1615 KB /秒(在0.038s 64379字节)
     

    请确保你的设备有一个形象打开,屏幕不关闭。

      $ ADB壳SH /sdcard/sendevent_input.sh
     

完全正常工作对我来说,如果你在找什么
对于明显的效果,使 显示触摸 在开发人员选项。

环境:摩托罗拉摩托G(安卓4.4.4)亚洲开发银行(V 1.0.31)的Ubuntu 12.04

So far I'm able to tap, swipe, unlock, install/uninstall and launch app using adb commands but not able to find how to perform zoom in/out using adb command.

I have got coordinates of pinch in/out but not understanding how to fire them using adb command from terminal.

For example , we have command --> adb shell input tap x y So in this we can replace x and y with values/coordinates similarly I want to know the way to simulate pinch in/out.

Coordinates that I get for pinch-in are 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 do it using adb getevent and sendevent.
Connect you device using adb. Follow the steps below.

  1. Identify your Input device:
    Open any image on your device. To 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 the image, you should see some continuous logs like

    /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 is the input device name for my target device.

  2. Get exact getevent and convert getevent to sendevent:

    Make sure your screen switched on and is open with some image,
    Run the below command on the prompt.

    $ adb shell getevent | grep dev/input/event2 > getevent_input.txt
    

    While the above is running, Pinch in/out on the image on your phone.

    Once completed, Kill the above command Ctrl + C
    Open file getevent_input.txt and delete first line "add device X: /dev/input/eventX" from it.

    Since getevent returns values in decimal, and sendevent takes value in hexadecimal.
    We have to do the above conversion.
    This script hex_to_dec.py here does the Job. Thanks to this guy!

    $./hex_to_dec.py  getevent_input.txt 
    

    Generates a file getevent_input.scr, Now rename this file to .sh

    $ mv getevent_input.scr  sendevent_input.sh
    

    Open file sendevent_input.sh and delete second line "echoing – drawing function" and save it.

  3. Run on device.
    Transfer sendevent_input.sh to device.

    $ adb push sendevent_input.sh /sdcard/
    1615 KB/s (64379 bytes in 0.038s)
    

    Make sure you device has an image open, and screen is not off.

    $ adb shell sh /sdcard/sendevent_input.sh
    

Worked perfectly fine for me, If this what you looking for.
For visible results, enable Show touches in Developer Options.

Environment: Motorola Moto G (Android 4.4.4) with ADB (v 1.0.31) on Ubuntu 12.04.

这篇关于消防用ADB /输出命令捏到Android手机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆