-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathandroid-control
executable file
·48 lines (38 loc) · 1.49 KB
/
android-control
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
45
46
47
48
#!/usr/bin/sh
# USB setup:
# * enable Developer options: Settings → About phone → tab Build number 7 times
# * enable USB debugging in Settings → Developer options
# * test with `adb devices` and `adb shell`
# * computer must be authorized (Android device should ask on first connection, and periodically if timeout isn't disabled)
# TCP setup:
# * enable Wireless debugging in Settings → Developer options (or temporarily with `adb tcpip 5555`)
# * click on Wireless debugging to check paired devices (can be done with `adb pair ipaddr:port`)
# * (set on device with termux with `su` then `setprop service.adb.tcp.port 5555`)
# * check with `adb shell getprop service.adb.tcp.port`
# * test with `adb connect ipaddr:5555`, `adb devices`, and `adb shell`
# restart server: adb kill-server
if [[ $# -eq 0 ]] ; then
adb devices -l # show connected devices
fi
case "$1" in
phone-usb)
# scrcpy --serial "S7M0215425009907" # Huawei Ascend P8
# scrcpy --serial "0B051JECB14301" # Google Pixel 4a
scrcpy --serial "26141JEGR01921" # Google Pixel 6a
;;
phone)
DEVICE="192.168.0.17:5555"
adb connect "$DEVICE"
scrcpy --serial "$DEVICE"
adb disconnect "$DEVICE" # let somebody else connect
;;
tv)
DEVICE="192.168.0.14:5555"
adb connect "$DEVICE"
scrcpy --serial "$DEVICE"
adb disconnect "$DEVICE" # let somebody else connect
;;
*)
echo "Unknown device: $1"
exit 1
esac