Replies: 1 comment 2 replies
|
@noisetta, that's a big improvement the only thing I can think of to help further is doing things asynchronously. that could help make the lag not really matter that much if it doesn't already do it async |
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
After investigating the Bluetooth lag issue that several of us have been experiencing, here are some findings:
It looks like the root cause is hardcoded sleep calls in /usr/bin/bt_init totalling 11 seconds of fixed delays:
sleep 5 after brcm_patchram_plus
sleep 1 after hciconfig up
sleep 1 after hciconfig reset
sleep 2 after bt-agent
sleep 1 after bluealsa
sleep 1 after sdptool
Replacing the fixed sleeps with condition-based waits (polling for hci0 in 100ms intervals) and reduced the remaining sleeps to 0.3–0.5s brings down the initialization time from ~11 seconds to ~7 seconds.
The remaining 7 seconds breaks down as:
~4 seconds — Broadcom BCM4343A1 firmware loading via brcm_patchram_plus — this is hardware limited and can't be reduced without modifying the firmware loader itself
~2 seconds — remaining necessary sleeps
~1 second — actual service startup
The optimized bt_init will most likely be included in the next firmware release. The 4 second hardware limit is likely the best we can achieve without deeper work on the Broadcom firmware loading process (@Tartarus6 , any ideas ?).
All reactions