I made a simple shell (actually windows batch) script that automates a task on android phone. It can be ran on any computer. I thought that if I convert the batch to linux
sh script, I could issue the commands without
adb shell before them.
So this (
.exe added for clarity):
adb.exe shell sleep 1
Well it works with
sleep in particular, but not with
sendevent. I made a script to press and release focus button:
#!/bin/sh # Simply send two key events to see if it works (spoiler: it doesn't) sendevent /dev/input/event0 1 212 1 sendevent /dev/input/event0 0 0 0 sleep 1 sendevent /dev/input/event0 1 212 0 sendevent /dev/input/event0 0 0 0
But I cannot execute the
That's ridiculous. Obviously my phone is capable of executing the commands from external source, so why the hell not from itself? Am I going to need a computer to work with the shell?
What can I do to issue adb commands to my own phone? (I am not using rooted device. Android developers made it too much painful to achieve.)