Apply hal macro and modify script
[platform/adaptation/bluetooth-firmware-sprd.git] / scripts / bt-dev-start-TM1.sh
index 1a7118c..e5c7b76 100644 (file)
@@ -13,7 +13,7 @@ echo "Check for Bluetooth device status"
 if (${HCI_CONFIG} | grep hci); then
        echo "Bluetooth device is UP"
        ${HCI_CONFIG} hci0 up
-       exit 1
+       exit 0
 fi
 
 /usr/sbin/rfkill unblock bluetooth
@@ -31,5 +31,29 @@ else
        /bin/cp /var/log/messages /var/lib/bluetooth/
 fi
 
-#/usr/sbin/hciconfig hci0 down
+echo "Check for Bluetooth device status"
+if (${HCI_CONFIG} | grep hci); then
+       echo "Bluetooth device is UP"
+       ${HCI_CONFIG} hci0 up
+else
+       echo "Did not attach HCI"
+       exit 1
+fi
 
+TIMEOUT=20
+for ((i=1; i<=$TIMEOUT; i++))
+do
+       /bin/sleep 0.1
+       if [ $i -eq $TIMEOUT ]
+       then
+               echo "time expired happen $i"
+               exit 2
+       fi
+       if (${HCI_CONFIG} | grep UP); then
+               echo "Bluetooth device is made"
+               break
+       fi
+       echo "Continue...$i"
+done
+
+exit 0