* [PATCH BlueZ v1 1/2] org.bluez.GattCharacteristic: Add confirmation support to AcquireNotify
@ 2025-01-28 16:54 Luiz Augusto von Dentz
2025-01-28 16:54 ` [PATCH BlueZ v1 2/2] gatt: Implement confirmation support for AcquireNotify Luiz Augusto von Dentz
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2025-01-28 16:54 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This adds confirmation support for AcquireNotify when indication
procedure is used, also document the behavior of clients vs servers.
---
doc/org.bluez.GattCharacteristic.rst | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/doc/org.bluez.GattCharacteristic.rst b/doc/org.bluez.GattCharacteristic.rst
index 784445234fe5..7b1b3fbb5446 100644
--- a/doc/org.bluez.GattCharacteristic.rst
+++ b/doc/org.bluez.GattCharacteristic.rst
@@ -212,6 +212,11 @@ fd, uint16 AcquireNotify(dict options) [optional]
To release the lock the client shall close the file descriptor, a HUP is
generated in case the device is disconnected.
+ As a client if indication procedure is used the confirmation is
+ generated automatically once received, for a server if the file
+ descriptor is writable (POLLOUT) then upon receiving a confirmation from
+ the client one byte (0x01) is written to the file descriptor.
+
Note: the MTU can only be negotiated once and is symmetric therefore
this method may be delayed in order to have the exchange MTU completed,
because of that the file descriptor is closed during reconnections as
--
2.48.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH BlueZ v1 2/2] gatt: Implement confirmation support for AcquireNotify 2025-01-28 16:54 [PATCH BlueZ v1 1/2] org.bluez.GattCharacteristic: Add confirmation support to AcquireNotify Luiz Augusto von Dentz @ 2025-01-28 16:54 ` Luiz Augusto von Dentz 2025-01-28 18:07 ` [BlueZ,v1,1/2] org.bluez.GattCharacteristic: Add confirmation support to AcquireNotify bluez.test.bot 2025-01-30 16:30 ` [PATCH BlueZ v1 1/2] " patchwork-bot+bluetooth 2 siblings, 0 replies; 4+ messages in thread From: Luiz Augusto von Dentz @ 2025-01-28 16:54 UTC (permalink / raw) To: linux-bluetooth From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> This implements AcquireNotify (fd based) confirmation so servers can be notified when a client confirm the reception of an indication. Fixes: https://github.com/bluez/bluez/issues/1081 --- src/gatt-database.c | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/src/gatt-database.c b/src/gatt-database.c index a5a01add40f7..7a105b8fe64a 100644 --- a/src/gatt-database.c +++ b/src/gatt-database.c @@ -2601,6 +2601,24 @@ static bool sock_hup(struct io *io, void *user_data) return false; } +static bool sock_io_write(struct io *io, void *user_data) +{ + uint8_t buf[] = { 1 }; + struct iovec iov = { buf, sizeof(buf) }; + + /* Send a 1 to the server as confirmation */ + io_send(io, &iov, 1); + + return false; +} + +static void sock_io_conf(void *user_data) +{ + struct io *io = user_data; + + io_set_write_handler(io, sock_io_write, NULL, NULL); +} + static bool sock_io_read(struct io *io, void *user_data) { struct client_io *client = user_data; @@ -2608,6 +2626,8 @@ static bool sock_io_read(struct io *io, void *user_data) uint8_t buf[512]; int fd = io_get_fd(io); ssize_t bytes_read; + struct notify notify; + struct device_state *state; if (fd < 0) { error("io_get_fd() returned %d\n", fd); @@ -2618,8 +2638,22 @@ static bool sock_io_read(struct io *io, void *user_data) if (bytes_read <= 0) return false; - gatt_notify_cb(chrc->attrib, chrc->ccc, buf, bytes_read, client->att, - client->chrc->service->app->database); + memset(¬ify, 0, sizeof(notify)); + + notify.database = client->chrc->service->app->database; + notify.handle = gatt_db_attribute_get_handle(chrc->attrib); + notify.ccc_handle = gatt_db_attribute_get_handle(chrc->ccc); + notify.value = (void *) buf; + notify.len = bytes_read; + notify.conf = sock_io_conf; + notify.user_data = io; + + + state = find_device_state_by_att(notify.database, client->att); + if (!state) + return false; + + send_notification_to_device(state, ¬ify); return true; } -- 2.48.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [BlueZ,v1,1/2] org.bluez.GattCharacteristic: Add confirmation support to AcquireNotify 2025-01-28 16:54 [PATCH BlueZ v1 1/2] org.bluez.GattCharacteristic: Add confirmation support to AcquireNotify Luiz Augusto von Dentz 2025-01-28 16:54 ` [PATCH BlueZ v1 2/2] gatt: Implement confirmation support for AcquireNotify Luiz Augusto von Dentz @ 2025-01-28 18:07 ` bluez.test.bot 2025-01-30 16:30 ` [PATCH BlueZ v1 1/2] " patchwork-bot+bluetooth 2 siblings, 0 replies; 4+ messages in thread From: bluez.test.bot @ 2025-01-28 18:07 UTC (permalink / raw) To: linux-bluetooth, luiz.dentz [-- Attachment #1: Type: text/plain, Size: 1260 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=928892 ---Test result--- Test Summary: CheckPatch PENDING 0.21 seconds GitLint PENDING 0.24 seconds BuildEll PASS 20.08 seconds BluezMake PASS 1559.01 seconds MakeCheck PASS 13.12 seconds MakeDistcheck PASS 156.65 seconds CheckValgrind PASS 212.54 seconds CheckSmatch PASS 267.63 seconds bluezmakeextell PASS 97.26 seconds IncrementalBuild PENDING 0.35 seconds ScanBuild PASS 844.59 seconds Details ############################## Test: CheckPatch - PENDING Desc: Run checkpatch.pl script Output: ############################## Test: GitLint - PENDING Desc: Run gitlint Output: ############################## Test: IncrementalBuild - PENDING Desc: Incremental build with the patches in the series Output: --- Regards, Linux Bluetooth ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH BlueZ v1 1/2] org.bluez.GattCharacteristic: Add confirmation support to AcquireNotify 2025-01-28 16:54 [PATCH BlueZ v1 1/2] org.bluez.GattCharacteristic: Add confirmation support to AcquireNotify Luiz Augusto von Dentz 2025-01-28 16:54 ` [PATCH BlueZ v1 2/2] gatt: Implement confirmation support for AcquireNotify Luiz Augusto von Dentz 2025-01-28 18:07 ` [BlueZ,v1,1/2] org.bluez.GattCharacteristic: Add confirmation support to AcquireNotify bluez.test.bot @ 2025-01-30 16:30 ` patchwork-bot+bluetooth 2 siblings, 0 replies; 4+ messages in thread From: patchwork-bot+bluetooth @ 2025-01-30 16:30 UTC (permalink / raw) To: Luiz Augusto von Dentz; +Cc: linux-bluetooth Hello: This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>: On Tue, 28 Jan 2025 11:54:22 -0500 you wrote: > From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> > > This adds confirmation support for AcquireNotify when indication > procedure is used, also document the behavior of clients vs servers. > --- > doc/org.bluez.GattCharacteristic.rst | 5 +++++ > 1 file changed, 5 insertions(+) Here is the summary with links: - [BlueZ,v1,1/2] org.bluez.GattCharacteristic: Add confirmation support to AcquireNotify https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=1f7a7c9dcadb - [BlueZ,v1,2/2] gatt: Implement confirmation support for AcquireNotify https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=6b34b055117c 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] 4+ messages in thread
end of thread, other threads:[~2025-01-30 16:30 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-01-28 16:54 [PATCH BlueZ v1 1/2] org.bluez.GattCharacteristic: Add confirmation support to AcquireNotify Luiz Augusto von Dentz 2025-01-28 16:54 ` [PATCH BlueZ v1 2/2] gatt: Implement confirmation support for AcquireNotify Luiz Augusto von Dentz 2025-01-28 18:07 ` [BlueZ,v1,1/2] org.bluez.GattCharacteristic: Add confirmation support to AcquireNotify bluez.test.bot 2025-01-30 16:30 ` [PATCH BlueZ v1 1/2] " 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.