Repository navigation
Expand file tree
/
Copy pathCheckUSB.sh
More file actions
58 lines (56 loc) · 1.63 KB
/
Copy pathCheckUSB.sh
File metadata and controls
58 lines (56 loc) · 1.63 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
50
51
52
53
54
55
56
57
58
#!/bin/bash
pause() {
read -n 1 -p "$*" INP
if [ $INP! = '' ];
then echo -ne '\b \n'
fi
}
WAIT_TIME=3
echo "=================================================="
echo "=============== Check devices status ============="
echo
echo | adb devices | grep off
sig1=$?
echo | adb devices | grep permissions
sig2=$?
if [[ $sig1 -eq 0 ]] || [[ $sig2 -eq 0 ]];then
echo "====== Bellow device(s) is NOT_CONNECTED!!! ======"
echo | adb devices | awk '$2~/off/{print $1}'
echo | adb devices | awk '$3~/permissions/{print $1}'
echo | adb devices | awk '$2~/off/{print $1}' > ./OFFLINE
echo | adb devices | awk '$3~/permissions/{print $1}' >>./OFFLINE
echo
echo "============= Auto Reconnect USB ================"
sleep 3
for DUT in $(cat OFFLINE);do
bash RESET_DUT.sh $DUT &
done
sleep 3
echo "=============== Check devices status ============="
echo
adb devices
echo | adb devices | grep off
sig3=$?
echo | adb devices | grep permissions
sig4=$?
if [[ $sig3 -eq 0 ]] || [[ $sig4 -eq 0 ]];then
echo "========== Please Check DUT Manually =============" > mail.txt
echo | adb devices | awk '$2~/off/{print $1}' >> mail.txt
echo | adb devices | awk '$3~/permissions/{print $1}' >> mail.txt
echo "============== Wait for 6 minutes ================"
sleep 120
adb devices
echo "============== Wait for 4 minutes ================"
sleep 120
adb devices
echo "============== Wait for 2 minutes ================"
sleep 120
adb devices
echo "======= offline device will be excluded ! ======="
else
echo "=========== Devices USB status are Ok ============"
fi
else
echo "=========== Devices USB status are Ok ============"
fi
exit 0