Created
May 28, 2021 08:28
-
-
Save JakubMosakowski/082a1dddc2140333eea91f0c4b6ccfff to your computer and use it in GitHub Desktop.
A simple script to connect to the device through wifi
This file contains 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
#!/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