-
-
Notifications
You must be signed in to change notification settings - Fork 240
wireless devices autoconnection #67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| #!/bin/bash | ||
|
|
||
| if [ ! -z "$REMOTE_ADB" ]; then | ||
|
|
||
| if [ -z "$REMOTE_ADB_POLLING_SEC" ]; then | ||
| REMOTE_ADB_POLLING_SEC=5 | ||
| fi | ||
|
|
||
| function connect() { | ||
| while true | ||
| do | ||
| #to avoid immediate run | ||
| sleep ${REMOTE_ADB_POLLING_SEC} | ||
| /root/wireless_connect.sh | ||
| done | ||
| } | ||
|
|
||
| ( trap "true" HUP ; connect ) >/dev/null 2>/dev/null </dev/null & disown | ||
| fi |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| #!/bin/bash | ||
|
|
||
| if [ ! -z "$ANDROID_DEVICES" ]; then | ||
| connected_devices=$(adb devices) | ||
| IFS=',' read -r -a array <<< "$ANDROID_DEVICES" | ||
| for i in "${!array[@]}" | ||
| do | ||
| array_device=$(echo ${array[$i]} | tr -d " ") | ||
| #string contains check | ||
| if [[ ${connected_devices} != *${array_device}* ]]; then | ||
| echo "Connecting to: ${array_device}" | ||
| adb connect ${array_device} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should we check the exit code here to make sure the connection was really successful?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, we don't care. Anyway script will be run again after specified delay. |
||
| echo "Success!" | ||
| fi | ||
| done | ||
| #Give time to finish connection | ||
| sleep 1 | ||
| fi | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wouldn't it be more appropriate to user grep for this purpose?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
basically it is the same thing