All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 2/2] adapter: Return Busy error when setting is pending
Date: Thu,  4 Mar 2021 14:24:48 -0800	[thread overview]
Message-ID: <20210304222448.3769100-2-luiz.dentz@gmail.com> (raw)
In-Reply-To: <20210304222448.3769100-1-luiz.dentz@gmail.com>

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This returns an error if application attempts to change a property that
is pending.

Fixes: https://github.com/bluez/bluez/issues/99
---
 src/adapter.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/adapter.c b/src/adapter.c
index f483cc827..cc0849f99 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -2880,12 +2880,18 @@ static void property_set_mode(struct btd_adapter *adapter, uint32_t setting,
 
 	dbus_message_iter_get_basic(value, &enable);
 
+	if (adapter->pending_settings & setting) {
+		g_dbus_pending_property_error(id, ERROR_INTERFACE ".Busy",
+						NULL);
+		return;
+	}
+
 	if (adapter->current_settings & setting)
 		current_enable = TRUE;
 	else
 		current_enable = FALSE;
 
-	if (enable == current_enable || adapter->pending_settings & setting) {
+	if (enable == current_enable) {
 		g_dbus_pending_property_success(id);
 		return;
 	}
-- 
2.29.2


  reply	other threads:[~2021-03-04 22:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-04 22:24 [PATCH BlueZ 1/2] adapter: Fix not using the correct setting Luiz Augusto von Dentz
2021-03-04 22:24 ` Luiz Augusto von Dentz [this message]
2021-03-04 22:38 ` [BlueZ,1/2] " bluez.test.bot
2021-03-06  1:17   ` Luiz Augusto von Dentz
2021-03-06 10:10     ` Bastien Nocera
2021-03-05  7:34 ` [PATCH BlueZ 1/2] " Bastien Nocera

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=20210304222448.3769100-2-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 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.