public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH bluez] shared/gatt-db: Add read offset to record the progress of att read blob request
@ 2025-05-27  7:12 Ye He via B4 Relay
  2025-05-27  7:22 ` [bluez] " bluez.test.bot
  0 siblings, 1 reply; 2+ messages in thread
From: Ye He via B4 Relay @ 2025-05-27  7:12 UTC (permalink / raw)
  To: Linux Bluetooth; +Cc: Ye He

From: Ye He <ye.he@amlogic.com>

When processing the att read blob request packet sent
by the mobile phone, Bluez ignores the offset and the
payload of each att read blob response is the same.

This patch add read offset to record the progress of
att read blob request.

Fixes: https://github.com/bluez/bluez/issues/1294

Signed-off-by: Ye He <ye.he@amlogic.com>
---
 src/shared/gatt-db.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/shared/gatt-db.c b/src/shared/gatt-db.c
index 8951079beef1a8af7e46e87043f320640d4109f7..7c4127dbaebfa659d010a0595ea13ffbb88edade 100644
--- a/src/shared/gatt-db.c
+++ b/src/shared/gatt-db.c
@@ -109,6 +109,7 @@ struct gatt_db_attribute {
 	uint32_t permissions;
 	uint16_t value_len;
 	uint8_t *value;
+	uint16_t read_offet;
 
 	gatt_db_read_t read_func;
 	gatt_db_write_t write_func;
@@ -151,7 +152,8 @@ static void pending_read_result(struct pending_read *p, int err,
 	if (p->timeout_id > 0)
 		timeout_remove(p->timeout_id);
 
-	p->func(p->attrib, err, data, length, p->user_data);
+	p->func(p->attrib, err, data + p->attrib->read_offset,
+			length - p->attrib->read_offset, p->user_data);
 
 	free(p);
 }
@@ -2126,6 +2128,8 @@ bool gatt_db_attribute_read(struct gatt_db_attribute *attrib, uint16_t offset,
 	if (!attrib || !func)
 		return false;
 
+	attrib->read_offset = offset;
+
 	/* Check boundaries if value_len is set */
 	if (attrib->value_len && offset > attrib->value_len) {
 		func(attrib, BT_ATT_ERROR_INVALID_OFFSET, NULL, 0, user_data);

---
base-commit: c888c682fbd4e02dce6bf4c1f9a47328ceb02716
change-id: 20250527-att-read-blob-rsp-err-c30db15efd30

Best regards,
-- 
Ye He <ye.he@amlogic.com>



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* RE: [bluez] shared/gatt-db: Add read offset to record the progress of att read blob request
  2025-05-27  7:12 [PATCH bluez] shared/gatt-db: Add read offset to record the progress of att read blob request Ye He via B4 Relay
@ 2025-05-27  7:22 ` bluez.test.bot
  0 siblings, 0 replies; 2+ messages in thread
From: bluez.test.bot @ 2025-05-27  7:22 UTC (permalink / raw)
  To: linux-bluetooth, ye.he

[-- Attachment #1: Type: text/plain, Size: 12923 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=966564

---Test result---

Test Summary:
CheckPatch                    PENDING   0.31 seconds
GitLint                       PENDING   0.30 seconds
BuildEll                      PASS      20.10 seconds
BluezMake                     FAIL      13.23 seconds
MakeCheck                     FAIL      28.23 seconds
MakeDistcheck                 FAIL      35.28 seconds
CheckValgrind                 FAIL      11.89 seconds
CheckSmatch                   FAIL      18.90 seconds
bluezmakeextell               FAIL      11.72 seconds
IncrementalBuild              PENDING   0.33 seconds
ScanBuild                     FAIL      22.42 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: BluezMake - FAIL
Desc: Build BlueZ
Output:

src/shared/gatt-db.c: In function ‘pending_read_result’:
src/shared/gatt-db.c:155:44: error: ‘struct gatt_db_attribute’ has no member named ‘read_offset’; did you mean ‘read_offet’?
  155 |  p->func(p->attrib, err, data + p->attrib->read_offset,
      |                                            ^~~~~~~~~~~
      |                                            read_offet
src/shared/gatt-db.c:156:24: error: ‘struct gatt_db_attribute’ has no member named ‘read_offset’; did you mean ‘read_offet’?
  156 |    length - p->attrib->read_offset, p->user_data);
      |                        ^~~~~~~~~~~
      |                        read_offet
src/shared/gatt-db.c: In function ‘gatt_db_attribute_read’:
src/shared/gatt-db.c:2131:10: error: ‘struct gatt_db_attribute’ has no member named ‘read_offset’; did you mean ‘read_offet’?
 2131 |  attrib->read_offset = offset;
      |          ^~~~~~~~~~~
      |          read_offet
make[1]: *** [Makefile:8622: src/shared/libshared_mainloop_la-gatt-db.lo] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:4691: all] Error 2
##############################
Test: MakeCheck - FAIL
Desc: Run Bluez Make Check
Output:

