Skip to contentSkip to conversation

client/btpclient: Improve GATT read

PATCH Applied Frédéric Danis 3 participants 4 messages Sep 1 – Sep 23 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 client/btpclient: Improve GATT read

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(+)
client/btpclient/gatt.c +25 -0
index d384b9c74..bd9145173 100644
@@ -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);
Signature · 1 line
2.43.0
#1 lore raw

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=1155344

---Test result---

Test Summary:

CheckPatch                    PASS      0.95 seconds
GitLint                       PASS      0.21 seconds
BuildEll                      PASS      21.05 seconds
BluezMake                     PASS      630.53 seconds
CheckSmatch                   WARNING   330.70 seconds
bluezmakeextell               PASS      105.59 seconds
IncrementalBuild              PASS      635.85 seconds
ScanBuild                     PASS      1031.83 seconds

Details
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
client/btpclient/gatt.c: note: in included file:./src/shared/btp.h:335:41: warning: array of flexible structures./src/shared/btp.h:340:55: warning: array of flexible structures./src/shared/btp.h:363:47: warning: array of flexible structures./src/shared/btp.h:392:42: warning: array of flexible structures

https://github.com/bluez/bluez/pull/2465

---
Regards,
Linux Bluetooth

#2 lore raw
In reply to Frédéric Danis

This is an automated email and please do not reply to this email.

Dear Submitter,

This series was picked up by the CI more than 2 weeks ago and the pull request created for it is still open, which means the series was never applied to the tree.

Series: [BlueZ] client/btpclient: Improve GATT read
Pull Request: https://github.com/bluez/bluez/pull/2465
Created: 2026-09-01 14:17:22+00:00

The pull request has been closed and no further action is taken on this series.

If the change should still be considered, it must be resent to the Linux Bluetooth mailing list ([email protected]) so that it is picked up again.

---
Regards,
Linux Bluetooth

#3 lore raw
In reply to Frédéric Danis
This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Hello:

This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 10 lines · On Tue, 1 Sep 2026 14:54:40 +0200 you wrote:

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.

[...]

Here is the summary with links:
- [BlueZ] client/btpclient: Improve GATT read

    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=97431abc432f

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html