The branch stable/14 has been updated by bz:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=53d1c328e9123c8065f121afdd9dccb222af2221

commit 53d1c328e9123c8065f121afdd9dccb222af2221
Author:     Stephen Hurd <[email protected]>
AuthorDate: 2025-08-29 20:01:58 +0000
Commit:     Bjoern A. Zeeb <[email protected]>
CommitDate: 2026-01-16 19:37:46 +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)
    Differential Revision: https://reviews.freebsd.org/D44861
    
    Fix a redirect of stderr to stdout which is going to /dev/null.
    A '&' got missing in the original rewrite from the review that
    I took and committed.  Seems no one had noticed during testing
    or review.  People may have ended up with a "/1" file in their
    root file system.
    
    Fixes:          40652f86b5ef
    Reported by:    Vladyslav Movchan (vladislav.movchan gmail.com)
    
    (cherry picked from commit 40652f86b5ef17c9016a5eaf4bc89b2f324540e8)
    (cherry picked from commit 78807c196c9481cdd88b5ce611b488903f52fbd0)
---
 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 679d669a6191..2903057b8bfb 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

Reply via email to