From 7c34990c01083805f4df06e928ce9a06ae644e49 Mon Sep 17 00:00:00 2001 From: Arturo Buzarra Date: Tue, 20 Feb 2018 14:25:57 +0100 Subject: [PATCH] bluetooth-init: verify if BT firmware was loaded successfully Rarely the bluetooth firmware is not loaded properly and causes errors in the configuration steps. This verification makes sure the firmware was loaded and is functional, if not we start the retry mechanism with the default baudrate to avoid the firmware corruption in the upload process. https://jira.digi.com/browse/DEL-3711 Signed-off-by: Arturo Buzarra --- .../bluez/bluez5-5.41/ccimx6ul/bluetooth-init | 10 +++++++++- .../bluez/bluez5-5.46/ccimx6ul/bluetooth-init | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/bluetooth-init b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/bluetooth-init index 9e81c2b73..47c6bb40f 100644 --- a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/bluetooth-init +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/bluetooth-init @@ -73,9 +73,17 @@ bluetooth_init() { killproc hciattach powercycle_gpio "${BT_EN_QCA_GPIO_NR}" if hciattach ttyBt qca ${BT_RATE:-3000000} -t30 ${BT_FLOW:-flow} unused ${BT_MACADDR} >${HCIATTACH_LOG} 2>&1; then - return + # hciattach performs a reset to load the new firmware and needs some time to be ready + sleep 1 + # Verify if firmware was loaded successfully + bdaddr >/dev/null 2>&1 && return fi sleep 1 + + if [ $RETRY -ge 3 ]; then + # Retry at default firmware baudrate + BT_RATE="115200" + fi done BT_ERROR="FAIL (hciattach)" } diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.46/ccimx6ul/bluetooth-init b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.46/ccimx6ul/bluetooth-init index 9e81c2b73..47c6bb40f 100644 --- a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.46/ccimx6ul/bluetooth-init +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.46/ccimx6ul/bluetooth-init @@ -73,9 +73,17 @@ bluetooth_init() { killproc hciattach powercycle_gpio "${BT_EN_QCA_GPIO_NR}" if hciattach ttyBt qca ${BT_RATE:-3000000} -t30 ${BT_FLOW:-flow} unused ${BT_MACADDR} >${HCIATTACH_LOG} 2>&1; then - return + # hciattach performs a reset to load the new firmware and needs some time to be ready + sleep 1 + # Verify if firmware was loaded successfully + bdaddr >/dev/null 2>&1 && return fi sleep 1 + + if [ $RETRY -ge 3 ]; then + # Retry at default firmware baudrate + BT_RATE="115200" + fi done BT_ERROR="FAIL (hciattach)" }