* [PATCH BlueZ] adapter: Load defaults before probing drivers
@ 2026-11-30 17:09 Andrea Daoud
0 siblings, 0 replies; only message in thread
From: Andrea Daoud @ 2026-11-30 17:09 UTC (permalink / raw)
To: linux-bluetooth
With AutoEnable=true, the first automatic power-on can ignore the
PageScanInterval set in main.conf. The controller starts listening for
BR/EDR connections at its previous interval. The configured interval
takes effect only on the next power-on. The reason is that the policy
driver's probe can queue Set Powered before adapter registration
queues Set Default System Configuration. Linux therefore
programs the controller before it receives the configured interval.
Queue the defaults before probing adapter drivers so the first automatic
power-on uses the configured parameters.
---
Explanations:
During adapter registration, load_drivers() probes the policy plugin.
With AutoEnable enabled and the adapter off, policy_adapter_probe() calls
btd_adapter_restore_powered(), which queues Set Powered (0x0005).
Registration then calls load_defaults(), which queues Set Default System
Configuration (0x004c).
At power-on, Linux programs the controller with the page scan values
currently stored in hci_dev. The later Set Default System Configuration
command updates hci_dev, so the controller picks up the new values only on
the next power-on.
To reproduce this issue, use a BR/EDR adapter that supports interlaced page scan.
Leave fast connectable mode disabled so Linux uses the configured page
scan type and interval. Set the following in /etc/bluetooth/main.conf:
[Policy]
AutoEnable=true
[BR]
PageScanType=1
PageScanInterval=1024
PageScanWindow=36
Boot with the adapter present. Before toggling adapter power, read the
kernel defaults and the two controller registers:
bluetoothctl mgmt.read-sysconfig
bluetoothctl mgmt.hci-cmd 0x0c1b 0 2
bluetoothctl mgmt.hci-cmd 0x0c46 0 2
The management types 0x0000, 0x0001 and 0x0002 are page scan type,
interval and window. The HCI commands are Read Page Scan Activity and
Read Page Scan Type. Interval and window use 0.625 ms units.
## Hardware results
Tested on an Intel AX200 using the existing Linux BR/EDR page-scan
implementation.
Interval Window Type
BlueZ 5.87, first power-on 1280 ms 11.25 ms standard
BlueZ 5.87, after manual off/on 640 ms 22.5 ms interlaced
BlueZ 5.87 + patch, first power-on 640 ms 22.5 ms interlaced
On both boots, the kernel reported the configured values. On the first
power-on, the controller's activity/type replies changed from
"00 00 08 12 00" / "00 00" to "00 00 04 24 00" / "00 01" with the patch.
src/adapter.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/adapter.c b/src/adapter.c
index 112312651..1ec1c7039 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -10011,10 +10011,10 @@ load:
load_config(adapter);
fix_storage(adapter);
+ load_defaults(adapter);
load_drivers(adapter);
btd_profile_foreach(probe_profile, adapter);
clear_blocked(adapter);
- load_defaults(adapter);
load_devices(adapter);
/* restore Service Changed CCC value for bonded devices */
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-30 17:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-30 17:09 [PATCH BlueZ] adapter: Load defaults before probing drivers Andrea Daoud
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox