From: "Pali Rohár" <pali@kernel.org>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH] device: Return error when ConnectProfile DBus method fails
Date: Fri, 24 Apr 2020 01:32:43 +0200 [thread overview]
Message-ID: <20200423233243.14937-1-pali@kernel.org> (raw)
Without this patch ConnectProfile DBus method does not return failure if
profile connection failed and some other profile was already connected.
This is not correct behavior as ConnectProfile DBus method should always
return error when specified profile failed to connect. This patch fixes
this it.
---
src/device.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/device.c b/src/device.c
index a8d95346a..7ab30705f 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1584,6 +1584,7 @@ static void device_profile_connected(struct btd_device *dev,
struct btd_profile *profile, int err)
{
struct btd_service *pending;
+ bool report_error;
GSList *l;
DBG("%s %s (%d)", profile->name, strerror(-err), -err);
@@ -1632,9 +1633,16 @@ done:
DBG("returning response to %s", dbus_message_get_sender(dev->connect));
- l = find_service_with_state(dev->services, BTD_SERVICE_STATE_CONNECTED);
+ if (err && dbus_message_is_method_call(dev->connect, DEVICE_INTERFACE,
+ "ConnectProfile"))
+ report_error = true;
+ else if (err && !find_service_with_state(dev->services,
+ BTD_SERVICE_STATE_CONNECTED))
+ report_error = true;
+ else
+ report_error = false;
- if (err && l == NULL) {
+ if (report_error) {
/* Fallback to LE bearer if supported */
if (err == -EHOSTDOWN && dev->le && !dev->le_state.connected) {
err = device_connect_le(dev);
--
2.20.1
next reply other threads:[~2020-04-23 23:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-23 23:32 Pali Rohár [this message]
2020-04-24 17:26 ` [PATCH] device: Return error when ConnectProfile DBus method fails Luiz Augusto von Dentz
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=20200423233243.14937-1-pali@kernel.org \
--to=pali@kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.