src/shared/gatt-db.c: In function ‘pending_read_result’:
src/shared/gatt-db.c:155:44: error: ‘struct gatt_db_attribute’ has no member named ‘read_offset’; did you mean ‘read_offet’?
  155 |  p->func(p->attrib, err, data + p->attrib->read_offset,
      |                                            ^~~~~~~~~~~
      |                                            read_offet
src/shared/gatt-db.c:156:24: error: ‘struct gatt_db_attribute’ has no member named ‘read_offset’; did you mean ‘read_offet’?
  156 |    length - p->attrib->read_offset, p->user_data);
      |                        ^~~~~~~~~~~
      |                        read_offet
src/shared/gatt-db.c: In function ‘gatt_db_attribute_read’:
src/shared/gatt-db.c:2131:10: error: ‘struct gatt_db_attribute’ has no member named ‘read_offset’; did you mean ‘read_offet’?
 2131 |  attrib->read_offset = offset;
      |          ^~~~~~~~~~~
      |          read_offet
make[1]: *** [Makefile:8377: src/shared/libshared_glib_la-gatt-db.lo] Error 1
make: *** [Makefile:12346: check] Error 2
##############################
Test: MakeDistcheck - FAIL
Desc: Run Bluez Make Distcheck
Output:

Package cups was not found in the pkg-config search path.
Perhaps you should add the directory containing `cups.pc'
to the PKG_CONFIG_PATH environment variable
No package 'cups' found
../../src/shared/gatt-db.c: In function ‘pending_read_result’:
../../src/shared/gatt-db.c:155:44: error: ‘struct gatt_db_attribute’ has no member named ‘read_offset’; did you mean ‘read_offet’?
  155 |  p->func(p->attrib, err, data + p->attrib->read_offset,
      |                                            ^~~~~~~~~~~
      |                                            read_offet
../../src/shared/gatt-db.c:156:24: error: ‘struct gatt_db_attribute’ has no member named ‘read_offset’; did you mean ‘read_offet’?
  156 |    length - p->attrib->read_offset, p->user_data);
      |                        ^~~~~~~~~~~
      |                        read_offet
../../src/shared/gatt-db.c: In function ‘gatt_db_attribute_read’:
../../src/shared/gatt-db.c:2131:10: error: ‘struct gatt_db_attribute’ has no member named ‘read_offset’; did you mean ‘read_offet’?
 2131 |  attrib->read_offset = offset;
      |          ^~~~~~~~~~~
      |          read_offet
make[2]: *** [Makefile:8622: src/shared/libshared_mainloop_la-gatt-db.lo] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [Makefile:4691: all] Error 2
make: *** [Makefile:12267: distcheck] Error 1
##############################
Test: CheckValgrind - FAIL
Desc: Run Bluez Make Check with Valgrind
Output:

src/shared/gatt-db.c: In function ‘pending_read_result’:
src/shared/gatt-db.c:155:44: error: ‘struct gatt_db_attribute’ has no member named ‘read_offset’; did you mean ‘read_offet’?
  155 |  p->func(p->attrib, err, data + p->attrib->read_offset,
      |                                            ^~~~~~~~~~~
      |                                            read_offet
src/shared/gatt-db.c:156:24: error: ‘struct gatt_db_attribute’ has no member named ‘read_offset’; did you mean ‘read_offet’?
  156 |    length - p->attrib->read_offset, p->user_data);
      |                        ^~~~~~~~~~~
      |                        read_offet
src/shared/gatt-db.c: In function ‘gatt_db_attribute_read’:
src/shared/gatt-db.c:2131:10: error: ‘struct gatt_db_attribute’ has no member named ‘read_offset’; did you mean ‘read_offet’?
 2131 |  attrib->read_offset = offset;
      |          ^~~~~~~~~~~
      |          read_offet
make[1]: *** [Makefile:8622: src/shared/libshared_mainloop_la-gatt-db.lo] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:12346: check] Error 2
##############################
Test: CheckSmatch - FAIL
Desc: Run smatch tool with source
Output:

src/shared/crypto.c:271:21: warning: Variable length array is used.
src/shared/crypto.c:272:23: warning: Variable length array is used.
src/shared/gatt-helpers.c:768:31: warning: Variable length array is used.
src/shared/gatt-helpers.c:830:31: warning: Variable length array is used.
src/shared/gatt-helpers.c:1323:31: warning: Variable length array is used.
src/shared/gatt-helpers.c:1354:23: warning: Variable length array is used.
src/shared/gatt-server.c:278:25: warning: Variable length array is used.
src/shared/gatt-server.c:618:25: warning: Variable length array is used.
src/shared/gatt-server.c:716:25: warning: Variable length array is used.
src/shared/bap.c:315:25: warning: array of flexible structures
src/shared/bap.c: note: in included file:
./src/shared/ascs.h:88:25: warning: array of flexible structures
src/shared/gatt-db.c: In function ‘pending_read_result’:
src/shared/gatt-db.c:155:44: error: ‘struct gatt_db_attribute’ has no member named ‘read_offset’; did you mean ‘read_offet’?
  155 |  p->func(p->attrib, err, data + p->attrib->read_offset,
      |                                            ^~~~~~~~~~~
      |                                            read_offet
src/shared/gatt-db.c:156:24: error: ‘struct gatt_db_attribute’ has no member named ‘read_offset’; did you mean ‘read_offet’?
  156 |    length - p->attrib->read_offset, p->user_data);
      |                        ^~~~~~~~~~~
      |                        read_offet
src/shared/gatt-db.c: In function ‘gatt_db_attribute_read’:
src/shared/gatt-db.c:2131:10: error: ‘struct gatt_db_attribute’ has no member named ‘read_offset’; did you mean ‘read_offet’?
 2131 |  attrib->read_offset = offset;
      |          ^~~~~~~~~~~
      |          read_offet
make[1]: *** [Makefile:8622: src/shared/libshared_mainloop_la-gatt-db.lo] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:4691: all] Error 2
##############################
Test: bluezmakeextell - FAIL
Desc: Build Bluez with External ELL
Output:

src/shared/gatt-db.c: In function ‘pending_read_result’:
src/shared/gatt-db.c:155:44: error: ‘struct gatt_db_attribute’ has no member named ‘read_offset’; did you mean ‘read_offet’?
  155 |  p->func(p->attrib, err, data + p->attrib->read_offset,
      |                                            ^~~~~~~~~~~
      |                                            read_offet
src/shared/gatt-db.c:156:24: error: ‘struct gatt_db_attribute’ has no member named ‘read_offset’; did you mean ‘read_offet’?
  156 |    length - p->attrib->read_offset, p->user_data);
      |                        ^~~~~~~~~~~
      |                        read_offet
src/shared/gatt-db.c: In function ‘gatt_db_attribute_read’:
src/shared/gatt-db.c:2131:10: error: ‘struct gatt_db_attribute’ has no member named ‘read_offset’; did you mean ‘read_offet’?
 2131 |  attrib->read_offset = offset;
      |          ^~~~~~~~~~~
      |          read_offet
make[1]: *** [Makefile:8622: src/shared/libshared_mainloop_la-gatt-db.lo] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:4691: all] Error 2
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:

##############################
Test: ScanBuild - FAIL
Desc: Run Scan Build
Output:

src/shared/gatt-db.c: In function ‘pending_read_result’:
src/shared/gatt-db.c:155:44: error: ‘struct gatt_db_attribute’ has no member named ‘read_offset’; did you mean ‘read_offet’?
  155 |  p->func(p->attrib, err, data + p->attrib->read_offset,
      |                                            ^~~~~~~~~~~
      |                                            read_offet
src/shared/gatt-db.c:156:24: error: ‘struct gatt_db_attribute’ has no member named ‘read_offset’; did you mean ‘read_offet’?
  156 |    length - p->attrib->read_offset, p->user_data);
      |                        ^~~~~~~~~~~
      |                        read_offet
src/shared/gatt-db.c: In function ‘gatt_db_attribute_read’:
src/shared/gatt-db.c:2131:10: error: ‘struct gatt_db_attribute’ has no member named ‘read_offset’; did you mean ‘read_offet’?
 2131 |  attrib->read_offset = offset;
      |          ^~~~~~~~~~~
      |          read_offet
make[1]: *** [Makefile:8622: src/shared/libshared_mainloop_la-gatt-db.lo] Error 1
make[1]: *** Waiting for unfinished jobs....
src/shared/gatt-client.c:451:21: warning: Use of memory after it is freed
        gatt_db_unregister(op->client->db, op->db_id);
                           ^~~~~~~~~~
src/shared/gatt-client.c:696:2: warning: Use of memory after it is freed
        discovery_op_complete(op, false, att_ecode);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:996:2: warning: Use of memory after it is freed
        discovery_op_complete(op, success, att_ecode);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1102:2: warning: Use of memory after it is freed
        discovery_op_complete(op, success, att_ecode);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1296:2: warning: Use of memory after it is freed
        discovery_op_complete(op, success, att_ecode);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1361:2: warning: Use of memory after it is freed
        discovery_op_complete(op, success, att_ecode);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1636:6: warning: Use of memory after it is freed
        if (read_db_hash(op)) {
            ^~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1641:2: warning: Use of memory after it is freed
        discover_all(op);
        ^~~~~~~~~~~~~~~~
src/shared/gatt-client.c:2147:6: warning: Use of memory after it is freed
        if (read_db_hash(op)) {
            ^~~~~~~~~~~~~~~~
src/shared/gatt-client.c:2155:8: warning: Use of memory after it is freed
                                                        discovery_op_ref(op),
                                                        ^~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:3244:2: warning: Use of memory after it is freed
        complete_write_long_op(req, success, 0, false);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:3266:2: warning: Use of memory after it is freed
        request_unref(req);
        ^~~~~~~~~~~~~~~~~~
12 warnings generated.
make: *** [Makefile:4691: all] Error 2


---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-05-27  7:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-27  7:12 [PATCH bluez] shared/gatt-db: Add read offset to record the progress of att read blob request Ye He via B4 Relay
2025-05-27  7:22 ` [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