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 4/8] device: Don't resolve services on GATT over BR/EDR
Date: Tue, 24 Nov 2026 15:46:38 +0100	[thread overview]
Message-ID: <20261124144642.298366-5-simon.mikuda@streamunlimited.com> (raw)
In-Reply-To: <20261124144642.298366-1-simon.mikuda@streamunlimited.com>

When GATT discovery over BR/EDR completes, gatt_client_ready_cb() calls
device_svc_resolved() for device->bdaddr_type. For a BR/EDR device this
marks the bearer resolved and runs the device_wait_for_svc_complete()
callbacks while SDP may still be running, so they find none of the
device's profiles. For a device with an LE address type it resolves the
LE bearer instead. iOS opens ATT over BR/EDR right after pairing.

Over BR/EDR, leave resolving the services to SDP.

Fixes: 4b5bb941c380 ("core/device: Use shared/gatt-client for GATT")
Assisted-by: Claude:claude-opus-5-5
---
 src/device.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/device.c b/src/device.c
index be3267368..7a85403f0 100644
--- a/src/device.c
+++ b/src/device.c
@@ -6423,12 +6423,15 @@ static void gatt_client_ready_cb(bool success, uint8_t att_ecode,
 								void *user_data)
 {
 	struct btd_device *device = user_data;
+	bool bredr = bt_att_get_link_type(device->att) == BT_ATT_BREDR;
 
 	DBG("status: %s, error: %u", success ? "success" : "failed", att_ecode);
 
+	/* Over BR/EDR, SDP resolves the services of the bearer */
 	if (!success) {
-		device_svc_resolved(device, BROWSE_GATT, device->bdaddr_type,
-									-EIO);
+		if (!bredr)
+			device_svc_resolved(device, BROWSE_GATT,
+						device->bdaddr_type, -EIO);
 		return;
 	}
 
@@ -6436,7 +6439,9 @@ static void gatt_client_ready_cb(bool success, uint8_t att_ecode,
 
 	btd_gatt_client_ready(device->client_dbus);
 
-	device_svc_resolved(device, BROWSE_GATT, device->bdaddr_type, 0);
+	if (!bredr)
+		device_svc_resolved(device, BROWSE_GATT, device->bdaddr_type,
+									0);
 
 	store_gatt_db(device);
 }
-- 
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 ` Simon Mikuda [this message]
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 ` [PATCH BlueZ 7/8] device: Don't accept LE profiles over ATT on BR/EDR Simon Mikuda
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-5-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