linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ v1] test-vcp: Fix CCC value endianness
@ 2023-12-06 22:04 Luiz Augusto von Dentz
  2023-12-06 23:05 ` [BlueZ,v1] " bluez.test.bot
  2023-12-08 15:00 ` [PATCH BlueZ v1] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2023-12-06 22:04 UTC (permalink / raw)
  To: linux-bluetooth

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

CCC value is 2 octects long so it needs to be converted using
cpu_to_le16 in order to not fail in Big Endian architectures.
---
 unit/test-vcp.c | 21 ++++++---------------
 1 file changed, 6 insertions(+), 15 deletions(-)

diff --git a/unit/test-vcp.c b/unit/test-vcp.c
index ea1bc98766dd..2a08dca480b9 100644
--- a/unit/test-vcp.c
+++ b/unit/test-vcp.c
@@ -130,18 +130,10 @@ static void gatt_notify_cb(struct gatt_db_attribute *attrib,
 					struct bt_att *att, void *user_data)
 {
 	struct test_data *data = user_data;
-	struct notify notify;
-
-	memset(&notify, 0, sizeof(notify));
-
-	notify.handle = gatt_db_attribute_get_handle(attrib);
-	notify.ccc_handle = gatt_db_attribute_get_handle(ccc);
-	notify.value = (void *) value;
-	notify.len = len;
+	uint16_t handle = gatt_db_attribute_get_handle(attrib);
 
 	if (!bt_gatt_server_send_notification(data->server,
-			notify.handle, notify.value,
-			notify.len, false))
+			handle, value, len, false))
 		printf("%s: Failed to send notification\n", __func__);
 }
 
@@ -154,8 +146,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);
 
@@ -165,11 +156,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 test_server(const void *user_data)
-- 
2.43.0


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

* RE: [BlueZ,v1] test-vcp: Fix CCC value endianness
  2023-12-06 22:04 [PATCH BlueZ v1] test-vcp: Fix CCC value endianness Luiz Augusto von Dentz
@ 2023-12-06 23:05 ` bluez.test.bot
  2023-12-08 15:00 ` [PATCH BlueZ v1] " patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2023-12-06 23:05 UTC (permalink / raw)
  To: linux-bluetooth, luiz.dentz

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

---Test result---

Test Summary:
CheckPatch                    PASS      0.51 seconds
GitLint                       PASS      0.34 seconds
BuildEll                      PASS      24.01 seconds
BluezMake                     PASS      707.23 seconds
MakeCheck                     PASS      11.77 seconds
MakeDistcheck                 PASS      156.75 seconds
CheckValgrind                 PASS      216.20 seconds
CheckSmatch                   PASS      321.14 seconds
bluezmakeextell               PASS      101.28 seconds
IncrementalBuild              PASS      651.61 seconds
ScanBuild                     PASS      907.01 seconds



---
Regards,
Linux Bluetooth


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

* Re: [PATCH BlueZ v1] test-vcp: Fix CCC value endianness
  2023-12-06 22:04 [PATCH BlueZ v1] test-vcp: Fix CCC value endianness Luiz Augusto von Dentz
  2023-12-06 23:05 ` [BlueZ,v1] " bluez.test.bot
@ 2023-12-08 15:00 ` patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2023-12-08 15:00 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

Hello:

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

On Wed,  6 Dec 2023 17:04:30 -0500 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> CCC value is 2 octects long so it needs to be converted using
> cpu_to_le16 in order to not fail in Big Endian architectures.
> ---
>  unit/test-vcp.c | 21 ++++++---------------
>  1 file changed, 6 insertions(+), 15 deletions(-)

Here is the summary with links:
  - [BlueZ,v1] test-vcp: Fix CCC value endianness
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=71188eb0e752

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



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

end of thread, other threads:[~2023-12-08 15:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-06 22:04 [PATCH BlueZ v1] test-vcp: Fix CCC value endianness Luiz Augusto von Dentz
2023-12-06 23:05 ` [BlueZ,v1] " bluez.test.bot
2023-12-08 15:00 ` [PATCH BlueZ v1] " patchwork-bot+bluetooth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).