All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ v1] gatt-database: Fix sending notification to all devices
@ 2024-04-18 19:47 Luiz Augusto von Dentz
  2024-04-18 21:43 ` [BlueZ,v1] " bluez.test.bot
  2024-04-22 15:40 ` [PATCH BlueZ v1] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2024-04-18 19:47 UTC (permalink / raw)
  To: linux-bluetooth

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

If notifications where setup with GATT application that implements
AcquireNotify the code will attempt to setup a dedicate fd/io for each
device so when receiving a notification over the fd/io it is only meant
to be send to the device only.

Fixes: https://github.com/bluez/bluez/issues/820
---
 src/gatt-database.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/gatt-database.c b/src/gatt-database.c
index 6c11027a79ed..7ca2f94222c6 100644
--- a/src/gatt-database.c
+++ b/src/gatt-database.c
@@ -112,6 +112,7 @@ struct external_profile {
 
 struct client_io {
 	struct bt_att *att;
+	struct external_chrc *chrc;
 	unsigned int disconn_id;
 	struct io *io;
 };
@@ -2588,7 +2589,8 @@ static bool sock_hup(struct io *io, void *user_data)
 
 static bool sock_io_read(struct io *io, void *user_data)
 {
-	struct external_chrc *chrc = user_data;
+	struct client_io *client = user_data;
+	struct external_chrc *chrc = client->chrc;
 	uint8_t buf[512];
 	int fd = io_get_fd(io);
 	ssize_t bytes_read;
@@ -2597,12 +2599,8 @@ static bool sock_io_read(struct io *io, void *user_data)
 	if (bytes_read <= 0)
 		return false;
 
-	send_notification_to_devices(chrc->service->app->database,
-				gatt_db_attribute_get_handle(chrc->attrib),
-				buf, bytes_read,
-				gatt_db_attribute_get_handle(chrc->ccc),
-				conf_cb,
-				chrc->proxy);
+	gatt_notify_cb(chrc->attrib, chrc->ccc, buf, bytes_read, client->att,
+				client->chrc->service->app->database);
 
 	return true;
 }
@@ -2652,6 +2650,7 @@ client_io_new(struct external_chrc *chrc, int fd, struct bt_att *att)
 
 	client = new0(struct client_io, 1);
 	client->att = bt_att_ref(att);
+	client->chrc = chrc;
 	client->disconn_id = bt_att_register_disconnect(att, att_disconnect_cb,
 							client, NULL);
 	client->io = sock_io_new(fd, chrc);
@@ -2809,7 +2808,7 @@ client_notify_io_get(struct external_chrc *chrc, int fd, struct bt_att *att)
 
 	client = client_io_new(chrc, fd, att);
 
-	io_set_read_handler(client->io, sock_io_read, chrc, NULL);
+	io_set_read_handler(client->io, sock_io_read, client, NULL);
 
 	if (!chrc->notify_ios)
 		chrc->notify_ios = queue_new();
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [BlueZ,v1] gatt-database: Fix sending notification to all devices
  2024-04-18 19:47 [PATCH BlueZ v1] gatt-database: Fix sending notification to all devices Luiz Augusto von Dentz
@ 2024-04-18 21:43 ` bluez.test.bot
  2024-04-22 15:40 ` [PATCH BlueZ v1] " patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2024-04-18 21:43 UTC (permalink / raw)
  To: linux-bluetooth, luiz.dentz

[-- Attachment #1: Type: text/plain, Size: 1296 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=845939

---Test result---

Test Summary:
CheckPatch                    PASS      0.26 seconds
GitLint                       PASS      0.18 seconds
BuildEll                      PASS      24.77 seconds
BluezMake                     PASS      1733.68 seconds
MakeCheck                     PASS      13.70 seconds
MakeDistcheck                 PASS      178.89 seconds
CheckValgrind                 PASS      248.20 seconds
CheckSmatch                   PASS      355.07 seconds
bluezmakeextell               PASS      120.05 seconds
IncrementalBuild              PASS      1575.95 seconds
ScanBuild                     WARNING   1022.75 seconds

Details
##############################
Test: ScanBuild - WARNING
Desc: Run Scan Build
Output:
src/gatt-database.c:1155:10: warning: Value stored to 'bits' during its initialization is never read
        uint8_t bits[] = { BT_GATT_CHRC_CLI_FEAT_ROBUST_CACHING,
                ^~~~     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH BlueZ v1] gatt-database: Fix sending notification to all devices
  2024-04-18 19:47 [PATCH BlueZ v1] gatt-database: Fix sending notification to all devices Luiz Augusto von Dentz
  2024-04-18 21:43 ` [BlueZ,v1] " bluez.test.bot
@ 2024-04-22 15:40 ` patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2024-04-22 15:40 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

Hello:

This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Thu, 18 Apr 2024 15:47:23 -0400 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> If notifications where setup with GATT application that implements
> AcquireNotify the code will attempt to setup a dedicate fd/io for each
> device so when receiving a notification over the fd/io it is only meant
> to be send to the device only.
> 
> [...]

Here is the summary with links:
  - [BlueZ,v1] gatt-database: Fix sending notification to all devices
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=a08ec1a4e93b

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-04-22 15:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-18 19:47 [PATCH BlueZ v1] gatt-database: Fix sending notification to all devices Luiz Augusto von Dentz
2024-04-18 21:43 ` [BlueZ,v1] " bluez.test.bot
2024-04-22 15:40 ` [PATCH BlueZ v1] " patchwork-bot+bluetooth

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.