Skip to content

Instantly share code, notes, and snippets.

@vinaywadhwa
Created December 27, 2019 06:59
Show Gist options
  • Save vinaywadhwa/3238da4bd93c4fcaf9633333687bbc75 to your computer and use it in GitHub Desktop.
Save vinaywadhwa/3238da4bd93c4fcaf9633333687bbc75 to your computer and use it in GitHub Desktop.
Android Debug Bridge (adb) Wireless Debugging Over Wi-Fi - Switch on wifi debugging in ALL devices connected (via USB, with USB debugging enabled) to your computer (tested on Mac OS)
for line in `adb devices | grep -v "List" |grep -v ":" | awk '{print $1}'`
do
device=`echo $line | awk '{print $1}'`
echo "Running commands for $device"
echo "Restarting $device in TCP mode on port 5555..."
adb -s "$device" tcpip 5555
echo "Waiting for $device to switch to TCP mode..."
sleep 7
ip_addr=$(adb -s "$device" shell ip route | grep wlan| grep -o ' 192.*$' | awk '{print $1":5555"}')
echo "Connecting to Device via WIFI on $ip_addr"
adb -s "$device" connect "$ip_addr"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment