Skip to content Skip to sidebar Skip to footer

Adding A Custom Tool To The Android Adb Shell

Answers for this question should be ideally non-rooted. I am looking at re-writing one of the adb tools, sendevent.c I have found this file online and am confident that i could ada

Solution 1:

The way I solved it in the question you referenced was by using adb push local_path remote_path and the remote directory I used is /data/local/tmp/ which requires no root permissions. To push a thing you just need to compile it locally and send push it. You can then run in on the device using adb shell absolute_path_to_script

To recap. If you want to make a custom script from a android/adb C source, you need to:

  • compile it (lets say you get my_script)
  • don't forget to make it an executable with chmod a+x my_script
  • push it to the device adb push my_script /data/local/tmp/my_script
  • run it form the device adb shell /data/local/tmp/my_script

Now to answer your other question about dragging, I ended up making my own custom sendevent script that takes a local file (from the android device), reads events line by line and sends them to the driver.

Here's the script http://pastebin.com/LWWiNA6U

It takes 3 arguments,

  • the file_input,
  • the file_output - this is specific to every device, you need to check and see where do you need to write the raw binary data to emulate touch events. For the devices I used: /dev/input/event5 (for the HTC One M7) and /dev/input/event2 (for the Galaxy Note 8)
  • and the sleep_time - delay between every touch event being sent to the driver

Hope it helps

EDIT: Oh and btw, this is example input. It's standard converted from getevent as far as I remember

0003 0039 4a0003 0035 1cc0003 0036 3a20000 0000 000000000003 0035 2500003 0036 4260000 0000 000000000003 0035 2500003 0036 4aa0000 0000 000000000003 0035 1490003 0036 3a20000 0000 000000000003 0035 c50003 0036 3a20000 0000 000000000003 0039 ffffffff0000 0000 00000000

Post a Comment for "Adding A Custom Tool To The Android Adb Shell"