2024-05-03 14:52:49

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: [PATCH BlueZ v1] gatt-database: Fix error registering characteristic with Handle 0x0000

From: Luiz Augusto von Dentz <[email protected]>

Registering a characteristic with handle 0x0000 means that the
application wants a handles to be auto allocated but requires to be
informed of what values they end up in the database.

Fixes: https://github.com/bluez/bluez/issues/821
---
src/gatt-database.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/gatt-database.c b/src/gatt-database.c
index 5823aebcbfdb..5756eb9d17cb 100644
--- a/src/gatt-database.c
+++ b/src/gatt-database.c
@@ -3334,12 +3334,12 @@ static void database_add_includes(struct external_service *service)
static bool database_add_chrc(struct external_service *service,
struct external_chrc *chrc)
{
- uint16_t handle;
+ uint16_t handle = 0, value_handle;
bt_uuid_t uuid;
char str[MAX_LEN_UUID_STR];
const struct queue_entry *entry;

- if (!parse_handle(chrc->proxy, &handle)) {
+ if (!parse_handle(chrc->proxy, &value_handle)) {
error("Failed to read \"Handle\" property of characteristic");
return false;
}
@@ -3354,8 +3354,11 @@ static bool database_add_chrc(struct external_service *service,
return false;
}

+ if (value_handle)
+ handle = value_handle - 1;
+
chrc->attrib = gatt_db_service_insert_characteristic(service->attrib,
- handle - 1, handle, &uuid,
+ handle, value_handle, &uuid,
chrc->perm, chrc->props,
chrc_read_cb, chrc_write_cb,
chrc);
--
2.44.0



2024-05-03 16:44:16

by bluez.test.bot

[permalink] [raw]
Subject: RE: [BlueZ,v1] gatt-database: Fix error registering characteristic with Handle 0x0000

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

---Test result---

Test Summary:
CheckPatch PASS 0.38 seconds
GitLint FAIL 0.46 seconds
BuildEll PASS 24.61 seconds
BluezMake PASS 1723.27 seconds
MakeCheck PASS 13.51 seconds
MakeDistcheck PASS 177.39 seconds
CheckValgrind PASS 246.78 seconds
CheckSmatch PASS 350.84 seconds
bluezmakeextell PASS 118.94 seconds
IncrementalBuild PASS 1495.92 seconds
ScanBuild PASS 1007.77 seconds

Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[BlueZ,v1] gatt-database: Fix error registering characteristic with Handle 0x0000

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
1: T1 Title exceeds max length (81>80): "[BlueZ,v1] gatt-database: Fix error registering characteristic with Handle 0x0000"


---
Regards,
Linux Bluetooth

2024-05-06 14:44:23

by patchwork-bot+bluetooth

[permalink] [raw]
Subject: Re: [PATCH BlueZ v1] gatt-database: Fix error registering characteristic with Handle 0x0000

Hello:

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

On Fri, 3 May 2024 10:52:38 -0400 you wrote:
> From: Luiz Augusto von Dentz <[email protected]>
>
> Registering a characteristic with handle 0x0000 means that the
> application wants a handles to be auto allocated but requires to be
> informed of what values they end up in the database.
>
> Fixes: https://github.com/bluez/bluez/issues/821
>
> [...]

Here is the summary with links:
- [BlueZ,v1] gatt-database: Fix error registering characteristic with Handle 0x0000
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=f34cc1da5081

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