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
/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