Skip to content

Instantly share code, notes, and snippets.

@vinaywadhwa
vinaywadhwa / adb_wifi_connect_all.sh
Created December 27, 2019 06:59
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"