* [PATCH BlueZ] client/btpclient: Improve GATT read
@ 2026-09-01 12:54 Frédéric Danis
2026-09-01 15:04 ` [BlueZ] " bluez.test.bot
0 siblings, 1 reply; 2+ messages in thread
From: Frédéric Danis @ 2026-09-01 12:54 UTC (permalink / raw)
To: linux-bluetooth
BAP/UCL/CGITT/* tests request to read the different Sink/Source
Audio Stream Endpoint characteristics.
The first ReadValue call triggers read of the other characteristics
and PTS, which tracks the read requests, may disconnect before the
following explicit ReadValue has been replied.
First try to read the characteristic value from the proxy cache
before calling ReadValue explicitly.
---
client/btpclient/gatt.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/client/btpclient/gatt.c b/client/btpclient/gatt.c
index d384b9c74..bd9145173 100644
--- a/client/btpclient/gatt.c
+++ b/client/btpclient/gatt.c
@@ -376,6 +376,7 @@ static void btp_gatt_read(uint8_t index, const void *param,
uint8_t status = BTP_ERROR_FAIL;
bool prop;
struct gatt_attribute *characteristic;
+ struct l_dbus_message_iter iter;
if (!adapter) {
status = BTP_ERROR_INVALID_INDEX;
@@ -399,6 +400,30 @@ static void btp_gatt_read(uint8_t index, const void *param,
if (!characteristic)
goto failed;
+ /* First try to read the property value from the proxy cache */
+ if (l_dbus_proxy_get_property(characteristic->proxy, "Value", "ay",
+ &iter)) {
+ uint8_t *data;
+ uint32_t n;
+
+ if (l_dbus_message_iter_get_fixed_array(&iter, &data, &n) &&
+ n > 0) {
+ struct btp_gatt_read_rp *rp;
+
+ rp = malloc(sizeof(struct btp_gatt_read_rp) + n);
+ rp->response = 0;
+ rp->len = n;
+ memcpy(rp->data, data, n);
+
+ btp_send(btp, BTP_GATT_SERVICE, BTP_OP_GATT_READ,
+ adapter->index,
+ sizeof(struct btp_gatt_read_rp) + n, rp);
+
+ free(rp);
+ return;
+ }
+ }
+
l_dbus_proxy_method_call(characteristic->proxy, "ReadValue",
gatt_read_setup, gatt_read_reply,
adapter, NULL);
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-01 15:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-01 12:54 [PATCH BlueZ] client/btpclient: Improve GATT read Frédéric Danis
2026-09-01 15:04 ` [BlueZ] " bluez.test.bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox