From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ v1 1/2] device: Fix btd_device_connect_services not discovering
Date: Tue, 7 Apr 2026 17:12:28 -0400 [thread overview]
Message-ID: <20260407211229.61232-1-luiz.dentz@gmail.com> (raw)
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
btd_device_connect_services would not attempt to discover in case the
selected bearer is BR/EDR and once discover is complete then it shall
proceed with connecting the services.
---
src/adapter.c | 9 ---------
src/device.c | 27 +++++++++++++++++++++++++--
2 files changed, 25 insertions(+), 11 deletions(-)
diff --git a/src/adapter.c b/src/adapter.c
index 04568dae6e98..46b89526fcaf 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -3686,14 +3686,6 @@ struct device_connect_data {
DBusMessage *msg;
};
-static void device_browse_cb(struct btd_device *dev, int err, void *user_data)
-{
- DBG("err %d (%s)", err, strerror(-err));
-
- if (!err)
- btd_device_connect_services(dev, NULL);
-}
-
static void device_connect_cb(GIOChannel *io, GError *gerr, gpointer user_data)
{
struct device_connect_data *data = user_data;
@@ -3726,7 +3718,6 @@ static void device_connect_cb(GIOChannel *io, GError *gerr, gpointer user_data)
}
device_discover_services(device);
- device_wait_for_svc_complete(device, device_browse_cb, NULL);
g_io_channel_unref(io);
dbus_message_unref(data->msg);
diff --git a/src/device.c b/src/device.c
index cfbde307bcc9..e762aea2797c 100644
--- a/src/device.c
+++ b/src/device.c
@@ -2705,6 +2705,17 @@ static uint8_t select_conn_bearer(struct btd_device *dev)
return dev->bdaddr_type;
}
+static void device_browse_cb(struct btd_device *dev, int err, void *user_data)
+{
+ DBG("err %d (%s)", err, strerror(-err));
+
+ /* If there are not errors with discovery proceed conecting services */
+ if (!err) {
+ dev->pending = create_pending_list(dev, NULL);
+ connect_next(dev);
+ }
+}
+
int btd_device_connect_services(struct btd_device *dev, GSList *services)
{
GSList *l;
@@ -2724,8 +2735,20 @@ int btd_device_connect_services(struct btd_device *dev, GSList *services)
return device_connect_le(dev);
}
- if (!dev->bredr_state.svc_resolved)
- return -ENOENT;
+ if (!dev->bredr_state.svc_resolved) {
+ int err;
+
+ err = device_discover_services(dev);
+ if (err)
+ return err;
+
+ /* Wait for service discovery to complete before connecting to
+ * profiles.
+ */
+ device_wait_for_svc_complete(dev, device_browse_cb, NULL);
+
+ return 0;
+ }
if (services) {
for (l = services; l; l = g_slist_next(l)) {
--
2.53.0
next reply other threads:[~2026-04-07 21:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-07 21:12 Luiz Augusto von Dentz [this message]
2026-04-07 21:12 ` [PATCH BlueZ v1 2/2] client: Prompt user to start scanning on connect command Luiz Augusto von Dentz
2026-04-07 22:19 ` [BlueZ,v1,1/2] device: Fix btd_device_connect_services not discovering 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=20260407211229.61232-1-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