The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=40652f86b5ef17c9016a5eaf4bc89b2f324540e8
commit 40652f86b5ef17c9016a5eaf4bc89b2f324540e8 Author: Stephen Hurd <sh...@freebsd.org> AuthorDate: 2025-08-29 20:01:58 +0000 Commit: Bjoern A. Zeeb <b...@freebsd.org> CommitDate: 2025-08-29 20:45:23 +0000 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 --- libexec/rc/rc.d/bluetooth | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/libexec/rc/rc.d/bluetooth b/libexec/rc/rc.d/bluetooth index 22bd5078034d..239944c73dd6 100755 --- a/libexec/rc/rc.d/bluetooth +++ b/libexec/rc/rc.d/bluetooth @@ -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