docs: create an adb script

This commit is contained in:
alfrix
2022-06-29 12:00:21 -03:00
committed by Alfredo Monclus
parent 71360b44ee
commit bde7e8a886
2 changed files with 66 additions and 54 deletions

40
scripts/android-adb.sh Normal file
View File

@@ -0,0 +1,40 @@
#!/bin/bash
# forward local display :100 to remote display :0
adb forward tcp:6100 tcp:6000
adb shell dumpsys nfc | grep 'mScreenState=' | grep OFF_LOCKED > /dev/null 2>&1
if [ $? -lt 1 ]
then
echo "Screen is OFF and Locked. Turning screen on..."
adb shell input keyevent 26
fi
adb shell dumpsys nfc | grep 'mScreenState=' | grep ON_LOCKED> /dev/null 2>&1
if [ $? -lt 1 ]
then
echo "Screen is Locked. Unlocking..."
adb shell input keyevent 82
fi
# start xsdl
adb shell am start-activity x.org.server/.MainActivity
ret=1
timeout=0
echo -n "Waiting for x-server to be ready "
while [ $ret -gt 0 ] && [ $timeout -lt 60 ]
do
xset -display :100 -q > /dev/null 2>&1
ret=$?
timeout=$( expr $timeout + 1 )
echo -n "."
sleep 1
done
echo ""
if [ $timeout -lt 60 ]
then
DISPLAY=:100 $KS_XCLIENT
exit 0
else
exit 1
fi