All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vibhav Pant <vibhavp@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: Vibhav Pant <vibhavp@gmail.com>
Subject: [PATCH BlueZ 1/1] adapter: Fix unnecessarily enabling the connectable property.
Date: Sat, 15 Feb 2025 04:11:49 +0530	[thread overview]
Message-ID: <20250214224149.135458-2-vibhavp@gmail.com> (raw)
In-Reply-To: <20250214224149.135458-1-vibhavp@gmail.com>

While enabling the discoverable property for an adapter, only enable
the connectable property only if it is currently disabled.
---
 src/adapter.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index da602a7b8..01ef0db5a 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -3142,10 +3142,11 @@ static void property_set_mode(struct btd_adapter *adapter, uint32_t setting,
 		break;
 	case MGMT_SETTING_DISCOVERABLE:
 		if (btd_has_kernel_features(KERNEL_CONN_CONTROL)) {
-			if (mode) {
+			if (mode && !(adapter->current_settings &
+				      MGMT_SETTING_CONNECTABLE)) {
 				set_mode(adapter, MGMT_OP_SET_CONNECTABLE,
 									mode);
-			} else {
+			} else if (!mode) {
 				opcode = MGMT_OP_SET_CONNECTABLE;
 				param = &mode;
 				len = sizeof(mode);
-- 
2.48.1


  reply	other threads:[~2025-02-14 22:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-14 22:41 [PATCH BlueZ 0/1] adapter: Fix unnecessarily enabling the connectable property Vibhav Pant
2025-02-14 22:41 ` Vibhav Pant [this message]
2025-02-15  0:09   ` 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=20250214224149.135458-2-vibhavp@gmail.com \
    --to=vibhavp@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.