6

I need some help with the 2 finger zoom in/out. I tried:

adb shell getevent / sendevent

it works but the execution takes too much time.

Is there a way to do it faster?

Empario
  • 402
  • 6
  • 19
  • Are you starting a new shell every time? As in `adb shell getevent` then `adb shell sendevent` or are you running one shell then running all the commands in that shell? Running them all in the same shell should be faster. – Reed Mar 26 '15 at 17:35
  • Thanks for the quick replay Jakar. I am running it in Python script: for command in commands: command_values = command.split() subprocess.Popen(["adb", "-s", serialnumber, "shell", "sendevent", command_values[0], command_values[1], command_values[2], command_values[3]], shell=False).wait() – Empario Mar 26 '15 at 17:36
  • From the looks of the code, I'm confident it runs one shell, but I've never used Python so I can't commit to it. I don't know how to do it, but you could try opening a specific port for adb, but I doubt it would help much, since the speed problem probably is due to slow processing of the commands once received rather than slow receipt of the commands (but I'm not sure). You could also ask on android SE or XDA (or some other Android "hacking" forum). XDA might be your best bet, even though I hate that site. – Reed Mar 26 '15 at 18:13
  • 1
    possible duplicate of [Fire a pinch in/out command to Android phone using adb](http://stackoverflow.com/questions/25363526/fire-a-pinch-in-out-command-to-android-phone-using-adb) – Alex P. Mar 26 '15 at 20:35
  • Thanks Alex. I have tried something similar but the execution was very slow. I am wondering if the SD Card makes any difference. – Empario Mar 26 '15 at 20:38
  • You could use HTTP to pass a command string to an Android application (written in Java, or Native (which is... C, I think?)) and run the command without ADB. You could use something similar to http://stackoverflow.com/questions/6896618/read-command-output-inside-su-process to run the commands via Java. Also, you can (much more easily) run shell commands with https://github.com/Stericson/RootTools which last time I used it had a way to run commands without root. Haven't looked at it in awhile though. I realize its not really what you're asking, but could help. – Reed Apr 07 '15 at 17:13

1 Answers1

0

Don't see close button. This answer is what you are looking for https://stackoverflow.com/a/25629952/494343.You have to record device input and then convert it to a shell file that you write to the device and execute. Perhaps it's possible to avoid copying the file to the devices but you need to experiment with that.

Community
  • 1
  • 1
Schultz9999
  • 8,717
  • 8
  • 48
  • 87