Skip to content

Instantly share code, notes, and snippets.

@JakubMosakowski
Created May 28, 2021 08:28
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 JakubMosakowski/082a1dddc2140333eea91f0c4b6ccfff to your computer and use it in GitHub Desktop.
Save JakubMosakowski/082a1dddc2140333eea91f0c4b6ccfff to your computer and use it in GitHub Desktop.
A simple script to connect to the device through wifi
#!/bin/bash
# 1. Connect the phone using a USB cable.
# 2. Restart adb listening on TCP on 5555 port.
adb tcpip 5555
# 3. Sleep for 1 second (not too clean but that's the simplest way to make sure that the previous command finished).
sleep 1
# 4. Find ip address.
IP_ADDRESS=`adb shell "ip addr show wlan0 | grep -e wlan0$ | cut -d\" \" -f 6 | cut -d/ -f 1"`
# 5. Connect to the device.
adb connect $IP_ADDRESS:5555
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment