Created
March 16, 2020 14:18
-
-
Save varvaruc/03830e86b6718d65f6ad3a6974945a91 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "Key bindings:" | |
echo "A -> LEFT S -> DOWN D -> RIGHT W -> UP Q - BACK E - SELECT P - POWER ON\\OFF H -> HOME" | |
while : | |
do | |
read -t 1 -n 1 key | |
if [[ $key = a ]] | |
then | |
echo "Pressed LEFT\n" | |
adb shell input keyevent 21 | |
fi | |
if [[ $key = d ]] | |
then | |
echo "Pressed RIGHT\n" | |
adb shell input keyevent 22 | |
fi | |
if [[ $key = w ]] | |
then | |
echo "Pressed UP\n" | |
adb shell input keyevent 19 | |
fi | |
if [[ $key = s ]] | |
then | |
echo "Pressed DOWN\n" | |
adb shell input keyevent 20 | |
fi | |
if [[ $key = q ]] | |
then | |
echo "Pressed BACK\n" | |
adb shell input keyevent 4 | |
fi | |
if [[ $key = e ]] | |
then | |
echo "Pressed SELECT\n" | |
adb shell input keyevent 23 | |
fi | |
if [[ $key = p ]] | |
then | |
echo "Pressed POWER\n" | |
adb shell input keyevent 26 | |
fi | |
if [[ $key = h ]] | |
then | |
echo "Pressed HOME\n" | |
adb shell input keyevent 3 | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment