firmware-murata-infineon: add a retry to init script
The BT interface initialization is occasionally failing with the hci0 interface not being fully up. Adding the retry solves all those initialization failures. https://onedigi.atlassian.net/browse/DEL-9287 Signed-off-by: Isaac Hermida <isaac.hermida@digi.com>
This commit is contained in:
parent
2f5ccac0c6
commit
6ac00bf590
|
|
@ -14,7 +14,7 @@
|
|||
#===============================================================================
|
||||
|
||||
SCRIPTNAME="$(basename ${0})"
|
||||
export MBT_TRANSPORT=/dev/ttySTM1
|
||||
RETRIES=3
|
||||
|
||||
log() {
|
||||
if type "systemd-cat" >/dev/null 2>/dev/null; then
|
||||
|
|
@ -30,21 +30,27 @@ bt_power() {
|
|||
}
|
||||
|
||||
bt_init() {
|
||||
bt_power 0
|
||||
sleep 0.5
|
||||
bt_power 1
|
||||
# Load Bluetooth firmware on device
|
||||
mbt download /lib/firmware/brcm/CYW55500A1.hcd
|
||||
# Attach serial UART to the Bluetooth stack
|
||||
btattach -B /dev/ttySTM1 -P bcm -S 921600 &
|
||||
sleep 2
|
||||
for i in $(seq ${RETRIES}); do
|
||||
# Perform a power cycle
|
||||
bt_power 0
|
||||
sleep 0.5
|
||||
bt_power 1
|
||||
|
||||
# Up the interface to be able to send hci commands
|
||||
if ! hciconfig hci0 up; then
|
||||
log err "FAILED (hci0 up)"
|
||||
exit
|
||||
fi
|
||||
log info "OK"
|
||||
# Load Bluetooth firmware on device
|
||||
if MBT_TRANSPORT=/dev/ttySTM1 timeout 10 mbt download /lib/firmware/brcm/CYW55500A1.hcd; then
|
||||
# Attach serial UART to the Bluetooth stack
|
||||
btattach -B /dev/ttySTM1 -P bcm -S 921600 &
|
||||
sleep 2
|
||||
|
||||
# Up the interface to be able to send hci commands
|
||||
hciconfig hci0 up && log info "OK" && return 0
|
||||
fi
|
||||
log err "FAILED to bring hci0 up, retrying..."
|
||||
killall btattach 2> /dev/null
|
||||
done
|
||||
|
||||
log err "FAILED (hci0 up)"
|
||||
return 1
|
||||
}
|
||||
|
||||
bt_stop() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue