public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ v1 2/2] btdev: Fix advertisement state
Date: Fri, 26 Sep 2025 12:20:02 -0400	[thread overview]
Message-ID: <20250926162003.754423-2-luiz.dentz@gmail.com> (raw)
In-Reply-To: <20250926162003.754423-1-luiz.dentz@gmail.com>

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

The LE Advertisement state shall be updated whenever an advertisement
is disabled since if all advertisments sets are disabled it shall be
reflected in le_adv_enable.
---
 emulator/btdev.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/emulator/btdev.c b/emulator/btdev.c
index 67c932d53d59..1a0f9ef2de58 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -4789,9 +4789,17 @@ static bool match_ext_adv_handle(const void *data, const void *match_data)
 	return ext_adv->handle == handle;
 }
 
+static bool match_ext_adv_enable(const void *data, const void *match_data)
+{
+	const struct le_ext_adv *ext_adv = data;
+
+	return ext_adv->enable;
+}
+
 static void ext_adv_disable(void *data, void *user_data)
 {
 	struct le_ext_adv *ext_adv = data;
+	struct btdev *btdev = ext_adv->dev;
 	uint8_t handle = PTR_TO_UINT(user_data);
 
 	if (handle && ext_adv->handle != handle)
@@ -4807,6 +4815,13 @@ static void ext_adv_disable(void *data, void *user_data)
 	}
 
 	ext_adv->enable = 0x00;
+
+	/* Consider le_adv_enable disabled if all advertising sets are
+	 * disabled.
+	 */
+	ext_adv = queue_find(btdev->le_ext_adv, match_ext_adv_enable, NULL);
+	if (!ext_adv)
+		btdev->le_adv_enable = 0x00;
 }
 
 static bool ext_adv_is_connectable(struct le_ext_adv *ext_adv)
-- 
2.51.0


  reply	other threads:[~2025-09-26 16:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-26 16:20 [PATCH BlueZ v1 1/2] btdev: Fix handling of BT_HCI_CMD_LE_SET_RESOLV_ENABLE Luiz Augusto von Dentz
2025-09-26 16:20 ` Luiz Augusto von Dentz [this message]
2025-09-26 18:05 ` [BlueZ,v1,1/2] " bluez.test.bot
2025-09-29 13:40 ` [PATCH BlueZ v1 1/2] " patchwork-bot+bluetooth

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=20250926162003.754423-2-luiz.dentz@gmail.com \
    --to=luiz.dentz@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /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