From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.41 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796215977; b=IF6QzzB2xFI7kzurM90CA/Dj8cfNKEFa5WogskABUqF6oPidPXfbvyXJLszXNStbCSYl Mc0Uz0y8DLcOtaQvtoLf0DjbfLWes1YwH3JrunNStc2UkUkD2ToLBhKGP3f8P3bGnFqt8 b39ShuJCEMQ22iPXgpzYGK7ZC2JQ648LdFbrjBVG1gJOz+mZUXdhxcBeETTy20zLLSYad WB+KwANDS1yn+hvRa6YqC1wuGubzodkB2DO0cXg4f74aG48kYm/k6zBp44X4/rvnb00HJ riF4UiVEfBESNwbNQ7ttoP+9fQXb8bkP1p6E7CqTnmcruDKCHKV/4mZgrEBGTM8WNrg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796215977; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject: Date:Message-ID:X-Mailer:MIME-Version:Content-Transfer-Encoding; bh=1vpQ2effqww5z8N5FLvZTrlXtYFGfYqJePG8d1VHS90=; b=wFmrBhRxnNcN8gU9kb1827bWAniyOd8RaMiHrW6RjnQ5b+hWdP4VVs59Pm2e7TCaNrRW fEwjYdWaipc7kdyumxUzlhSjMgcFCwCdkG6dRst4ZkTAYPN5D9MreIOCPUwLBsHBqBwaj ftb9k2pBget1akuW+JjjSSUe19JX3OdlXib2Tv31Mz8EXCbjAOqNgZD8uTBNQA7G2Vg+9 8KDvrkmyQSZXDADQQB9FBmF/hqunGUu8EupQ5chZ4oJofHCy+q5tf/nmuRGX6g+1j6e96 HN9Q9CCjDT89RQvuYRdTPyKLFoBmmvNKRDE93HKE+WaZGvBfcWmfQ6aV1RN4y9b80Hg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=0HG5+akS; arc=none smtp.remote-ip=209.85.128.41 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ED41F606A323 for ; Wed, 2 Dec 2026 12:52:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org ED41F606A323 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=0HG5+akS Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-4a5348aaba5so14919265e9.0 for ; Wed, 02 Dec 2026 04:52:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796215975; x=1796820775; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=1vpQ2effqww5z8N5FLvZTrlXtYFGfYqJePG8d1VHS90=; b=0HG5+akSCqBaOs87bo6TpPtR9BZnXU5aW+rhU2ZBizgmxH6y1eIe9LYLElg4ac0a9Q 5w9PaIBC+nkbYxOkeFp5Z7mxGscPsKY0L8I6/ppIfbkxwU4KbUbB0nQmhksqwjSMQ/Dd jJTdfBr6MgP+gFU2/SMW+nWQab1EwKBzeKwBLQeNCJiy/RQ/PHIbk8M09sMSEy8w1F33 CppU23iQgCEQefgEs83n2d+xDfjDS55TC3cI8aZbEs96q3PoBQhOOlaQBVbwO9hbYly5 0o+dAz16sfpMW6hyLkIgjdLGXqm6GQJo1mlSgLm45enG9anwcH6DY/hZdlMf1N9dxQpQ tn2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796215975; x=1796820775; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=1vpQ2effqww5z8N5FLvZTrlXtYFGfYqJePG8d1VHS90=; b=wtBK2Ti6QR5/RfXLTmmD4NzJ6dHUd2+yfkh9YP2OpcSaQw+Q7o2fjzSPRf+BYbWa8I +BnwGlm6CvTYIXIZflsBqCb7Csl10Ne35nrFnpY6rkgESdsLw7n0B+VLNmu2XNA/Q65Y OHTAVRNZTCE0gwgQCoikQdk4OqvKDdypDqT0BdbQV01zVfmgfuuMM5MAEhVmb3sGgHlr wfN+M6Fd5Lc4TlFlllrmKbaTUcU2MxIRcvwJ6yP7XInIRuhLcDnByzcHWthsDHVMv2MN TRGUt13X8xlYqGM9AYFwnH+E9Uiu61plJo+xZSVQUJGETrlbEozQfiOYd8tSvr1ZbNoE kq+w== X-Gm-Message-State: APuU4Z/8WlLGbT+fk6NxtaZUia/krQqA7fCsCTrqTROyBelxhq/lBTgW 6CeJPj2sVovoFVjs5oBPE45KFrqyrg5qFnoNtg6Q+dt8oXKI50lPRxMAFnWGwWg6 X-Gm-Gg: AZFdTZcAjM7lK8jmZVUdJKEmIhDuRaPYFMQc/Eh1yP4fO62K+WNstgBSQQz4+7NsBJJ pl5EVCNd20K4R3/fY0k2pxvhw7GbcCmEx5w0GTkG0AYBMjWtVGHfEe1O3raij7Q13TuEBE6dk0E c6UEWK+TshiNHiUh7NY7xHvHGQNx9khlsP7J8sqWIjXzLizqBHFo5C+l74jBW5BL6/vMhTUPGc8 jh4Vjajo9X1EOoFNuX7vBE0gaSZktEFinT8unqHxLRriTDAEDN+raSSWVqxYCVX7ueVATminI1p VSk8C0PH5AekvkYrrALS4QBJHJicWJeue+f58yYPyyYmsn+kvWVio1dDneBZPoPYpvacg48sGr7 LExccSpPRSJ6Bymn+HuRLoVJ7ooG4NKR7f1ZmIwow+2PRVI9FbsmlrUQ9Pdm9oqm/NJEemsZLyz EK1zMib/3eDr2XFPP6YdxT2Pxqo9bFq6kBOyeOyyCPW32Ny08t/oJfh3m7DklO7jSI+w0ve1RHW c26X95nMNl6wLs43AimhXxB+2mdmMkyeoy0lszK0dDj8+YIi97/5MUeKxvhDGKh8z6wf6zDniTW YeC/6FUo9YFr5SyOMAtuEQ1KNAGiiYt8Eto= X-Received: by 2002:a05:600c:5605:b0:4bb:b20d:bc4f with SMTP id 5b1f17b1804b1-4bbb20dbdaamr279436075e9.1.1796215975141; Wed, 02 Dec 2026 04:52:55 -0800 (PST) Received: from schinder.corp.hoffmann-group.com ([2003:8:2:4::5]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bbb97e5356sm441538475e9.4.2026.12.02.04.52.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2026 04:52:54 -0800 (PST) From: Roland Schober To: linux-bluetooth@vger.kernel.org Cc: luiz.dentz@gmail.com, Roland Schober Subject: [RFC PATCH BlueZ v2 0/9] Periodic advertising and PAwR over MGMT Date: Wed, 2 Dec 2026 13:52:32 +0100 Message-ID: <20261202125241.348452-1-rolandschober1968@gmail.com> X-Mailer: git-send-email 2.47.3 X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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