forked from mdeff/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
android-control
executable file
·43 lines (33 loc) · 1.03 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
#!/usr/bin/sh
# setup:
# * adb debugging must be activated in device preferences (for USB and TCP)
# * computer must be authorized (Android device should ask on first connection)
# * TCP access must be enabled
# * check with `adb shell getprop service.adb.tcp.port`
# * set with `adb shell setprop service.adb.tcp.port 5555` (or `adb tcpip 5555`?)
# * set on device with termux with `su` then `setprop service.adb.tcp.port 5555`
# 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
;;
phone)
DEVICE="192.168.0.12:5555"
adb connect "$DEVICE"
scrcpy --bit-rate 2M --max-size 800 --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