rc: bluetooth: startup improvements

During startup hccontrol reset needs to be run multiple times
for iwbt to work more reliably.  Add a loop trying up to
three times.

Tested by:	various (original version; I changed test to -eq)
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D44861
This commit is contained in:
Stephen Hurd 2025-08-29 20:01:58 +00:00 committed by Bjoern A. Zeeb
parent 9e8c1ab097
commit 40652f86b5

View file

@ -127,8 +127,17 @@ bluetooth_setup_stack()
> /dev/null 2>&1 || return 1
# Initilalize HCI node
${hccontrol} -n ${dev}hci reset \
> /dev/null 2>&1 || return 1
for loop in 1 2 3
do
${hccontrol} -n ${dev}hci reset \
> /dev/null 2>1 && break
if [ ${loop} -eq 3 ]
then
warn Reset failed three times, giving up.
return 1
fi
warn Reset failed, retrying.
done
${hccontrol} -n ${dev}hci read_bd_addr \
> /dev/null 2>&1 || return 1