[PATCH BlueZ] shared/bap: Fix handling of codec fields

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

 



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

Codec fields needs to be converted when codec.id is 0xff as the host
endian may not always be little endian.
---
 src/shared/bap.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/shared/bap.c b/src/shared/bap.c
index 55f61d91a3aa..cf5d810bbaf0 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -882,6 +882,12 @@ static void stream_notify_config(struct bt_bap_stream *stream)
 	put_le24(lpac->qos.ppd_min, config->ppd_min);
 	put_le24(lpac->qos.ppd_max, config->ppd_max);
 	config->codec = lpac->codec;
+
+	if (config->codec.id == 0x0ff) {
+		config->codec.vid = cpu_to_le16(config->codec.vid);
+		config->codec.cid = cpu_to_le16(config->codec.cid);
+	}
+
 	config->cc_len = stream->cc->iov_len;
 	memcpy(config->cc, stream->cc->iov_base, stream->cc->iov_len);
 
@@ -4347,6 +4353,11 @@ unsigned int bt_bap_stream_config(struct bt_bap_stream *stream,
 		config.phy = qos->ucast.io_qos.phy;
 		config.codec = stream->rpac->codec;
 
+		if (config.codec.id == 0xff) {
+			config.codec.cid = cpu_to_le16(config.codec.cid);
+			config.codec.vid = cpu_to_le16(config.codec.vid);
+		}
+
 		iov[0].iov_base = &config;
 		iov[0].iov_len = sizeof(config);
 
-- 
2.40.1




[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