Linux bluetooth development
 help / color / mirror / Atom feed
From: Simon Mikuda <simon.mikuda@streamunlimited.com>
To: linux-bluetooth@vger.kernel.org
Cc: Michal Dzik <michal.dzik@streamunlimited.com>,
	Marcel Holtmann <marcel@holtmann.org>,
	Luiz Augusto von Dentz <luiz.dentz@gmail.com>,
	Simon Mikuda <simon.mikuda@streamunlimited.com>
Subject: [PATCH] Bluetooth: hci_sync: Don't make a periodic advertising set connectable
Date: Sun, 22 Nov 2026 21:14:12 +0100	[thread overview]
Message-ID: <20261122201412.2856420-1-simon.mikuda@streamunlimited.com> (raw)

From: Michal Dzik <michal.dzik@streamunlimited.com>

An advertising instance without MGMT_ADV_FLAG_CONNECTABLE follows the
global connectable setting, and so does the instance of a broadcast
source, which create_big_sync() starts with no flag but
MGMT_ADV_FLAG_SEC_2M. Whenever the adapter is connectable, e.g. while it
is discoverable, the set is configured as connectable extended
advertising, and the controller rejects enabling periodic advertising on
it with Command Disallowed ([Vol 4] Part E, Section 7.8.63), so the
broadcast source fails to start:

  Bluetooth: hci0: Opcode 0x2040 failed: -16
  Bluetooth: hci0: Unable to create BIG: -16

Don't let the global connectable setting make an instance with periodic
advertising connectable.

Fixes: eca0ae4aea66 ("Bluetooth: Add initial implementation of BIS connections")
Signed-off-by: Michal Dzik <michal.dzik@streamunlimited.com>
Signed-off-by: Simon Mikuda <simon.mikuda@streamunlimited.com>
---
 net/bluetooth/hci_sync.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index 638589f77081..11aeaa9feef5 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -1519,10 +1519,12 @@ int hci_setup_ext_adv_instance_sync(struct hci_dev *hdev, u8 instance)
 	flags = hci_adv_instance_flags(hdev, instance);
 
 	/* If the "connectable" instance flag was not set, then choose between
-	 * ADV_IND and ADV_NONCONN_IND based on the global connectable setting.
+	 * ADV_IND and ADV_NONCONN_IND based on the global connectable setting,
+	 * unless the instance carries periodic advertising, which can only be
+	 * enabled on a non-connectable advertising set.
 	 */
 	connectable = (flags & MGMT_ADV_FLAG_CONNECTABLE) ||
-		      mgmt_get_connectable(hdev);
+		      (mgmt_get_connectable(hdev) && !(adv && adv->periodic));
 
 	if (!is_advertising_allowed(hdev, connectable)) {
 		if (instance)

base-commit: 4fe38719e6738feaa90486e36b0790dd5d960a96
-- 
2.43.0


             reply	other threads:[~2026-11-22 20:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-22 20:14 Simon Mikuda [this message]
2026-11-22 22:56 ` Bluetooth: hci_sync: Don't make a periodic advertising set connectable bluez.test.bot

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=20261122201412.2856420-1-simon.mikuda@streamunlimited.com \
    --to=simon.mikuda@streamunlimited.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    --cc=marcel@holtmann.org \
    --cc=michal.dzik@streamunlimited.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