Linux bluetooth development
 help / color / mirror / Atom feed
From: Simon Mikuda <simon.mikuda@streamunlimited.com>
To: linux-bluetooth@vger.kernel.org
Cc: Simon Mikuda <simon.mikuda@streamunlimited.com>
Subject: [PATCH BlueZ 7/8] device: Don't accept LE profiles over ATT on BR/EDR
Date: Tue, 24 Nov 2026 15:46:41 +0100	[thread overview]
Message-ID: <20261124144642.298366-8-simon.mikuda@streamunlimited.com> (raw)
In-Reply-To: <20261124144642.298366-1-simon.mikuda@streamunlimited.com>

When ATT runs over BR/EDR, every profile accepts the GATT services found
on it, LE only ones included: BAP reads the PACs, VCP, MCP and BASS
attach, MCP creates a player and RAP a ChannelSounding1 interface for a
device without an LE link.

Skip the profiles of the LE bearer when ATT runs over BR/EDR.

Assisted-by: Claude:claude-opus-5-5
---
 src/device.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/src/device.c b/src/device.c
index 7a85403f0..8508fed81 100644
--- a/src/device.c
+++ b/src/device.c
@@ -4806,6 +4806,19 @@ static bool device_match_profile(struct btd_device *device,
 	return true;
 }
 
+static void device_accept_gatt_service(struct btd_device *device,
+						struct btd_service *service)
+{
+	struct btd_profile *profile = btd_service_get_profile(service);
+
+	/* A profile of the LE bearer doesn't run over ATT on BR/EDR */
+	if (profile->bearer == BTD_PROFILE_BEARER_LE &&
+			bt_att_get_link_type(device->att) == BT_ATT_BREDR)
+		return;
+
+	service_accept(service, btd_device_is_initiator(device));
+}
+
 static void add_gatt_service(struct gatt_db_attribute *attr, void *user_data)
 {
 	struct btd_device *device = user_data;
@@ -4845,7 +4858,7 @@ done:
 	}
 
 	/* Notify driver about the new connection */
-	service_accept(service, btd_device_is_initiator(device));
+	device_accept_gatt_service(device, service);
 }
 
 
@@ -4907,17 +4920,16 @@ static void device_add_gatt_services(struct btd_device *device)
 static void device_accept_gatt_profiles(struct btd_device *device)
 {
 	GSList *l;
-	bool initiator = btd_device_is_initiator(device);
 	GSList *services;
 
-	DBG("initiator %s", initiator ? "true" : "false");
+	DBG("initiator %s", btd_device_is_initiator(device) ? "true" : "false");
 
 	/* Accept in profile priority order */
 	services = g_slist_copy(device->services);
 	services = btd_profile_sort_list(services, get_service_profile, NULL);
 
 	for (l = services; l != NULL; l = g_slist_next(l))
-		service_accept(l->data, initiator);
+		device_accept_gatt_service(device, l->data);
 
 	g_slist_free(services);
 }
-- 
2.43.0


  parent reply	other threads:[~2026-11-24 14:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 14:46 [PATCH BlueZ 0/8] Fix GATT over BR/EDR Simon Mikuda
2026-11-24 14:46 ` [PATCH BlueZ 1/8] tools/btgatt-client: Add BR/EDR support Simon Mikuda
2026-11-24 20:44   ` Fix GATT over BR/EDR bluez.test.bot
2026-11-24 14:46 ` [PATCH BlueZ 2/8] shared/att: Use the smaller L2CAP MTU as ATT MTU Simon Mikuda
2026-11-24 14:46 ` [PATCH BlueZ 3/8] device: Don't override the ATT MTU over BR/EDR Simon Mikuda
2026-11-24 14:46 ` [PATCH BlueZ 4/8] device: Don't resolve services on GATT " Simon Mikuda
2026-11-24 14:46 ` [PATCH BlueZ 5/8] gatt-client: Don't connect EATT on an ATT bearer " Simon Mikuda
2026-11-24 14:46 ` [PATCH BlueZ 6/8] profiles: Set the LE bearer for TMAP, GMAP and RAP Simon Mikuda
2026-11-24 14:46 ` Simon Mikuda [this message]
2026-11-24 14:46 ` [PATCH BlueZ 8/8] device: Connect GATT over BR/EDR with ConnectProfile Simon Mikuda

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=20261124144642.298366-8-simon.mikuda@streamunlimited.com \
    --to=simon.mikuda@streamunlimited.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