[PATCH BlueZ 2/3] android/avrcp-lib: Fix byte order in avrcp_get_item_attributes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

---
 android/avrcp-lib.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/android/avrcp-lib.c b/android/avrcp-lib.c
index d6459ce..62a1c69 100644
--- a/android/avrcp-lib.c
+++ b/android/avrcp-lib.c
@@ -1868,15 +1868,22 @@ int avrcp_get_item_attributes(struct avrcp *session, uint8_t scope,
 				uint32_t *attrs)
 {
 	uint8_t pdu[12 + number * sizeof(uint32_t)];
+	int i;
 
 	pdu[0] = scope;
 	put_be64(uid, &pdu[1]);
 	put_be16(counter, &pdu[9]);
 	pdu[11] = number;
 
-	if (number > 0)
-		memcpy(&pdu[12], attrs, number * sizeof(uint32_t));
+	if (!number)
+		goto done;
 
+	for (i = 0; i < number; i++)
+		put_be32(attrs[i], &attrs[i]);
+
+	memcpy(&pdu[12], attrs, number * sizeof(uint32_t));
+
+done:
 	return avrcp_send_browsing_req(session, AVRCP_GET_ITEM_ATTRIBUTES,
 					pdu, sizeof(pdu),
 					get_item_attributes_rsp, session);
-- 
1.9.0

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux