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 7/9] emulator/btdev: Keep advertising sets with periodic advertising
Date: Fri, 27 Nov 2026 09:55:23 +0100	[thread overview]
Message-ID: <20261127085525.264299-8-rolandschober1968@gmail.com> (raw)
In-Reply-To: <20261127085525.264299-1-rolandschober1968@gmail.com>

LE Remove Advertising Set and LE Clear Advertising Sets are answered
with Command Disallowed while periodic advertising is enabled on the
set, as the specification says. A reset disables periodic advertising.

Assisted-by: Claude:claude-fable-5-2
---
 emulator/btdev.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/emulator/btdev.c b/emulator/btdev.c
index 1140acd90..c4ade031e 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -266,6 +266,7 @@ struct btdev {
 	uint16_t le_pa_max_interval;
 	uint8_t  le_pa_data_len;
 	uint8_t  le_pa_data[MAX_PA_DATA_LEN];
+	uint8_t  le_pa_handle;
 	uint8_t  le_ltk[16];
 	uint8_t  hdt_def_mic_len;
 	uint8_t  hdt_def_format;
@@ -693,6 +694,8 @@ static void btdev_reset(struct btdev *btdev)
 		btdev->inquiry_id = 0;
 	}
 
+	btdev->le_pa_enable = 0x00;
+
 	queue_remove_all(btdev->conns, NULL, NULL, conn_remove);
 	queue_remove_all(btdev->le_ext_adv, NULL, NULL, le_ext_adv_free);
 	queue_remove_all(btdev->le_per_adv, NULL, NULL, free);
@@ -5981,7 +5984,8 @@ static int cmd_remove_adv_set(struct btdev *dev, const void *data,
 		return 0;
 	}
 
-	if (ext_adv->enable) {
+	if (ext_adv->enable || (dev->le_pa_enable &&
+				dev->le_pa_handle == cmd->handle)) {
 		status = BT_HCI_ERR_COMMAND_DISALLOWED;
 		cmd_complete(dev, BT_HCI_CMD_LE_REMOVE_ADV_SET, &status,
 						sizeof(status));
@@ -6003,6 +6007,13 @@ static int cmd_clear_adv_sets(struct btdev *dev, const void *data,
 	const struct queue_entry *entry;
 	uint8_t status = BT_HCI_ERR_SUCCESS;
 
+	if (dev->le_pa_enable) {
+		status = BT_HCI_ERR_COMMAND_DISALLOWED;
+		cmd_complete(dev, BT_HCI_CMD_LE_CLEAR_ADV_SETS, &status,
+							sizeof(status));
+		return 0;
+	}
+
 	for (entry = queue_get_entries(dev->le_ext_adv); entry;
 							entry = entry->next) {
 		struct le_ext_adv *ext_adv = entry->data;
@@ -6036,6 +6047,7 @@ static int cmd_set_pa_params(struct btdev *dev, const void *data,
 		dev->le_pa_properties = le16_to_cpu(cmd->properties);
 		dev->le_pa_min_interval = cmd->min_interval;
 		dev->le_pa_max_interval = cmd->max_interval;
+		dev->le_pa_handle = cmd->handle;
 	}
 
 	cmd_complete(dev, BT_HCI_CMD_LE_SET_PA_PARAMS, &status,
-- 
2.47.3


  parent reply	other threads:[~2026-11-27  8:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27  8:55 [RFC PATCH BlueZ 0/9] Periodic advertising and PAwR over MGMT Roland Schober
2026-11-27  8:55 ` [RFC PATCH BlueZ 1/9] doc/mgmt: Add periodic advertising and PAwR commands and events Roland Schober
2026-11-27  8:55 ` [RFC PATCH BlueZ 2/9] lib/mgmt: Add periodic advertising and PAwR definitions Roland Schober
2026-11-27  8:55 ` [RFC PATCH BlueZ 3/9] monitor: Decode periodic advertising and PAwR MGMT commands and events Roland Schober
2026-11-27  8:55 ` [RFC PATCH BlueZ 4/9] client/mgmt: Add pa-params, pa-data and pawr-serve commands Roland Schober
2026-11-27  8:55 ` [RFC PATCH BlueZ 5/9] monitor: Add PAwR HCI definitions Roland Schober
2026-11-27  8:55 ` [RFC PATCH BlueZ 6/9] monitor: Add Too Late and Too Early error code definitions Roland Schober
2026-11-27  8:55 ` Roland Schober [this message]
2026-11-27  8:55 ` [RFC PATCH BlueZ 8/9] emulator/btdev: Add Periodic Advertising with Responses advertiser Roland Schober
2026-11-27  8:55 ` [RFC PATCH BlueZ 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=20261127085525.264299-8-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