public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Benedek Kupper <kupper.benedek@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: Benedek Kupper <benedek.kupper@epitome.inc>
Subject: [PATCH BlueZ] gatt-client: allow AcquireNotify when characteristic has indicate flag
Date: Thu, 22 Aug 2024 13:32:26 +0200	[thread overview]
Message-ID: <20240822113226.223790-1-kupper.benedek@gmail.com> (raw)

From: Benedek Kupper <benedek.kupper@epitome.inc>

StartNotify / StopNotify already correctly allows usage when the
characteristic indicate is present (simplify this check though),
apply the same to AcquireNotify.
---
 src/gatt-client.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/gatt-client.c b/src/gatt-client.c
index 8d83a9577..a67e04eee 100644
--- a/src/gatt-client.c
+++ b/src/gatt-client.c
@@ -1556,7 +1556,8 @@ static DBusMessage *characteristic_acquire_notify(DBusConnection *conn,
 	if (!queue_isempty(chrc->notify_clients))
 		return btd_error_in_progress(msg);
 
-	if (!(chrc->props & BT_GATT_CHRC_PROP_NOTIFY))
+	if (!(chrc->props & (BT_GATT_CHRC_PROP_NOTIFY |
+			BT_GATT_CHRC_PROP_INDICATE)))
 		return btd_error_not_supported(msg);
 
 	client = notify_client_create(chrc, sender);
@@ -1601,8 +1602,8 @@ static DBusMessage *characteristic_start_notify(DBusConnection *conn,
 	if (chrc->notify_io)
 		return btd_error_not_permitted(msg, "Notify acquired");
 
-	if (!(chrc->props & BT_GATT_CHRC_PROP_NOTIFY ||
-				chrc->props & BT_GATT_CHRC_PROP_INDICATE))
+	if (!(chrc->props & (BT_GATT_CHRC_PROP_NOTIFY |
+				BT_GATT_CHRC_PROP_INDICATE)))
 		return btd_error_not_supported(msg);
 
 	/* Each client can only have one active notify session. */
-- 
2.34.1


             reply	other threads:[~2024-08-22 11:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-22 11:32 Benedek Kupper [this message]
2024-08-22 13:03 ` [BlueZ] gatt-client: allow AcquireNotify when characteristic has indicate flag bluez.test.bot
2024-08-22 16:17 ` [PATCH BlueZ] " Luiz Augusto von Dentz
     [not found] <0d55b509-ba21-4999-bad5-095c8efc4b48.66d5fd0b-0f5e-4168-b99e-0d55f52992ba.7f6ae423-2ec8-48f0-998d-7616d5fa8ce1@emailsignatures365.codetwo.com>
2024-08-22  9:46 ` Benedek Kupper

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=20240822113226.223790-1-kupper.benedek@gmail.com \
    --to=kupper.benedek@gmail.com \
    --cc=benedek.kupper@epitome.inc \
    --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