Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH BlueZ 0/2] Single advertising set in the emulator and mgmt-tester
@ 2026-11-12  2:38 Weihong Guan
  2026-11-12  2:38 ` [PATCH BlueZ 1/2] emulator: Set the number of advertising sets Weihong Guan
  2026-11-12  2:38 ` [PATCH BlueZ 2/2] mgmt-tester: Add single advertising set tests Weihong Guan
  0 siblings, 2 replies; 4+ messages in thread
From: Weihong Guan @ 2026-11-12  2:38 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Luiz Augusto von Dentz, Weihong Guan

A controller may report a single advertising set (LE Read Number of
Supported Advertising Sets returns 0x01 to 0xF0). The kernel then gives
advertising instance 1 handle 0x00, the handle Global Advertising uses
too, and several places took the instance number for the handle. Those
were fixed in bluetooth-next by commits daf949c968d4, e7e877bf658a,
8b1eff978e66 and 4dce35adafb5, but the emulator always reports three
sets, so mgmt-tester couldn't see them.

Patch 1 lets a test set the emulated controller's number of sets
(btdev_set_adv_sets(), hciemu_set_central_le_adv_sets()), kept across
HCI_Reset; the default stays at three. Patch 2 adds three mgmt-tester
cases on one set: the random address, the controller ending a timed
instance, and the removal, each on handle 0x00.

How it was tested: on a Raspberry Pi 5 running 7.4-rc2 with
net/bluetooth from bluetooth-next.

 - With the four kernel commits: the three new cases pass.
 - Without them (bluetooth-next at def8a484b): all three fail. The
   first shows the bug, LE Set Advertising Set Random Address for handle
   0x01; the other two fail when adding the instance, for the same
   reason.
 - The whole of mgmt-tester with and without these patches on the same
   kernel: the same tests fail on that machine either way (Read Ext
   Controller Info and some LL Privacy cases, and a few that pass or
   fail from run to run), so nothing changed for the existing ones.

The bugs were first found on real hardware: a WCH CH582 running an open
controller firmware of ours that reports one advertising set, driven
from btmgmt and checked with btmon. These cases let anyone repeat them
without it.

Weihong Guan (2):
  emulator: Set the number of advertising sets
  mgmt-tester: Add single advertising set tests

 emulator/btdev.c    | 18 ++++++++--
 emulator/btdev.h    |  2 ++
 emulator/hciemu.c   | 14 ++++++++
 emulator/hciemu.h   |  2 ++
 tools/mgmt-tester.c | 87 +++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 121 insertions(+), 2 deletions(-)

-- 
2.47.3


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

end of thread, other threads:[~2026-11-12  9:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-12  2:38 [PATCH BlueZ 0/2] Single advertising set in the emulator and mgmt-tester Weihong Guan
2026-11-12  2:38 ` [PATCH BlueZ 1/2] emulator: Set the number of advertising sets Weihong Guan
2026-11-12  9:14   ` Single advertising set in the emulator and mgmt-tester bluez.test.bot
2026-11-12  2:38 ` [PATCH BlueZ 2/2] mgmt-tester: Add single advertising set tests Weihong Guan

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