Repository navigation
Expand file tree
/
Copy pathRESET_DUT.sh
More file actions
49 lines (40 loc) · 1.41 KB
/
Copy pathRESET_DUT.sh
File metadata and controls
49 lines (40 loc) · 1.41 KB
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
49
#!/bin/bash
pcpwd=123
set -euo pipefail
IFS=$'\n\t'
DUTSN=$1
WAIT_TIME=$2
#VENDOR=$1
#PRODUCT=$2
for DIR in $(find /sys/bus/usb/devices/ -maxdepth 3 -type l); do
if [[ -f $DIR/idVendor && -f $DIR/idProduct && -f $DIR/serial && $(cat $DIR/serial) == $DUTSN && $(cat $DIR/authorized) == 0 ]]; then
echo " ===== Recoonect device : $DUTSN ===== "
echo $pcpwd | sudo -S sh -c "echo 1 > $DIR/authorized"
sleep 0.5
fi
done
echo " ===== 1.screen off timeout ===== "
adb -s $DUTSN shell settings put system screen_off_timeout 600000
echo " ===== 2.stay awake ===== "
adb -s $DUTSN shell settings put global stay_on_while_plugged_in 7
echo " ===== 3.disable package verifier enable ===== "
adb -s $DUTSN shell settings put global package_verifier_enable 0
for DIR in $(find /sys/bus/usb/devices/ -maxdepth 3 -type l); do
if [[ -f $DIR/idVendor && -f $DIR/idProduct && -f $DIR/serial && $(cat $DIR/serial) == $DUTSN ]]; then
echo " ===== Discoonect device : $DUTSN ===== "
echo $pcpwd | sudo -S sh -c "echo 0 > $DIR/authorized"
sleep 0.5
fi
done
adb devices
sleep $WAIT_TIME
for DIR in $(find /sys/bus/usb/devices/ -maxdepth 3 -type l); do
if [[ -f $DIR/idVendor && -f $DIR/idProduct && -f $DIR/serial && $(cat $DIR/serial) == $DUTSN ]]; then
echo " ===== Recoonect device : $DUTSN ===== "
echo $pcpwd | sudo -S sh -c "echo 1 > $DIR/authorized"
sleep 0.5
fi
done
sleep 1
adb devices
exit 0