diff mbox series

[BlueZ,v2,3/6] btio: Check for non-zero qos before setting

Message ID 20240209164630.92208-4-andrei.istodorescu@nxp.com
State New
Headers show
Series Update Sink BASE management | expand

Commit Message

Andrei Istodorescu Feb. 9, 2024, 4:46 p.m. UTC
---
 btio/btio.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/btio/btio.c b/btio/btio.c
index d30cfcac73ee..5a07f91c7d61 100644
--- a/btio/btio.c
+++ b/btio/btio.c
@@ -5,7 +5,7 @@ 
  *
  *  Copyright (C) 2009-2010  Marcel Holtmann <marcel@holtmann.org>
  *  Copyright (C) 2009-2010  Nokia Corporation
- *  Copyright 2023 NXP
+ *  Copyright 2023-2024 NXP
  *
  *
  */
@@ -1981,7 +1981,9 @@  static GIOChannel *create_io(gboolean server, struct set_opts *opts,
 		if (!sco_set(sock, opts->mtu, opts->voice, err))
 			goto failed;
 		break;
-	case BT_IO_ISO:
+	case BT_IO_ISO: {
+		uint8_t zeroes[sizeof(opts->qos)] = {0};
+
 		sock = socket(PF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_ISO);
 		if (sock < 0) {
 			ERROR_FAILED(err, "socket(SEQPACKET, ISO)", errno);
@@ -1992,12 +1994,14 @@  static GIOChannel *create_io(gboolean server, struct set_opts *opts,
 				 &opts->dst, opts->dst_type, opts->bc_sid,
 				 opts->bc_num_bis, opts->bc_bis, err) < 0)
 			goto failed;
-		if (!iso_set_qos(sock, &opts->qos, err))
-			goto failed;
+		if (memcmp(&opts->qos, zeroes, sizeof(opts->qos)))
+			if (!iso_set_qos(sock, &opts->qos, err))
+				goto failed;
 		if (opts->base.base_len)
 			if (!iso_set_base(sock, &opts->base, err))
 				goto failed;
 		break;
+	}
 	case BT_IO_INVALID:
 	default:
 		g_set_error(err, BT_IO_ERROR, EINVAL,