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

[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 62a1c69..3209023 100644
--- a/android/avrcp-lib.c
+++ b/android/avrcp-lib.c
@@ -1762,16 +1762,23 @@ int avrcp_get_folder_items(struct avrcp *session, uint8_t scope,
 				uint32_t start, uint32_t end, uint8_t number,
 				uint32_t *attrs)
 {
-
 	uint8_t pdu[10 + number * sizeof(uint32_t)];
+	int i;
 
 	pdu[0] = scope;
 	put_be32(start, &pdu[1]);
 	put_be32(end, &pdu[5]);
 	pdu[9] = number;
 
-	memcpy(&pdu[10], attrs, number);
+	if (!number)
+		goto done;
 
+	for (i = 0; i < number; i++)
+		put_be32(attrs[i], &attrs[i]);
+
+	memcpy(&pdu[10], attrs, number * sizeof(*attrs));
+
+done:
 	return avrcp_send_browsing_req(session, AVRCP_GET_FOLDER_ITEMS,
 					pdu, sizeof(pdu),
 					get_folder_items_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