Linux bluetooth development
 help / color / mirror / Atom feed
From: Roland Schober <rolandschober1968@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: luiz.dentz@gmail.com, Roland Schober <rolandschober1968@gmail.com>
Subject: [RFC PATCH BlueZ v2 0/9] Periodic advertising and PAwR over MGMT
Date: Wed,  2 Dec 2026 13:52:32 +0100	[thread overview]
Message-ID: <20261202125241.348452-1-rolandschober1968@gmail.com> (raw)

This is the user space side of the kernel RFC
"[RFC PATCH 0/5] Bluetooth: Periodic advertising and PAwR over MGMT":
a MGMT interface for periodic advertising and for the advertiser side
of Periodic Advertising with Responses (PAwR), with emulator support
and tests. The kernel series is unchanged, the interface is the one
of v1.

Patch 1 documents the three commands and two events in
doc/mgmt-protocol.rst; it is the place to comment on the interface.
Patch 2 adds the definitions, patch 3 the btmon decoding.

Patch 4 fixes the length which btmgmt takes of a byte array with empty
entries, which the new commands use. Patch 5 adds three btmgmt
commands: pa-params sends Add Periodic Advertising Parameters, pa-data
sends Add Periodic Advertising Data, pawr-serve answers the subevent
data requests and prints the response reports.

Plain periodic advertising:

  btmgmt add-ext-adv-params -P 1M 1
  btmgmt pa-params 1 0x50 0x50
  btmgmt pa-data 1 0x05 0xff 0x59 0x00 0x01 0x02
  btmgmt add-ext-adv-data 1

A PAwR train with 5 subevents of 5 response slots:

  btmgmt add-ext-adv-params -P 1M 1
  btmgmt pa-params 1 0xff 0xff 5 0x30 8 0x50 5
  btmgmt pawr-serve 1 5 5 &
  btmgmt add-ext-adv-data 1

Patches 6 to 8 are the emulator:

 - Patch 6 adds the PAwR HCI definitions to bt.h. They are the ones of
   my btmon series "monitor: Decode Periodic Advertising with
   Responses", which is not applied yet; the patch is dropped here
   when that series is in.
 - Patch 7 makes the emulator refuse to remove an advertising set
   while periodic advertising is enabled on it, as a controller does.
   The kernel needs "Bluetooth: hci_sync: Disable PA before removing
   an advertising set" for this, which is part of the kernel RFC and
   which I also sent on its own. Without it the broadcast cases of
   test/functional/test_bap.py fail, as the CI run of v1 showed.
 - Patch 8 adds the PAwR advertiser to controllers of version 6.0 and
   later: the parameters [v2], the subevent data requests once per
   periodic advertising interval, and the subevent data command, which
   refuses data that was not asked for. Nothing is transmitted: the
   responder side and the response reports are not emulated yet.

Patch 9 adds 32 mgmt-tester cases. They need the kernel series; on a
kernel without it they fail.

Also tested with the kernel RFC in QEMU against the Nordic SoftDevice
Controller on a simulated nRF52 (BabbleSim), with Zephyr's
periodic_sync_rsp sample as the responder. That run covers what the
emulator does not: a synchronised responder and its response reports.

The D-Bus API is not part of this RFC; it follows when the MGMT
interface is agreed. For PAwR I expect bluetoothd to keep the data of
each subevent and to answer the data requests itself, since a D-Bus
round trip per request does not fit the controller's lead time.

v2:
 - btmgmt pawr-serve: do not write beyond the command buffer, send
   data which does not fit one command in several, check the arguments
   before the running configuration is changed, and replace an earlier
   pawr-serve instead of answering twice. Copilot found these four.
 - btmgmt: refuse numbers out of range, take the data from all
   remaining arguments, size the buffer which prints a response for
   the largest data length. Add patch 4 and the commands to
   doc/bluetoothctl-mgmt.rst.
 - Emulator: a refused LE Set Periodic Advertising Enable leaves the
   train as it is (Copilot). Check the response slot spacing against
   the subevent interval, refuse a command which names a subevent
   twice, and forget the subevents of a set which is removed.
 - Emulator: answer Command Disallowed for subevent data before the
   first request, for a second command for one subevent and for a
   subevent the train does not have, as the Core Specification lists
   it. v1 answered Too Early and Too Late, which are for data that
   misses its subevent in time; the patch with their definitions is
   dropped.
 - mgmt-tester: send the two commands of the "two commands" test
   without waiting for the first reply (Copilot), use a periodic
   advertising interval of 400 ms, which leaves time to answer, and
   add a case for a subevent the train does not have.
 - doc/mgmt-protocol.rst: a command takes the data of up to 15
   subevents.
 - The trace in the commit message of patch 3 is a complete excerpt.
 - Shorter subjects for patches 1, 3, 7 and 8.
 - Rebased.

Roland Schober (9):
  doc/mgmt: Add PA and PAwR commands and events
  lib/mgmt: Add periodic advertising and PAwR definitions
  monitor: Decode PA and PAwR MGMT commands and events
  client/mgmt: Fix length of byte arrays with empty entries
  client/mgmt: Add pa-params, pa-data and pawr-serve commands
  monitor: Add PAwR HCI definitions
  emulator/btdev: Keep advertising sets with PA enabled
  emulator/btdev: Add PAwR advertiser
  mgmt-tester: Add periodic advertising and PAwR tests

 client/mgmt.c             |  373 ++++++++++++-
 doc/bluetoothctl-mgmt.rst |   51 ++
 doc/mgmt-protocol.rst     |  208 ++++++++
 emulator/btdev.c          |  306 ++++++++++-
 lib/bluetooth/mgmt.h      |   74 +++
 monitor/bt.h              |  174 ++++++
 monitor/packet.c          |  204 +++++++
 tools/mgmt-tester.c       | 1068 +++++++++++++++++++++++++++++++++++++
 8 files changed, 2453 insertions(+), 5 deletions(-)


base-commit: eecfd959cf5ae9a24ee007975439747779804be1
-- 
2.47.3


             reply	other threads:[~2026-12-02 12:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 12:52 Roland Schober [this message]
2026-12-02 12:52 ` [RFC PATCH BlueZ v2 1/9] doc/mgmt: Add PA and PAwR commands and events Roland Schober
2026-12-02 12:52 ` [RFC PATCH BlueZ v2 2/9] lib/mgmt: Add periodic advertising and PAwR definitions Roland Schober
2026-12-02 12:52 ` [RFC PATCH BlueZ v2 3/9] monitor: Decode PA and PAwR MGMT commands and events Roland Schober
2026-12-02 12:52 ` [RFC PATCH BlueZ v2 4/9] client/mgmt: Fix length of byte arrays with empty entries Roland Schober
2026-12-02 12:52 ` [RFC PATCH BlueZ v2 5/9] client/mgmt: Add pa-params, pa-data and pawr-serve commands Roland Schober
2026-12-02 12:52 ` [RFC PATCH BlueZ v2 6/9] monitor: Add PAwR HCI definitions Roland Schober
2026-12-02 12:52 ` [RFC PATCH BlueZ v2 7/9] emulator/btdev: Keep advertising sets with PA enabled Roland Schober
2026-12-02 12:52 ` [RFC PATCH BlueZ v2 8/9] emulator/btdev: Add PAwR advertiser Roland Schober
2026-12-02 12:52 ` [RFC PATCH BlueZ v2 9/9] mgmt-tester: Add periodic advertising and PAwR tests Roland Schober

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261202125241.348452-1-rolandschober1968@gmail.com \
    --to=rolandschober1968@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox