diff mbox series

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

Message ID 20240503145238.3771921-1-luiz.dentz@gmail.com (mailing list archive)
State Accepted
Commit f34cc1da5081e1a464212dc73cde8ba4f2b79d99
Headers show
Series [BlueZ,v1] gatt-database: Fix error registering characteristic with Handle 0x0000 | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint fail 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"
tedd_an/BuildEll success Build ELL PASS
tedd_an/BluezMake success Bluez Make PASS
tedd_an/MakeCheck success Bluez Make Check PASS
tedd_an/MakeDistcheck success Make Distcheck PASS
tedd_an/CheckValgrind success Check Valgrind PASS
tedd_an/CheckSmatch success CheckSparse PASS
tedd_an/bluezmakeextell success Make External ELL PASS
tedd_an/IncrementalBuild success Incremental Build PASS
tedd_an/ScanBuild success Scan Build PASS

Commit Message

Luiz Augusto von Dentz May 3, 2024, 2:52 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

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(-)

Comments

bluez.test.bot@gmail.com May 3, 2024, 4:42 p.m. UTC | #1
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
patchwork-bot+bluetooth@kernel.org May 6, 2024, 2:20 p.m. UTC | #2
Hello:

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

On Fri,  3 May 2024 10:52:38 -0400 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> 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!
diff mbox series

Patch

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);