Apply next HAL architecture
[platform/hal/backend/vim3/bluetooth-vim3.git] / scripts / bt-dev-end.sh
1 #!/bin/sh
2 PATH=/bin:/usr/bin:/sbin:/usr/sbin
3
4 GREP="/bin/grep"
5 HCI_CONFIG=/usr/bin/hciconfig
6
7 echo "Check for Bluetooth device status"
8 if (${HCI_CONFIG} | ${GREP} hci); then
9         echo "Bluetooth device is UP"
10         ${HCI_CONFIG} hci0 down
11 else
12         echo "Did not attach HCI"
13         exit 1
14 fi
15
16 TIMEOUT=20
17
18 for (( i=1; i<=$TIMEOUT; i++))
19 do
20         /bin/sleep 0.1
21
22         if [ $i -eq $TIMEOUT ]
23         then
24                 echo "time expired happen $i"
25                 exit 2
26         fi
27
28         if (${HCI_CONFIG} | ${GREP} DOWN); then
29                 echo "Bluetooth device is down"
30                 break
31         fi
32
33         echo "Continue...$i"
34 done
35 exit 0