Linux bluetooth development
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ v1] test-rap: Fix gatt_ccc_read_cb on big-endian
Date: Thu, 14 May 2026 15:04:00 -0400	[thread overview]
Message-ID: <20260514190403.1568957-1-luiz.dentz@gmail.com> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=UTF-8, Size: 1367 bytes --]

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

Reading CCC values shall return little-endian 16 bits, not native
format.
---
 unit/test-rap.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/unit/test-rap.c b/unit/test-rap.c
index 4ca4a715edff..dce592187426 100644
--- a/unit/test-rap.c
+++ b/unit/test-rap.c
@@ -253,8 +253,7 @@ static void gatt_ccc_read_cb(struct gatt_db_attribute *attrib,
 	struct ccc_state *ccc;
 	uint16_t handle;
 	uint8_t ecode = 0;
-	const uint8_t *value = NULL;
-	size_t len = 0;
+	uint16_t value = 0;
 
 	handle = gatt_db_attribute_get_handle(attrib);
 
@@ -264,11 +263,11 @@ static void gatt_ccc_read_cb(struct gatt_db_attribute *attrib,
 		goto done;
 	}
 
-	len = sizeof(ccc->value);
-	value = (void *) &ccc->value;
+	value = cpu_to_le16(ccc->value);
 
 done:
-	gatt_db_attribute_read_result(attrib, id, ecode, value, len);
+	gatt_db_attribute_read_result(attrib, id, ecode, (void *)&value,
+							sizeof(value));
 }
 
 static void ras_attached(struct bt_rap *rap, void *user_data)
@@ -528,7 +527,7 @@ static void test_server(const void *user_data)
 	RAS_FIND_INFO
 
 /*
- * RAS/SR/RCO/BV-01-C – Characteristic Read: RAS Features
+ * RAS/SR/RCO/BV-01-C – Characteristic Read: RAS Features
  *
  *  ATT: Read Request (0x0a) len 2
  *       Handle: 0x0003 (RAS Features value handle)
-- 
2.53.0


                 reply	other threads:[~2026-05-14 19:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260514190403.1568957-1-luiz.dentz@gmail.com \
    --to=luiz.dentz@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox