diff options
author | Antonio García-Domínguez <nyoescape@gmail.com> | 2018-09-11 19:11:13 +0100 |
---|---|---|
committer | Antonio García-Domínguez <nyoescape@gmail.com> | 2018-09-11 19:11:13 +0100 |
commit | 56d87e115c203a9552e7e5bd8afb4da090dbe5b4 (patch) | |
tree | f36bc2c7785b5d95ea06cdd747a5bd22f0a5d379 | |
parent | 8dcddc871e50768c78f5316aa2b4a000322448e4 (diff) |
Check if PORT is taken: if so, show message and fall back to Wi-Fi (fixes #54)
-rwxr-xr-x | prepare-videochat.sh | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/prepare-videochat.sh b/prepare-videochat.sh index ee0cc81..8e5f91d 100755 --- a/prepare-videochat.sh +++ b/prepare-videochat.sh @@ -449,8 +449,12 @@ else sleep 1; done if phone_plugged; then - "$ADB" $ADB_FLAGS forward tcp:$PORT tcp:$PORT - IP=127.0.0.1 + if ss -ln src :$PORT | grep -q :$PORT; then + warning "Your port $PORT seems to be in use: falling back to Wi-Fi. If you would like to use USB forwarding, please free it up and try again." + else + "$ADB" $ADB_FLAGS forward tcp:$PORT tcp:$PORT + IP=127.0.0.1 + fi fi fi |