Last active
July 31, 2016 19:34
-
-
Save dotdoom/03586597c00a2ca8312325eb373ed910 to your computer and use it in GitHub Desktop.
A "daemon" constantly trying to enable ADB tcpip on any connected device
This file contains hidden or 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
#!/usr/bin/env bash | |
sleep 5 | |
if /sbin/ifconfig usb0 &>/dev/null; then | |
# usb0 is present - we are in slave mode, this script won't work. | |
exit | |
fi | |
led() { | |
local brightness=0 | |
[ "$1" -eq 0 ] && brightness=1 | |
echo "$brightness" >/sys/class/leds/LED/brightness | |
} | |
/sbin/modprobe -r ledtrig_heartbeat | |
while :; do | |
if adb tcpip 5554 &>/dev/null; then | |
led 1 | |
sleep 10 | |
else | |
led 0 | |
sleep 2 | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment