Skip to content

Commit 265a56b

Browse files
committed
add connect
0 parents commit 265a56b

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

connect.sh

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/bin/bash
2+
3+
# adb connect fast helper
4+
5+
# example of usage:
6+
7+
# ./connect.sh 5
8+
# will run -> adb connect 10.10.21.46:2111
9+
10+
# ./connect.sh -r
11+
# will run -> adb kill-server
12+
13+
# ./connect.sh -r 5
14+
# will run -> adb kill-server $$ adb connect 10.10.21.46:2111
15+
16+
# url, port, mode{your_device_name}addr must be specified for devices
17+
18+
url=10.10.21
19+
port=2111
20+
21+
mode5addr=84
22+
mode72addr=88
23+
mode73addr=89
24+
mode10addr=47
25+
26+
terminal_mode=0
27+
condition="_"
28+
29+
args=("$@")
30+
args_count=${#args[@]}
31+
32+
connect_to () {
33+
adb connect ${url}.$1:${port}
34+
}
35+
36+
if [[ args_count -eq 2 ]]
37+
then terminal_mode=$2
38+
if [[ $1 -eq "-r" ]]
39+
then adb kill-server
40+
fi
41+
else terminal_mode=$1
42+
fi
43+
44+
case $terminal_mode in
45+
5) connect_to $mode5addr
46+
;;
47+
10) connect_to $mode10addr
48+
;;
49+
72) connect_to $mode72addr
50+
;;
51+
73) connect_to $mode73addr
52+
;;
53+
-r) adb kill-server
54+
;;
55+
*) echo found no devices with such address
56+
esac

0 commit comments

Comments
 (0)