Skip to content

Instantly share code, notes, and snippets.

@dotdoom
Last active July 31, 2016 19:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dotdoom/03586597c00a2ca8312325eb373ed910 to your computer and use it in GitHub Desktop.
Save dotdoom/03586597c00a2ca8312325eb373ed910 to your computer and use it in GitHub Desktop.
A "daemon" constantly trying to enable ADB tcpip on any connected device
#!/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