Skip to content

Instantly share code, notes, and snippets.

@zaki50
Last active December 16, 2015 11:38
Show Gist options
  • Save zaki50/5428583 to your computer and use it in GitHub Desktop.
Save zaki50/5428583 to your computer and use it in GitHub Desktop.
adb を USB から wifi接続に切り替えるコマンド。 USB接続されてる端末が複数台あるときは ADB_OPTS="-s hogehoge" wifiadb で指定。
wifiadb()
{
addr=$(adb $ADB_OPTS shell ip -f inet -o addr show dev wlan0 | awk 'BEGIN { FS="[ /]+"} {print $4;}')
if [ x"$addr" = x"" ]; then
return 1;
fi
echo "addr: ${addr}"
adb $ADB_OPTS tcpip 5555
adb connect ${addr}:5555
unset addr
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment