Add cp2-downloader execution logic in script
[platform/adaptation/bluetooth-firmware-sprd.git] / scripts / bt-dev-start-TM1.sh
index e5c7b76..3599561 100644 (file)
@@ -16,6 +16,17 @@ if (${HCI_CONFIG} | grep hci); then
        exit 0
 fi
 
+LS_TMP='/bin/ls -al /tmp/'
+WIFI_FIRMWARE_LOADED='wifi-firmware-loaded'
+BT_FIRMWARE_LOADED='bt-firmware-loaded'
+if !(${LS_TMP} | grep ${WIFI_FIRMWARE_LOADED}); then
+       if !(${LS_TMP} | grep ${BT_FIRMWARE_LOADED}); then
+               echo "Executing cp2-downloader"
+               /hal/bin/cp2-downloader
+               /bin/touch /tmp/.bt-firmware-loaded
+       fi
+fi
+
 /usr/sbin/rfkill unblock bluetooth
 
 echo "Bluetooth device is DOWN"