-
Notifications
You must be signed in to change notification settings - Fork 3
/
wifiAdb
executable file
·44 lines (40 loc) · 1.54 KB
/
wifiAdb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/system/bin/sh
OPTIONS=("Start adb over wifi on default port 5555" "provide the port" "Stop adb over wifi" "Do nothing");
IP=$(ip addr | grep 'inet 192' | awk '{print $2}' |awk '{print $1}' | grep -o '192.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}');
PORT=5555;
select opt in "${OPTIONS[@]}"; do
if [ "$opt" = "Start adb over wifi on default port 5555" ]; then
`setprop service.adb.tcp.port $PORT`;
stop adbd;
start adbd;
if [ $? = 0 ]; then
echo "adb over WiFi has been started";
echo "run 'adb connect $IP' to connect adb via WiFi ";
echo "and run 'adb devices' to check your device";
else
echo "Something went wrong try again with valid value"
fi
break;
elif [ "$opt" = "provide the port" ]; then
echo "enter the port usually over 1000";
read PORT
`setprop service.adb.tcp.port $PORT`;
stop adbd;
start adbd;
if [ $? = 0 ]; then
echo "adb over WiFi has been started";
echo "run 'adb connect $IP:$PORT' to connect adb via WiFi ";
echo "and run 'adb devices' to check your device";
else
echo "Something went wrong try again with valid value"
fi
break;
elif [ "$opt" = "Stop adb over wifi" ]; then
stop adbd
echo "adb over WiFi stopped";
break;
else
echo "Nothing is Done";
break;
fi
done