Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH BlueZ] adapter: Load defaults before probing drivers
@ 2026-11-30 17:09 Andrea Daoud
  2026-11-30 23:56 ` [BlueZ] " bluez.test.bot
  2026-12-01 16:20 ` [PATCH BlueZ] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 3+ messages 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] 3+ messages in thread

* RE: [BlueZ] adapter: Load defaults before probing drivers
  2026-11-30 17:09 [PATCH BlueZ] adapter: Load defaults before probing drivers Andrea Daoud
@ 2026-11-30 23:56 ` bluez.test.bot
  2026-12-01 16:20 ` [PATCH BlueZ] " patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2026-11-30 23:56 UTC (permalink / raw)
  To: linux-bluetooth, andreadaoud6

[-- Attachment #1: Type: text/plain, Size: 1233 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/series/1227150/

---Test result---

Test Summary:
CheckPatch                    PASS      0.48 seconds
GitLint                       FAIL      0.34 seconds
BuildEll                      PASS      20.89 seconds
BluezMake                     PASS      314.34 seconds
CheckSmatch                   PASS      322.77 seconds
bluezmakeextell               PASS      102.55 seconds
TestFunctional                PASS      1249.85 seconds
IncrementalBuild              PASS      317.64 seconds
ScanBuild                     PASS      1211.94 seconds

Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[BlueZ] adapter: Load defaults before probing drivers

6: B2 Line has trailing whitespace: "takes effect only on the next power-on. The reason is that the policy "
27: B1 Line exceeds max length (81>80): "To reproduce this issue, use a BR/EDR adapter that supports interlaced page scan."


https://github.com/bluez/bluez/pull/2950

---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH BlueZ] adapter: Load defaults before probing drivers
  2026-11-30 17:09 [PATCH BlueZ] adapter: Load defaults before probing drivers Andrea Daoud
  2026-11-30 23:56 ` [BlueZ] " bluez.test.bot
@ 2026-12-01 16:20 ` patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2026-12-01 16:20 UTC (permalink / raw)
  To: Andrea Daoud; +Cc: linux-bluetooth

Hello:

This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Mon, 30 Nov 2026 18:09:35 +0100 you wrote:
> 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.
> 
> [...]

Here is the summary with links:
  - [BlueZ] adapter: Load defaults before probing drivers
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=622bd0805ee8

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-12-01 16:20 UTC | newest]

Thread overview: 3+ messages (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
2026-11-30 23:56 ` [BlueZ] " bluez.test.bot
2026-12-01 16:20 ` [PATCH BlueZ] " patchwork-bot+bluetooth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox