2023-03-20 14:37:59

by Iulia Tanasescu

[permalink] [raw]
Subject: [PATCH BlueZ 0/8] Split bt_iso_qos into dedicated structures

This patch series updates the use of the bt_iso_qos structure,
which has been split into dedicated unicast and broadcast structures
as part of the Bluetooth kernel patch:
[PATCH] Split bt_iso_qos into dedicated structures.

This patch series depends on the Bluetooth kernel patch
[PATCH] Split bt_iso_qos into dedicated structures.

Iulia Tanasescu (8):
btio: Use unicast structure for ISO QoS options
client/player: Use unicast structure for ISO QoS options
emulator/bthost: pass unicast QoS structure to bthost_set_cig_params
lib: split bt_iso_qos into dedicated structures
profiles/audio/bap: Use unicast structure for ISO QoS options
tools/btiotest: Use unicast QoS structure for ISO io
tools/isotest: Use dedicated ISO QoS options for unicast and broadcast
tools/iso-tester: Use dedicated ISO QoS options for unicast and
broadcast

btio/btio.c | 20 ++--
client/player.c | 16 +--
emulator/bthost.c | 3 +-
emulator/bthost.h | 3 +-
lib/bluetooth.h | 50 +++++---
profiles/audio/bap.c | 13 ++-
tools/btiotest.c | 5 +-
tools/iso-tester.c | 270 ++++++++++++++++++++++++++++++++-----------
tools/isotest.c | 159 +++++++++++++++++++------
9 files changed, 395 insertions(+), 144 deletions(-)


base-commit: 806230e4fda7a2fafeb7f1da3d2f17a1bafb25f8
--
2.34.1



2023-03-20 14:38:13

by Iulia Tanasescu

[permalink] [raw]
Subject: [PATCH BlueZ 1/8] btio: Use unicast structure for ISO QoS options

Convert the generic bt_iso_qos structure into the dedicated unicast
structure for ISO QoS options.

---
btio/btio.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/btio/btio.c b/btio/btio.c
index 1ad42728d..017b53a54 100644
--- a/btio/btio.c
+++ b/btio/btio.c
@@ -5,6 +5,7 @@
*
* Copyright (C) 2009-2010 Marcel Holtmann <[email protected]>
* Copyright (C) 2009-2010 Nokia Corporation
+ * Copyright 2023 NXP
*
*
*/
@@ -68,7 +69,7 @@ struct set_opts {
int flushable;
uint32_t priority;
uint16_t voice;
- struct bt_iso_qos qos;
+ struct bt_iso_unicast_qos qos;
};

struct connect {
@@ -857,11 +858,11 @@ voice:
return TRUE;
}

-static gboolean iso_set(int sock, struct bt_iso_qos *qos, GError **err)
+static gboolean iso_set(int sock, struct bt_iso_unicast_qos *qos, GError **err)
{
- if (setsockopt(sock, SOL_BLUETOOTH, BT_ISO_QOS, qos,
+ if (setsockopt(sock, SOL_BLUETOOTH, BT_ISO_UNICAST_QOS, qos,
sizeof(*qos)) < 0) {
- ERROR_FAILED(err, "setsockopt(BT_ISO_QOS)", errno);
+ ERROR_FAILED(err, "setsockopt(BT_ISO_UNICAST_QOS)", errno);
return FALSE;
}

@@ -963,7 +964,7 @@ static gboolean parse_set_opts(struct set_opts *opts, GError **err,
opts->voice = va_arg(args, int);
break;
case BT_IO_OPT_QOS:
- opts->qos = *va_arg(args, struct bt_iso_qos *);
+ opts->qos = *va_arg(args, struct bt_iso_unicast_qos *);
break;
case BT_IO_OPT_INVALID:
case BT_IO_OPT_KEY_SIZE:
@@ -1570,14 +1571,15 @@ static gboolean iso_get(int sock, GError **err, BtIOOption opt1, va_list args)
{
BtIOOption opt = opt1;
struct sockaddr_iso src, dst;
- struct bt_iso_qos qos;
+ struct bt_iso_unicast_qos qos;
socklen_t len;
uint32_t phy;

len = sizeof(qos);
memset(&qos, 0, len);
- if (getsockopt(sock, SOL_BLUETOOTH, BT_ISO_QOS, &qos, &len) < 0) {
- ERROR_FAILED(err, "getsockopt(BT_ISO_QOS)", errno);
+ if (getsockopt(sock, SOL_BLUETOOTH, BT_ISO_UNICAST_QOS, &qos,
+ &len) < 0) {
+ ERROR_FAILED(err, "getsockopt(BT_ISO_UNICAST_QOS)", errno);
return FALSE;
}

@@ -1624,7 +1626,7 @@ static gboolean iso_get(int sock, GError **err, BtIOOption opt1, va_list args)
*(va_arg(args, uint32_t *)) = phy;
break;
case BT_IO_OPT_QOS:
- *(va_arg(args, struct bt_iso_qos *)) = qos;
+ *(va_arg(args, struct bt_iso_unicast_qos *)) = qos;
break;
case BT_IO_OPT_HANDLE:
case BT_IO_OPT_CLASS:
--
2.34.1


2023-03-20 14:38:20

by Iulia Tanasescu

[permalink] [raw]
Subject: [PATCH BlueZ 2/8] client/player: Use unicast structure for ISO QoS options

Convert the generic bt_iso_qos structure into the dedicated unicast
structure for ISO QoS options.

---
client/player.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/client/player.c b/client/player.c
index 63e11db09..83b6092a4 100644
--- a/client/player.c
+++ b/client/player.c
@@ -4,6 +4,7 @@
* BlueZ - Bluetooth protocol stack for Linux
*
* Copyright (C) 2020 Intel Corporation. All rights reserved.
+ * Copyright 2023 NXP
*
*
*/
@@ -3506,7 +3507,7 @@ static int transport_send_seq(struct transport *transport, int fd, uint32_t num)
static bool transport_timer_read(struct io *io, void *user_data)
{
struct transport *transport = user_data;
- struct bt_iso_qos qos;
+ struct bt_iso_unicast_qos qos;
socklen_t len;
int ret, fd;
uint32_t num;
@@ -3526,9 +3527,10 @@ static bool transport_timer_read(struct io *io, void *user_data)
/* Read QoS if available */
memset(&qos, 0, sizeof(qos));
len = sizeof(qos);
- if (getsockopt(transport->sk, SOL_BLUETOOTH, BT_ISO_QOS, &qos,
+ if (getsockopt(transport->sk, SOL_BLUETOOTH, BT_ISO_UNICAST_QOS, &qos,
&len) < 0) {
- bt_shell_printf("Failed to getsockopt(BT_ISO_QOS): %s (%d)\n",
+ bt_shell_printf("Failed to getsockopt(BT_ISO_UNICAST_QOS):"
+ "%s (%d)\n",
strerror(errno), -errno);
return false;
}
@@ -3552,7 +3554,7 @@ static bool transport_timer_read(struct io *io, void *user_data)
}

static int transport_send(struct transport *transport, int fd,
- struct bt_iso_qos *qos)
+ struct bt_iso_unicast_qos *qos)
{
struct itimerspec ts;
int timer_fd;
@@ -3591,7 +3593,7 @@ static void cmd_send_transport(int argc, char *argv[])
GDBusProxy *proxy;
struct transport *transport;
int fd = -1, err;
- struct bt_iso_qos qos;
+ struct bt_iso_unicast_qos qos;
socklen_t len;
int i;

@@ -3626,8 +3628,8 @@ static void cmd_send_transport(int argc, char *argv[])
/* Read QoS if available */
memset(&qos, 0, sizeof(qos));
len = sizeof(qos);
- if (getsockopt(transport->sk, SOL_BLUETOOTH, BT_ISO_QOS, &qos,
- &len) < 0)
+ if (getsockopt(transport->sk, SOL_BLUETOOTH,
+ BT_ISO_UNICAST_QOS, &qos, &len) < 0)
err = transport_send(transport, fd, NULL);
else
err = transport_send(transport, fd, &qos);
--
2.34.1


2023-03-20 14:38:53

by Iulia Tanasescu

[permalink] [raw]
Subject: [PATCH BlueZ 3/8] emulator/bthost: pass unicast QoS structure to bthost_set_cig_params

Update bthost_set_cig_params prototype to use the dedicated
unicast QoS structure.

---
emulator/bthost.c | 3 ++-
emulator/bthost.h | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/emulator/bthost.c b/emulator/bthost.c
index 4671fe17d..80e4a4963 100644
--- a/emulator/bthost.c
+++ b/emulator/bthost.c
@@ -5,6 +5,7 @@
*
* Copyright (C) 2011-2012 Intel Corporation
* Copyright (C) 2004-2010 Marcel Holtmann <[email protected]>
+ * Copyright 2023 NXP
*
*
*/
@@ -3171,7 +3172,7 @@ bool bthost_search_ext_adv_addr(struct bthost *bthost, const uint8_t *addr)
}

void bthost_set_cig_params(struct bthost *bthost, uint8_t cig_id,
- uint8_t cis_id, const struct bt_iso_qos *qos)
+ uint8_t cis_id, const struct bt_iso_unicast_qos *qos)
{
struct bt_hci_cmd_le_set_cig_params *cp;

diff --git a/emulator/bthost.h b/emulator/bthost.h
index 92182687f..68aef62be 100644
--- a/emulator/bthost.h
+++ b/emulator/bthost.h
@@ -5,6 +5,7 @@
*
* Copyright (C) 2011-2012 Intel Corporation
* Copyright (C) 2004-2010 Marcel Holtmann <[email protected]>
+ * Copyright 2023 NXP
*
*
*/
@@ -106,7 +107,7 @@ void bthost_create_big(struct bthost *bthost, uint8_t num_bis);
bool bthost_search_ext_adv_addr(struct bthost *bthost, const uint8_t *addr);

void bthost_set_cig_params(struct bthost *bthost, uint8_t cig_id,
- uint8_t cis_id, const struct bt_iso_qos *qos);
+ uint8_t cis_id, const struct bt_iso_unicast_qos *qos);
void bthost_create_cis(struct bthost *bthost, uint16_t cis_handle,
uint16_t acl_handle);

--
2.34.1


2023-03-20 14:38:59

by Iulia Tanasescu

[permalink] [raw]
Subject: [PATCH BlueZ 4/8] lib: split bt_iso_qos into dedicated structures

Split bt_iso_qos into dedicated unicast and broadcast structures.

---
lib/bluetooth.h | 50 +++++++++++++++++++++++++++++++++++--------------
1 file changed, 36 insertions(+), 14 deletions(-)

diff --git a/lib/bluetooth.h b/lib/bluetooth.h
index af5fbcfbc..d365d681a 100644
--- a/lib/bluetooth.h
+++ b/lib/bluetooth.h
@@ -6,6 +6,7 @@
* Copyright (C) 2000-2001 Qualcomm Incorporated
* Copyright (C) 2002-2003 Maxim Krasnyansky <[email protected]>
* Copyright (C) 2002-2010 Marcel Holtmann <[email protected]>
+ * Copyright 2023 NXP
*
*
*/
@@ -141,11 +142,17 @@ struct bt_voice {

#define BT_SCM_PKT_STATUS 0x03

-#define BT_ISO_QOS 17
+#define BT_ISO_UNICAST_QOS 17

#define BT_ISO_QOS_CIG_UNSET 0xff
#define BT_ISO_QOS_CIS_UNSET 0xff

+#define BT_ISO_BCAST_SINK_QOS 18
+#define BT_ISO_BCAST_SOURCE_QOS 19
+
+#define BT_ISO_QOS_BIG_UNSET 0xff
+#define BT_ISO_QOS_BIS_UNSET 0xff
+
struct bt_iso_io_qos {
uint32_t interval;
uint16_t latency;
@@ -154,25 +161,40 @@ struct bt_iso_io_qos {
uint8_t rtn;
};

-struct bt_iso_qos {
- union {
- uint8_t cig;
- uint8_t big;
- };
- union {
- uint8_t cis;
- uint8_t bis;
- };
- union {
- uint8_t sca;
- uint8_t sync_interval;
- };
+struct bt_iso_unicast_qos {
+ uint8_t cig;
+ uint8_t cis;
+ uint8_t sca;
uint8_t packing;
uint8_t framing;
struct bt_iso_io_qos in;
struct bt_iso_io_qos out;
};

+struct bt_iso_bcast_sink_qos {
+ uint8_t options;
+ uint16_t skip;
+ uint16_t sync_timeout;
+ uint8_t sync_cte_type;
+ uint8_t big;
+ uint8_t encryption;
+ uint8_t bcode[16];
+ uint8_t mse;
+ uint16_t timeout;
+ struct bt_iso_io_qos in;
+};
+
+struct bt_iso_bcast_source_qos {
+ uint8_t sync_interval;
+ uint8_t big;
+ uint8_t bis;
+ uint8_t packing;
+ uint8_t framing;
+ uint8_t encryption;
+ uint8_t bcode[16];
+ struct bt_iso_io_qos out;
+};
+
#define BT_CODEC 19
struct bt_codec {
uint8_t id;
--
2.34.1


2023-03-20 14:39:13

by Iulia Tanasescu

[permalink] [raw]
Subject: [PATCH BlueZ 5/8] profiles/audio/bap: Use unicast structure for ISO QoS options

Convert the generic bt_iso_qos structure into the dedicated unicast
structure for ISO QoS options.

---
profiles/audio/bap.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
index dfdf87255..49003d351 100644
--- a/profiles/audio/bap.c
+++ b/profiles/audio/bap.c
@@ -4,6 +4,7 @@
* BlueZ - Bluetooth protocol stack for Linux
*
* Copyright (C) 2022 Intel Corporation. All rights reserved.
+ * Copyright 2023 NXP
*
*
*/
@@ -741,7 +742,7 @@ static void bap_iso_qos(struct bt_bap_qos *qos, struct bt_iso_io_qos *io)
static bool match_stream_qos(const void *data, const void *user_data)
{
const struct bt_bap_stream *stream = data;
- const struct bt_iso_qos *iso_qos = user_data;
+ const struct bt_iso_unicast_qos *iso_qos = user_data;
struct bt_bap_qos *qos;

qos = bt_bap_stream_get_qos((void *)stream);
@@ -756,7 +757,7 @@ static void iso_confirm_cb(GIOChannel *io, void *user_data)
{
struct bap_data *data = user_data;
struct bt_bap_stream *stream;
- struct bt_iso_qos qos;
+ struct bt_iso_unicast_qos qos;
char address[18];
GError *err = NULL;

@@ -882,7 +883,7 @@ static void bap_connect_io_cb(GIOChannel *chan, GError *err, gpointer user_data)

static void bap_connect_io(struct bap_data *data, struct bap_ep *ep,
struct bt_bap_stream *stream,
- struct bt_iso_qos *qos, int defer)
+ struct bt_iso_unicast_qos *qos, int defer)
{
struct btd_adapter *adapter = device_get_adapter(data->device);
GIOChannel *io;
@@ -939,7 +940,7 @@ static void bap_connect_io(struct bap_data *data, struct bap_ep *ep,
}

static void bap_listen_io(struct bap_data *data, struct bt_bap_stream *stream,
- struct bt_iso_qos *qos)
+ struct bt_iso_unicast_qos *qos)
{
struct btd_adapter *adapter = device_get_adapter(data->device);
GIOChannel *io;
@@ -974,7 +975,7 @@ static void bap_create_io(struct bap_data *data, struct bap_ep *ep,
struct bt_bap_stream *stream, int defer)
{
struct bt_bap_qos *qos[2] = {};
- struct bt_iso_qos iso_qos;
+ struct bt_iso_unicast_qos iso_qos;

DBG("ep %p stream %p defer %s", ep, stream, defer ? "true" : "false");

@@ -1178,7 +1179,7 @@ static void bap_connecting(struct bt_bap_stream *stream, bool state, int fd,
/* Attempt to get CIG/CIS if they have not been set */
if (ep->qos.cig_id == BT_ISO_QOS_CIG_UNSET ||
ep->qos.cis_id == BT_ISO_QOS_CIS_UNSET) {
- struct bt_iso_qos qos;
+ struct bt_iso_unicast_qos qos;
GError *err = NULL;

if (!bt_io_get(io, &err, BT_IO_OPT_QOS, &qos,
--
2.34.1


2023-03-20 14:39:29

by Iulia Tanasescu

[permalink] [raw]
Subject: [PATCH BlueZ 6/8] tools/btiotest: Use unicast QoS structure for ISO io

Convert the generic bt_iso_qos structure into the dedicated unicast
structure for ISO QoS options.

---
tools/btiotest.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/btiotest.c b/tools/btiotest.c
index 193e1395b..dd2c132ca 100644
--- a/tools/btiotest.c
+++ b/tools/btiotest.c
@@ -5,6 +5,7 @@
*
* Copyright (C) 2009-2010 Marcel Holtmann <[email protected]>
* Copyright (C) 2009-2010 Nokia Corporation
+ * Copyright 2023 NXP
*
*
*/
@@ -38,7 +39,7 @@ static int opt_update_sec = 0;
.rtn = 2, \
}

-struct bt_iso_qos qos = {
+struct bt_iso_unicast_qos qos = {
.cig = BT_ISO_QOS_CIG_UNSET,
.cis = BT_ISO_QOS_CIG_UNSET,
.sca = 0x07,
@@ -55,7 +56,7 @@ struct io_data {
int disconn;
int accept;
int voice;
- struct bt_iso_qos *qos;
+ struct bt_iso_unicast_qos *qos;
};

static void io_data_unref(struct io_data *data)
--
2.34.1


2023-03-20 14:39:43

by Iulia Tanasescu

[permalink] [raw]
Subject: [PATCH BlueZ 7/8] tools/isotest: Use dedicated ISO QoS options for unicast and broadcast

Convert the generic bt_iso_qos structure into dedicated ISO QoS structures
for unicast or broadcast.

---
tools/isotest.c | 159 +++++++++++++++++++++++++++++++++++++-----------
1 file changed, 125 insertions(+), 34 deletions(-)

diff --git a/tools/isotest.c b/tools/isotest.c
index 2b5f164de..f12658812 100644
--- a/tools/isotest.c
+++ b/tools/isotest.c
@@ -4,6 +4,7 @@
* BlueZ - Bluetooth protocol stack for Linux
*
* Copyright (C) 2022 Intel Corporation.
+ * Copyright 2023 NXP
*
*/

@@ -68,7 +69,7 @@ static int sndbuf;
static struct timeval sndto;
static bool quiet;

-struct bt_iso_qos *iso_qos;
+struct bt_iso_unicast_qos *iso_qos;
static bool inout;

struct lookup_table {
@@ -239,38 +240,94 @@ fail:
return err < 0 ? err : 0;
}

-static void print_qos(int sk, struct sockaddr_iso *addr)
+static void print_unicast_qos(int sk)
{
- struct bt_iso_qos qos;
+ struct bt_iso_unicast_qos qos;
socklen_t len;

/* Read Out QOS */
memset(&qos, 0, sizeof(qos));
len = sizeof(qos);

- if (getsockopt(sk, SOL_BLUETOOTH, BT_ISO_QOS, &qos, &len) < 0) {
+ if (getsockopt(sk, SOL_BLUETOOTH, BT_ISO_UNICAST_QOS, &qos, &len) < 0) {
syslog(LOG_ERR, "Can't get QoS socket option: %s (%d)",
strerror(errno), errno);
return;
}

- if (!bacmp(&addr->iso_bdaddr, BDADDR_ANY)) {
- syslog(LOG_INFO, "QoS BIG 0x%02x BIS 0x%02x Packing 0x%02x "
- "Framing 0x%02x]", qos.big, qos.bis, qos.packing,
- qos.framing);
- } else {
- syslog(LOG_INFO, "QoS CIG 0x%02x CIS 0x%02x Packing 0x%02x "
- "Framing 0x%02x]", qos.cig, qos.cis, qos.packing,
- qos.framing);
- syslog(LOG_INFO, "Input QoS [Interval %u us Latency %u "
- "ms SDU %u PHY 0x%02x RTN %u]", qos.in.interval,
- qos.in.latency, qos.in.sdu, qos.in.phy, qos.in.rtn);
+ syslog(LOG_INFO, "QoS CIG 0x%02x CIS 0x%02x Packing 0x%02x "
+ "Framing 0x%02x]", qos.cig, qos.cis, qos.packing,
+ qos.framing);
+ syslog(LOG_INFO, "Input QoS [Interval %u us Latency %u "
+ "ms SDU %u PHY 0x%02x RTN %u]", qos.in.interval,
+ qos.in.latency, qos.in.sdu, qos.in.phy, qos.in.rtn);
+
+ syslog(LOG_INFO, "Output QoS [Interval %u us Latency %u "
+ "ms SDU %u PHY 0x%02x RTN %u]", qos.out.interval,
+ qos.out.latency, qos.out.sdu, qos.out.phy, qos.out.rtn);
+}
+
+static void print_bcast_source_qos(int sk)
+{
+ struct bt_iso_bcast_source_qos qos;
+ socklen_t len;
+
+ /* Read Out QOS */
+ memset(&qos, 0, sizeof(qos));
+ len = sizeof(qos);
+
+ if (getsockopt(sk, SOL_BLUETOOTH, BT_ISO_BCAST_SOURCE_QOS,
+ &qos, &len) < 0) {
+ syslog(LOG_ERR, "Can't get QoS socket option: %s (%d)",
+ strerror(errno), errno);
+ return;
}
+
+ syslog(LOG_INFO, "QoS BIG 0x%02x BIS 0x%02x Packing 0x%02x "
+ "Framing 0x%02x]", qos.big, qos.bis, qos.packing,
+ qos.framing);
+
syslog(LOG_INFO, "Output QoS [Interval %u us Latency %u "
"ms SDU %u PHY 0x%02x RTN %u]", qos.out.interval,
qos.out.latency, qos.out.sdu, qos.out.phy, qos.out.rtn);
}

+static void print_bcast_sink_qos(int sk)
+{
+ struct bt_iso_bcast_sink_qos qos;
+ socklen_t len;
+
+ /* Read Out QOS */
+ memset(&qos, 0, sizeof(qos));
+ len = sizeof(qos);
+
+ if (getsockopt(sk, SOL_BLUETOOTH, BT_ISO_BCAST_SINK_QOS,
+ &qos, &len) < 0) {
+ syslog(LOG_ERR, "Can't get QoS socket option: %s (%d)",
+ strerror(errno), errno);
+ return;
+ }
+
+ syslog(LOG_INFO, "QoS BIG 0x%02x", qos.big);
+
+ syslog(LOG_INFO, "Input QoS [Interval %u us Latency %u "
+ "ms SDU %u PHY 0x%02x RTN %u]", qos.in.interval,
+ qos.in.latency, qos.in.sdu, qos.in.phy, qos.in.rtn);
+}
+
+static void unicast_qos_to_bcast_source(struct bt_iso_unicast_qos *unicast_qos,
+ struct bt_iso_bcast_source_qos *source_qos)
+{
+ memset(source_qos, 0, sizeof(*source_qos));
+
+ source_qos->sync_interval = unicast_qos->sca;
+ source_qos->big = unicast_qos->cig;
+ source_qos->bis = unicast_qos->cis;
+ source_qos->packing = unicast_qos->packing;
+ source_qos->framing = unicast_qos->framing;
+ source_qos->out = unicast_qos->out;
+}
+
static int do_connect(char *peer)
{
struct sockaddr_iso addr;
@@ -306,11 +363,25 @@ static int do_connect(char *peer)
iso_qos->in.sdu = 0;
}

- if (setsockopt(sk, SOL_BLUETOOTH, BT_ISO_QOS, iso_qos,
- sizeof(*iso_qos)) < 0) {
- syslog(LOG_ERR, "Can't set QoS socket option: "
+ if (!strcmp(peer, "00:00:00:00:00:00")) {
+ struct bt_iso_bcast_source_qos source_qos;
+
+ unicast_qos_to_bcast_source(iso_qos, &source_qos);
+
+ if (setsockopt(sk, SOL_BLUETOOTH,
+ BT_ISO_BCAST_SOURCE_QOS, &source_qos,
+ sizeof(source_qos)) < 0) {
+ syslog(LOG_ERR, "Can't set QoS socket option: "
"%s (%d)", strerror(errno), errno);
- goto error;
+ goto error;
+ }
+ } else {
+ if (setsockopt(sk, SOL_BLUETOOTH, BT_ISO_UNICAST_QOS,
+ iso_qos, sizeof(*iso_qos)) < 0) {
+ syslog(LOG_ERR, "Can't set QoS socket option: "
+ "%s (%d)", strerror(errno), errno);
+ goto error;
+ }
}
}

@@ -338,7 +409,10 @@ static int do_connect(char *peer)

syslog(LOG_INFO, "Connected [%s]", peer);

- print_qos(sk, &addr);
+ if (!strcmp(peer, "00:00:00:00:00:00"))
+ print_bcast_source_qos(sk);
+ else
+ print_unicast_qos(sk);

return sk;

@@ -441,7 +515,10 @@ static void do_listen(char *filename, void (*handler)(int fd, int sk),
ba2str(&addr->iso_bdaddr, ba);
syslog(LOG_INFO, "Connected [%s]", ba);

- print_qos(nsk, addr);
+ if (peer)
+ print_bcast_sink_qos(nsk);
+ else
+ print_unicast_qos(nsk);

/* Handle deferred setup */
if (defer_setup) {
@@ -648,7 +725,7 @@ static int read_file(int fd, ssize_t count, bool rewind)
return len;
}

-static void do_send(int sk, int fd, struct bt_iso_qos *qos, uint32_t num,
+static void do_send(int sk, int fd, struct bt_iso_io_qos *out, uint32_t num,
bool repeat)
{
uint32_t seq;
@@ -662,14 +739,14 @@ static void do_send(int sk, int fd, struct bt_iso_qos *qos, uint32_t num,

for (seq = 0; ; seq++) {
if (fd >= 0) {
- len = read_file(fd, qos->out.sdu, repeat);
+ len = read_file(fd, out->sdu, repeat);
if (len < 0) {
syslog(LOG_ERR, "read failed: %s (%d)",
strerror(-len), -len);
exit(1);
}
} else
- len = qos->out.sdu;
+ len = out->sdu;

len = send(sk, buf, len, 0);
if (len <= 0) {
@@ -686,16 +763,22 @@ static void do_send(int sk, int fd, struct bt_iso_qos *qos, uint32_t num,
seq, len, used / len, used);

if (seq && !((seq + 1) % num))
- send_wait(&t_start, num * qos->out.interval);
+ send_wait(&t_start, num * out->interval);
}
}

static void send_mode(char *filename, char *peer, int i, bool repeat)
{
- struct bt_iso_qos qos;
+ struct bt_iso_io_qos *out;
socklen_t len;
int sk, fd = -1;
uint32_t num;
+ int optname;
+
+ union {
+ struct bt_iso_bcast_source_qos source_qos;
+ struct bt_iso_unicast_qos unicast_qos;
+ } qos;

if (filename) {
char altername[PATH_MAX];
@@ -728,16 +811,24 @@ static void send_mode(char *filename, char *peer, int i, bool repeat)
syslog(LOG_INFO, "Sending ...");

/* Read QoS */
+ if (!strcmp(peer, "00:00:00:00:00:00")) {
+ optname = BT_ISO_BCAST_SOURCE_QOS;
+ out = &qos.source_qos.out;
+ } else {
+ optname = BT_ISO_UNICAST_QOS;
+ out = &qos.unicast_qos.out;
+ }
+
memset(&qos, 0, sizeof(qos));
len = sizeof(qos);
- if (getsockopt(sk, SOL_BLUETOOTH, BT_ISO_QOS, &qos, &len) < 0) {
+ if (getsockopt(sk, SOL_BLUETOOTH, optname, &qos, &len) < 0) {
syslog(LOG_ERR, "Can't get Output QoS socket option: %s (%d)",
strerror(errno), errno);
- qos.out.sdu = ISO_DEFAULT_MTU;
+ out->sdu = ISO_DEFAULT_MTU;
}

/* num of packets = latency (ms) / interval (us) */
- num = (qos.out.latency * 1000 / qos.out.interval);
+ num = (out->latency * 1000 / out->interval);

syslog(LOG_INFO, "Number of packets: %d", num);

@@ -746,8 +837,8 @@ static void send_mode(char *filename, char *peer, int i, bool repeat)
* latency:
* jitter buffer = 2 * (SDU * subevents)
*/
- sndbuf = 2 * ((qos.out.latency * 1000 / qos.out.interval) *
- qos.out.sdu);
+ sndbuf = 2 * ((out->latency * 1000 / out->interval) *
+ out->sdu);

len = sizeof(sndbuf);
if (setsockopt(sk, SOL_SOCKET, SO_SNDBUF, &sndbuf, len) < 0) {
@@ -768,10 +859,10 @@ static void send_mode(char *filename, char *peer, int i, bool repeat)
}
}

- for (i = 6; i < qos.out.sdu; i++)
+ for (i = 6; i < out->sdu; i++)
buf[i] = 0x7f;

- do_send(sk, fd, &qos, num, repeat);
+ do_send(sk, fd, out, num, repeat);
}

static void reconnect_mode(char *peer)
@@ -844,7 +935,7 @@ static void multy_connect_mode(char *peer)
static struct qos_preset {
const char *name;
bool inout;
- struct bt_iso_qos qos;
+ struct bt_iso_unicast_qos qos;
} presets[] = {
/* QoS Configuration settings for low latency audio data */
QOS_PRESET("8_1_1", true, 7500, 8, 26, 0x02, 2),
--
2.34.1


2023-03-20 14:40:07

by Iulia Tanasescu

[permalink] [raw]
Subject: [PATCH BlueZ 8/8] tools/iso-tester: Use dedicated ISO QoS options for unicast and broadcast

Convert the generic bt_iso_qos structure into dedicated ISO QoS structures
for unicast or broadcast.

---
tools/iso-tester.c | 270 +++++++++++++++++++++++++++++++++------------
1 file changed, 200 insertions(+), 70 deletions(-)

diff --git a/tools/iso-tester.c b/tools/iso-tester.c
index e4582573a..a763c6a09 100644
--- a/tools/iso-tester.c
+++ b/tools/iso-tester.c
@@ -4,6 +4,7 @@
* BlueZ - Bluetooth protocol stack for Linux
*
* Copyright (C) 2022 Intel Corporation.
+ * Copyright 2023 NXP
*
*/

@@ -119,10 +120,52 @@
#define QOS_48_5_2 QOS_OUT(7500, 75, 117, 0x02, 13)
#define QOS_48_6_2 QOS_OUT(10000, 100, 155, 0x02, 13)

-#define QOS_OUT_16_2_1 QOS_OUT(10000, 10, 40, 0x02, 2)
-#define QOS_OUT_1_16_2_1 QOS_OUT_1(10000, 10, 40, 0x02, 2)
-#define QOS_OUT_1_1_16_2_1 QOS_OUT_1_1(10000, 10, 40, 0x02, 2)
-#define QOS_IN_16_2_1 QOS_IN(10000, 10, 40, 0x02, 2)
+#define QOS_SINK_FULL(_big, _in) \
+{ \
+ .options = 0x00, \
+ .skip = 0x0000, \
+ .sync_timeout = 0x4000, \
+ .sync_cte_type = 0x00, \
+ .big = _big, \
+ .encryption = 0x00, \
+ .bcode = {0}, \
+ .mse = 0x00, \
+ .timeout = 0x4000, \
+ .in = _in, \
+}
+
+#define QOS_SOURCE_FULL(_big, _bis, _out) \
+{ \
+ .sync_interval = 0x07, \
+ .big = _big, \
+ .bis = _bis, \
+ .packing = 0x00, \
+ .framing = 0x00, \
+ .encryption = 0x00, \
+ .bcode = {0}, \
+ .out = _out, \
+}
+
+#define BCAST_QOS_OUT(_interval, _latency, _sdu, _phy, _rtn) \
+ QOS_SOURCE_FULL(BT_ISO_QOS_BIG_UNSET, BT_ISO_QOS_BIS_UNSET, \
+ QOS_IO(_interval, _latency, _sdu, _phy, _rtn))
+
+#define BCAST_QOS_OUT_1(_interval, _latency, _sdu, _phy, _rtn) \
+ QOS_SOURCE_FULL(0x01, BT_ISO_QOS_BIS_UNSET, \
+ QOS_IO(_interval, _latency, _sdu, _phy, _rtn))
+
+#define BCAST_QOS_OUT_1_1(_interval, _latency, _sdu, _phy, _rtn) \
+ QOS_SOURCE_FULL(0x01, 0x01, \
+ QOS_IO(_interval, _latency, _sdu, _phy, _rtn))
+
+#define BCAST_QOS_IN(_interval, _latency, _sdu, _phy, _rtn) \
+ QOS_SINK_FULL(BT_ISO_QOS_BIG_UNSET, \
+ QOS_IO(_interval, _latency, _sdu, _phy, _rtn))
+
+#define QOS_OUT_16_2_1 BCAST_QOS_OUT(10000, 10, 40, 0x02, 2)
+#define QOS_OUT_1_16_2_1 BCAST_QOS_OUT_1(10000, 10, 40, 0x02, 2)
+#define QOS_OUT_1_1_16_2_1 BCAST_QOS_OUT_1_1(10000, 10, 40, 0x02, 2)
+#define QOS_IN_16_2_1 BCAST_QOS_IN(10000, 10, 40, 0x02, 2)

struct test_data {
const void *test_data;
@@ -141,7 +184,9 @@ struct test_data {
};

struct iso_client_data {
- struct bt_iso_qos qos;
+ struct bt_iso_unicast_qos unicast_qos;
+ struct bt_iso_bcast_sink_qos sink_qos;
+ struct bt_iso_bcast_source_qos source_qos;
int expect_err;
const struct iovec *send;
const struct iovec *recv;
@@ -369,182 +414,182 @@ static void test_data_free(void *test_data)
test_iso_full(name, data, setup, func, 1, reason)

static const struct iso_client_data connect_8_1_1 = {
- .qos = QOS_8_1_1,
+ .unicast_qos = QOS_8_1_1,
.expect_err = 0
};

static const struct iso_client_data connect_8_2_1 = {
- .qos = QOS_8_2_1,
+ .unicast_qos = QOS_8_2_1,
.expect_err = 0
};

static const struct iso_client_data connect_16_1_1 = {
- .qos = QOS_16_1_1,
+ .unicast_qos = QOS_16_1_1,
.expect_err = 0
};

static const struct iso_client_data connect_16_2_1 = {
- .qos = QOS_16_2_1,
+ .unicast_qos = QOS_16_2_1,
.expect_err = 0
};

static const struct iso_client_data connect_1_16_2_1 = {
- .qos = QOS_1_16_2_1,
+ .unicast_qos = QOS_1_16_2_1,
.expect_err = 0
};

static const struct iso_client_data connect_1_1_16_2_1 = {
- .qos = QOS_1_1_16_2_1,
+ .unicast_qos = QOS_1_1_16_2_1,
.expect_err = 0
};

static const struct iso_client_data connect_24_1_1 = {
- .qos = QOS_24_1_1,
+ .unicast_qos = QOS_24_1_1,
.expect_err = 0
};

static const struct iso_client_data connect_24_2_1 = {
- .qos = QOS_24_2_1,
+ .unicast_qos = QOS_24_2_1,
.expect_err = 0
};

static const struct iso_client_data connect_32_1_1 = {
- .qos = QOS_32_1_1,
+ .unicast_qos = QOS_32_1_1,
.expect_err = 0
};

static const struct iso_client_data connect_32_2_1 = {
- .qos = QOS_32_2_1,
+ .unicast_qos = QOS_32_2_1,
.expect_err = 0
};

static const struct iso_client_data connect_44_1_1 = {
- .qos = QOS_44_1_1,
+ .unicast_qos = QOS_44_1_1,
.expect_err = 0
};

static const struct iso_client_data connect_44_2_1 = {
- .qos = QOS_44_2_1,
+ .unicast_qos = QOS_44_2_1,
.expect_err = 0
};

static const struct iso_client_data connect_48_1_1 = {
- .qos = QOS_48_1_1,
+ .unicast_qos = QOS_48_1_1,
.expect_err = 0
};

static const struct iso_client_data connect_48_2_1 = {
- .qos = QOS_48_2_1,
+ .unicast_qos = QOS_48_2_1,
.expect_err = 0
};

static const struct iso_client_data connect_48_3_1 = {
- .qos = QOS_48_3_1,
+ .unicast_qos = QOS_48_3_1,
.expect_err = 0
};

static const struct iso_client_data connect_48_4_1 = {
- .qos = QOS_48_4_1,
+ .unicast_qos = QOS_48_4_1,
.expect_err = 0
};

static const struct iso_client_data connect_48_5_1 = {
- .qos = QOS_48_5_1,
+ .unicast_qos = QOS_48_5_1,
.expect_err = 0
};

static const struct iso_client_data connect_48_6_1 = {
- .qos = QOS_48_6_1,
+ .unicast_qos = QOS_48_6_1,
.expect_err = 0
};

static const struct iso_client_data connect_8_1_2 = {
- .qos = QOS_8_1_2,
+ .unicast_qos = QOS_8_1_2,
.expect_err = 0
};

static const struct iso_client_data connect_8_2_2 = {
- .qos = QOS_8_2_2,
+ .unicast_qos = QOS_8_2_2,
.expect_err = 0
};

static const struct iso_client_data connect_16_1_2 = {
- .qos = QOS_16_1_2,
+ .unicast_qos = QOS_16_1_2,
.expect_err = 0
};

static const struct iso_client_data connect_16_2_2 = {
- .qos = QOS_16_2_2,
+ .unicast_qos = QOS_16_2_2,
.expect_err = 0
};

static const struct iso_client_data connect_24_1_2 = {
- .qos = QOS_24_1_2,
+ .unicast_qos = QOS_24_1_2,
.expect_err = 0
};

static const struct iso_client_data connect_24_2_2 = {
- .qos = QOS_24_2_2,
+ .unicast_qos = QOS_24_2_2,
.expect_err = 0
};

static const struct iso_client_data connect_32_1_2 = {
- .qos = QOS_32_1_2,
+ .unicast_qos = QOS_32_1_2,
.expect_err = 0
};

static const struct iso_client_data connect_32_2_2 = {
- .qos = QOS_32_2_2,
+ .unicast_qos = QOS_32_2_2,
.expect_err = 0
};

static const struct iso_client_data connect_44_1_2 = {
- .qos = QOS_44_1_2,
+ .unicast_qos = QOS_44_1_2,
.expect_err = 0
};

static const struct iso_client_data connect_44_2_2 = {
- .qos = QOS_44_2_2,
+ .unicast_qos = QOS_44_2_2,
.expect_err = 0
};

static const struct iso_client_data connect_48_1_2 = {
- .qos = QOS_48_1_2,
+ .unicast_qos = QOS_48_1_2,
.expect_err = 0
};

static const struct iso_client_data connect_48_2_2 = {
- .qos = QOS_48_2_2,
+ .unicast_qos = QOS_48_2_2,
.expect_err = 0
};

static const struct iso_client_data connect_48_3_2 = {
- .qos = QOS_48_3_2,
+ .unicast_qos = QOS_48_3_2,
.expect_err = 0
};

static const struct iso_client_data connect_48_4_2 = {
- .qos = QOS_48_4_2,
+ .unicast_qos = QOS_48_4_2,
.expect_err = 0
};

static const struct iso_client_data connect_48_5_2 = {
- .qos = QOS_48_5_2,
+ .unicast_qos = QOS_48_5_2,
.expect_err = 0
};

static const struct iso_client_data connect_48_6_2 = {
- .qos = QOS_48_6_2,
+ .unicast_qos = QOS_48_6_2,
.expect_err = 0
};

static const struct iso_client_data connect_invalid = {
- .qos = QOS(0, 0, 0, 0, 0),
+ .unicast_qos = QOS(0, 0, 0, 0, 0),
.expect_err = -EINVAL
};

static const struct iso_client_data connect_reject = {
- .qos = QOS_16_1_2,
+ .unicast_qos = QOS_16_1_2,
.expect_err = -ENOSYS
};

@@ -561,20 +606,20 @@ static const struct iovec send_48_2_1 = {
};

static const struct iso_client_data connect_16_2_1_send = {
- .qos = QOS_16_2_1,
+ .unicast_qos = QOS_16_2_1,
.expect_err = 0,
.send = &send_16_2_1,
};

static const struct iso_client_data listen_16_2_1_recv = {
- .qos = QOS_16_2_1,
+ .unicast_qos = QOS_16_2_1,
.expect_err = 0,
.recv = &send_16_2_1,
.server = true,
};

static const struct iso_client_data listen_16_2_1_recv_ts = {
- .qos = QOS_16_2_1,
+ .unicast_qos = QOS_16_2_1,
.expect_err = 0,
.recv = &send_16_2_1,
.server = true,
@@ -582,27 +627,27 @@ static const struct iso_client_data listen_16_2_1_recv_ts = {
};

static const struct iso_client_data defer_16_2_1 = {
- .qos = QOS_16_2_1,
+ .unicast_qos = QOS_16_2_1,
.expect_err = 0,
.defer = true,
};

static const struct iso_client_data connect_16_2_1_defer_send = {
- .qos = QOS_16_2_1,
+ .unicast_qos = QOS_16_2_1,
.expect_err = 0,
.send = &send_16_2_1,
.defer = true,
};

static const struct iso_client_data connect_48_2_1_defer_send = {
- .qos = QOS_48_2_1,
+ .unicast_qos = QOS_48_2_1,
.expect_err = 0,
.send = &send_16_2_1,
.defer = true,
};

static const struct iso_client_data listen_16_2_1_defer_recv = {
- .qos = QOS_16_2_1,
+ .unicast_qos = QOS_16_2_1,
.expect_err = 0,
.recv = &send_16_2_1,
.server = true,
@@ -610,7 +655,7 @@ static const struct iso_client_data listen_16_2_1_defer_recv = {
};

static const struct iso_client_data listen_48_2_1_defer_recv = {
- .qos = QOS_48_2_1,
+ .unicast_qos = QOS_48_2_1,
.expect_err = 0,
.recv = &send_48_2_1,
.server = true,
@@ -618,7 +663,7 @@ static const struct iso_client_data listen_48_2_1_defer_recv = {
};

static const struct iso_client_data listen_16_2_1_defer_reject = {
- .qos = QOS_16_2_1,
+ .unicast_qos = QOS_16_2_1,
.expect_err = -1,
.recv = &send_16_2_1,
.server = true,
@@ -626,50 +671,51 @@ static const struct iso_client_data listen_16_2_1_defer_reject = {
};

static const struct iso_client_data connect_16_2_1_send_recv = {
- .qos = QOS_16_2_1,
+ .unicast_qos = QOS_16_2_1,
.expect_err = 0,
.send = &send_16_2_1,
.recv = &send_16_2_1,
};

static const struct iso_client_data disconnect_16_2_1 = {
- .qos = QOS_16_2_1,
+ .unicast_qos = QOS_16_2_1,
.expect_err = 0,
.disconnect = true,
};

static const struct iso_client_data reconnect_16_2_1 = {
- .qos = QOS_16_2_1,
+ .unicast_qos = QOS_16_2_1,
.expect_err = 0,
.disconnect = true,
};

static const struct iso_client_data bcast_16_2_1_send = {
- .qos = QOS_OUT_16_2_1,
+ .source_qos = QOS_OUT_16_2_1,
.expect_err = 0,
.send = &send_16_2_1,
.bcast = true,
};

static const struct iso_client_data bcast_1_16_2_1_send = {
- .qos = QOS_OUT_1_16_2_1,
+ .source_qos = QOS_OUT_1_16_2_1,
.expect_err = 0,
.send = &send_16_2_1,
.bcast = true,
};

static const struct iso_client_data bcast_1_1_16_2_1_send = {
- .qos = QOS_OUT_1_1_16_2_1,
+ .source_qos = QOS_OUT_1_1_16_2_1,
.expect_err = 0,
.send = &send_16_2_1,
.bcast = true,
};

static const struct iso_client_data bcast_16_2_1_recv = {
- .qos = QOS_IN_16_2_1,
+ .sink_qos = QOS_IN_16_2_1,
.expect_err = 0,
.recv = &send_16_2_1,
.bcast = true,
+ .server = true,
};

static void client_connectable_complete(uint16_t opcode, uint8_t status,
@@ -854,7 +900,7 @@ static void test_getsockopt(const void *test_data)
{
int sk, err;
socklen_t len;
- struct bt_iso_qos qos;
+ struct bt_iso_unicast_qos qos;

sk = socket(PF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_ISO);
if (sk < 0) {
@@ -867,7 +913,7 @@ static void test_getsockopt(const void *test_data)
len = sizeof(qos);
memset(&qos, 0, len);

- err = getsockopt(sk, SOL_BLUETOOTH, BT_ISO_QOS, &qos, &len);
+ err = getsockopt(sk, SOL_BLUETOOTH, BT_ISO_UNICAST_QOS, &qos, &len);
if (err < 0) {
tester_warn("Can't get socket option : %s (%d)",
strerror(errno), errno);
@@ -885,7 +931,7 @@ static void test_setsockopt(const void *test_data)
{
int sk, err;
socklen_t len;
- struct bt_iso_qos qos = QOS_16_1_2;
+ struct bt_iso_unicast_qos qos = QOS_16_1_2;

sk = socket(PF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_ISO);
if (sk < 0) {
@@ -895,7 +941,8 @@ static void test_setsockopt(const void *test_data)
goto end;
}

- err = setsockopt(sk, SOL_BLUETOOTH, BT_ISO_QOS, &qos, sizeof(qos));
+ err = setsockopt(sk, SOL_BLUETOOTH, BT_ISO_UNICAST_QOS,
+ &qos, sizeof(qos));
if (err < 0) {
tester_warn("Can't set socket option : %s (%d)",
strerror(errno), errno);
@@ -906,7 +953,7 @@ static void test_setsockopt(const void *test_data)
len = sizeof(qos);
memset(&qos, 0, len);

- err = getsockopt(sk, SOL_BLUETOOTH, BT_ISO_QOS, &qos, &len);
+ err = getsockopt(sk, SOL_BLUETOOTH, BT_ISO_UNICAST_QOS, &qos, &len);
if (err < 0) {
tester_warn("Can't get socket option : %s (%d)",
strerror(errno), errno);
@@ -1004,8 +1051,14 @@ static int connect_iso_sock(struct test_data *data, uint8_t num, int sk)
}
}

- err = setsockopt(sk, SOL_BLUETOOTH, BT_ISO_QOS, &isodata->qos,
- sizeof(isodata->qos));
+ if (!isodata->bcast)
+ err = setsockopt(sk, SOL_BLUETOOTH, BT_ISO_UNICAST_QOS,
+ &isodata->unicast_qos, sizeof(isodata->unicast_qos));
+ else {
+ err = setsockopt(sk, SOL_BLUETOOTH, BT_ISO_BCAST_SOURCE_QOS,
+ &isodata->source_qos, sizeof(isodata->source_qos));
+ }
+
if (err < 0) {
tester_warn("Can't set socket BT_ISO_QOS option : %s (%d)",
strerror(errno), errno);
@@ -1080,8 +1133,8 @@ static bool check_io_qos(const struct bt_iso_io_qos *io1,
return true;
}

-static bool check_qos(const struct bt_iso_qos *qos1,
- const struct bt_iso_qos *qos2)
+static bool check_unicast_qos(const struct bt_iso_unicast_qos *qos1,
+ const struct bt_iso_unicast_qos *qos2)
{
if (qos1->cig != BT_ISO_QOS_CIG_UNSET &&
qos2->cig != BT_ISO_QOS_CIG_UNSET &&
@@ -1124,6 +1177,62 @@ static bool check_qos(const struct bt_iso_qos *qos1,
return true;
}

+static bool check_bcast_source_qos(const struct bt_iso_bcast_source_qos *qos1,
+ const struct bt_iso_bcast_source_qos *qos2)
+{
+ if (qos1->sync_interval != qos2->sync_interval) {
+ tester_warn("Unexpected QoS sync interval: 0x%02x != 0x%02x",
+ qos1->sync_interval, qos2->sync_interval);
+ return false;
+ }
+
+ if (qos1->big != BT_ISO_QOS_BIG_UNSET &&
+ qos2->big != BT_ISO_QOS_BIG_UNSET &&
+ qos1->big != qos2->big) {
+ tester_warn("Unexpected BIG ID: 0x%02x != 0x%02x",
+ qos1->big, qos2->big);
+ return false;
+ }
+
+ if (qos1->bis != BT_ISO_QOS_BIS_UNSET &&
+ qos2->bis != BT_ISO_QOS_BIS_UNSET &&
+ qos1->bis != qos2->bis) {
+ tester_warn("Unexpected BIS ID: 0x%02x != 0x%02x",
+ qos1->bis, qos2->bis);
+ return false;
+ }
+
+ if (qos1->packing != qos2->packing) {
+ tester_warn("Unexpected QoS packing: 0x%02x != 0x%02x",
+ qos1->packing, qos2->packing);
+ return false;
+ }
+
+ if (qos1->framing != qos2->framing) {
+ tester_warn("Unexpected QoS framing: 0x%02x != 0x%02x",
+ qos1->framing, qos2->framing);
+ return false;
+ }
+
+ if (qos1->encryption != qos2->encryption) {
+ tester_warn("Unexpected QoS encryption: 0x%02x != 0x%02x",
+ qos1->encryption, qos2->encryption);
+ return false;
+ }
+
+ if (memcmp(qos1->bcode, qos2->bcode, sizeof(qos1->bcode))) {
+ tester_warn("Unexpected QoS Broadcast Code");
+ return false;
+ }
+
+ if (!check_io_qos(&qos1->out, &qos2->out)) {
+ tester_warn("Unexpected Output QoS");
+ return false;
+ }
+
+ return true;
+}
+
static gboolean iso_recv_data(GIOChannel *io, GIOCondition cond,
gpointer user_data)
{
@@ -1249,14 +1358,28 @@ static gboolean iso_connect(GIOChannel *io, GIOCondition cond,
const struct iso_client_data *isodata = data->test_data;
int err, sk_err, sk;
socklen_t len;
- struct bt_iso_qos qos;
+ int optname;
+ bool ret = true;
+
+ union {
+ struct bt_iso_unicast_qos unicast_qos;
+ struct bt_iso_bcast_sink_qos sink_qos;
+ struct bt_iso_bcast_source_qos source_qos;
+ } qos;

sk = g_io_channel_unix_get_fd(io);

+ if (!isodata->bcast)
+ optname = BT_ISO_UNICAST_QOS;
+ else if (isodata->server)
+ optname = BT_ISO_BCAST_SINK_QOS;
+ else
+ optname = BT_ISO_BCAST_SOURCE_QOS;
+
len = sizeof(qos);
memset(&qos, 0, len);

- err = getsockopt(sk, SOL_BLUETOOTH, BT_ISO_QOS, &qos, &len);
+ err = getsockopt(sk, SOL_BLUETOOTH, optname, &qos, &len);
if (err < 0) {
tester_warn("Can't get socket option : %s (%d)",
strerror(errno), errno);
@@ -1264,7 +1387,14 @@ static gboolean iso_connect(GIOChannel *io, GIOCondition cond,
return FALSE;
}

- if (!check_qos(&qos, &isodata->qos)) {
+ if (!isodata->bcast)
+ ret = check_unicast_qos(&qos.unicast_qos,
+ &isodata->unicast_qos);
+ else if (!isodata->server)
+ ret = check_bcast_source_qos(&qos.source_qos,
+ &isodata->source_qos);
+
+ if (!ret) {
tester_warn("Unexpected QoS parameter");
tester_test_failed();
return FALSE;
@@ -1579,7 +1709,7 @@ static void setup_listen(struct test_data *data, uint8_t num, GIOFunc func)
client = hciemu_get_client(data->hciemu, 0);
host = hciemu_client_host(client);

- bthost_set_cig_params(host, 0x01, 0x01, &isodata->qos);
+ bthost_set_cig_params(host, 0x01, 0x01, &isodata->unicast_qos);
bthost_create_cis(host, 257, data->acl_handle);
}
}
--
2.34.1


2023-03-20 15:16:48

by bluez.test.bot

[permalink] [raw]
Subject: RE: Split bt_iso_qos into dedicated structures

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=731872

---Test result---

Test Summary:
CheckPatch PASS 0.75 seconds
GitLint PASS 0.46 seconds
BuildEll PASS 28.31 seconds
BluezMake FAIL 77.31 seconds
MakeCheck FAIL 5.39 seconds
MakeDistcheck FAIL 51.41 seconds
CheckValgrind FAIL 59.55 seconds
CheckSmatch FAIL 158.92 seconds
bluezmakeextell FAIL 44.20 seconds
IncrementalBuild FAIL 688.93 seconds
ScanBuild FAIL 680.61 seconds

Details
##############################
Test: BluezMake - FAIL
Desc: Build BlueZ
Output:

tools/mgmt-tester.c: In function ‘main’:
tools/mgmt-tester.c:12514:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
12514 | int main(int argc, char *argv[])
| ^~~~
btio/btio.c:72:28: error: field ‘qos’ has incomplete type
72 | struct bt_iso_unicast_qos qos;
| ^~~
btio/btio.c: In function ‘iso_set’:
btio/btio.c:863:38: error: ‘BT_ISO_UNICAST_QOS’ undeclared (first use in this function)
863 | if (setsockopt(sock, SOL_BLUETOOTH, BT_ISO_UNICAST_QOS, qos,
| ^~~~~~~~~~~~~~~~~~
btio/btio.c:863:38: note: each undeclared identifier is reported only once for each function it appears in
btio/btio.c:864:12: error: dereferencing pointer to incomplete type ‘struct bt_iso_unicast_qos’
864 | sizeof(*qos)) < 0) {
| ^~~~
btio/btio.c: In function ‘iso_get’:
btio/btio.c:1574:28: error: storage size of ‘qos’ isn’t known
1574 | struct bt_iso_unicast_qos qos;
| ^~~
btio/btio.c:1580:38: error: ‘BT_ISO_UNICAST_QOS’ undeclared (first use in this function)
1580 | if (getsockopt(sock, SOL_BLUETOOTH, BT_ISO_UNICAST_QOS, &qos,
| ^~~~~~~~~~~~~~~~~~
btio/btio.c:1574:28: error: unused variable ‘qos’ [-Werror=unused-variable]
1574 | struct bt_iso_unicast_qos qos;
| ^~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:8630: btio/android_avdtptest-btio.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:4506: all] Error 2
##############################
Test: MakeCheck - FAIL
Desc: Run Bluez Make Check
Output:

client/player.c: In function ‘transport_timer_read’:
client/player.c:3510:28: error: storage size of ‘qos’ isn’t known
3510 | struct bt_iso_unicast_qos qos;
| ^~~
client/player.c:3530:47: error: ‘BT_ISO_UNICAST_QOS’ undeclared (first use in this function)
3530 | if (getsockopt(transport->sk, SOL_BLUETOOTH, BT_ISO_UNICAST_QOS, &qos,
| ^~~~~~~~~~~~~~~~~~
client/player.c:3530:47: note: each undeclared identifier is reported only once for each function it appears in
client/player.c:3510:28: error: unused variable ‘qos’ [-Werror=unused-variable]
3510 | struct bt_iso_unicast_qos qos;
| ^~~
client/player.c: At top level:
client/player.c:3557:13: error: ‘struct bt_iso_unicast_qos’ declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
3557 | struct bt_iso_unicast_qos *qos)
| ^~~~~~~~~~~~~~~~~~
client/player.c: In function ‘transport_send’:
client/player.c:3575:27: error: dereferencing pointer to incomplete type ‘struct bt_iso_unicast_qos’
3575 | ts.it_value.tv_nsec = qos->out.latency * 1000000;
| ^~
client/player.c: In function ‘cmd_send_transport’:
client/player.c:3596:28: error: storage size of ‘qos’ isn’t known
3596 | struct bt_iso_unicast_qos qos;
| ^~~
client/player.c:3632:5: error: ‘BT_ISO_UNICAST_QOS’ undeclared (first use in this function)
3632 | BT_ISO_UNICAST_QOS, &qos, &len) < 0)
| ^~~~~~~~~~~~~~~~~~
client/player.c:3596:28: error: unused variable ‘qos’ [-Werror=unused-variable]
3596 | struct bt_iso_unicast_qos qos;
| ^~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:7591: client/player.o] Error 1
make: *** [Makefile:11779: check] Error 2
##############################
Test: MakeDistcheck - FAIL
Desc: Run Bluez Make Distcheck
Output:

../../btio/btio.c:72:28: error: field ‘qos’ has incomplete type
72 | struct bt_iso_unicast_qos qos;
| ^~~
../../btio/btio.c: In function ‘iso_set’:
../../btio/btio.c:863:38: error: ‘BT_ISO_UNICAST_QOS’ undeclared (first use in this function)
863 | if (setsockopt(sock, SOL_BLUETOOTH, BT_ISO_UNICAST_QOS, qos,
| ^~~~~~~~~~~~~~~~~~
../../btio/btio.c:863:38: note: each undeclared identifier is reported only once for each function it appears in
../../btio/btio.c:864:12: error: dereferencing pointer to incomplete type ‘struct bt_iso_unicast_qos’
864 | sizeof(*qos)) < 0) {
| ^~~~
../../btio/btio.c: In function ‘iso_get’:
../../btio/btio.c:1574:28: error: storage size of ‘qos’ isn’t known
1574 | struct bt_iso_unicast_qos qos;
| ^~~
../../btio/btio.c:1580:38: error: ‘BT_ISO_UNICAST_QOS’ undeclared (first use in this function)
1580 | if (getsockopt(sock, SOL_BLUETOOTH, BT_ISO_UNICAST_QOS, &qos,
| ^~~~~~~~~~~~~~~~~~
make[2]: *** [Makefile:8630: btio/android_avdtptest-btio.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [Makefile:4506: all] Error 2
make: *** [Makefile:11700: distcheck] Error 1
##############################
Test: CheckValgrind - FAIL
Desc: Run Bluez Make Check with Valgrind
Output:

tools/mgmt-tester.c: In function ‘main’:
tools/mgmt-tester.c:12514:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
12514 | int main(int argc, char *argv[])
| ^~~~
btio/btio.c:72:28: error: field ‘qos’ has incomplete type
72 | struct bt_iso_unicast_qos qos;
| ^~~
btio/btio.c: In function ‘iso_set’:
btio/btio.c:863:38: error: ‘BT_ISO_UNICAST_QOS’ undeclared (first use in this function)
863 | if (setsockopt(sock, SOL_BLUETOOTH, BT_ISO_UNICAST_QOS, qos,
| ^~~~~~~~~~~~~~~~~~
btio/btio.c:863:38: note: each undeclared identifier is reported only once for each function it appears in
btio/btio.c:864:12: error: dereferencing pointer to incomplete type ‘struct bt_iso_unicast_qos’
864 | sizeof(*qos)) < 0) {
| ^~~~
btio/btio.c: In function ‘iso_get’:
btio/btio.c:1574:28: error: storage size of ‘qos’ isn’t known
1574 | struct bt_iso_unicast_qos qos;
| ^~~
btio/btio.c:1580:38: error: ‘BT_ISO_UNICAST_QOS’ undeclared (first use in this function)
1580 | if (getsockopt(sock, SOL_BLUETOOTH, BT_ISO_UNICAST_QOS, &qos,
| ^~~~~~~~~~~~~~~~~~
btio/btio.c:1574:28: error: unused variable ‘qos’ [-Werror=unused-variable]
1574 | struct bt_iso_unicast_qos qos;
| ^~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:8630: btio/android_avdtptest-btio.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:11779: check] Error 2
##############################
Test: CheckSmatch - FAIL
Desc: Run smatch tool with source
Output:

src/shared/crypto.c:271:21: warning: Variable length array is used.
src/shared/crypto.c:272:23: warning: Variable length array is used.
src/shared/gatt-helpers.c:768:31: warning: Variable length array is used.
src/shared/gatt-helpers.c:830:31: warning: Variable length array is used.
src/shared/gatt-helpers.c:1323:31: warning: Variable length array is used.
src/shared/gatt-helpers.c:1354:23: warning: Variable length array is used.
src/shared/gatt-server.c:275:25: warning: Variable length array is used.
src/shared/gatt-server.c:618:25: warning: Variable length array is used.
src/shared/gatt-server.c:717:25: warning: Variable length array is used.
src/shared/shell.c: note: in included file (through /usr/include/readline/readline.h):
/usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function'
/usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction'
/usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction'
/usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction'
src/shared/shell.c:609:21: warning: non-ANSI function declaration of function 'bt_shell_usage'
src/shared/crypto.c:271:21: warning: Variable length array is used.
src/shared/crypto.c:272:23: warning: Variable length array is used.
src/shared/gatt-helpers.c:768:31: warning: Variable length array is used.
src/shared/gatt-helpers.c:830:31: warning: Variable length array is used.
src/shared/gatt-helpers.c:1323:31: warning: Variable length array is used.
src/shared/gatt-helpers.c:1354:23: warning: Variable length array is used.
src/shared/gatt-server.c:275:25: warning: Variable length array is used.
src/shared/gatt-server.c:618:25: warning: Variable length array is used.
src/shared/gatt-server.c:717:25: warning: Variable length array is used.
src/shared/shell.c: note: in included file (through /usr/include/readline/readline.h):
/usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function'
/usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction'
/usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction'
/usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction'
src/shared/shell.c:609:21: warning: non-ANSI function declaration of function 'bt_shell_usage'
tools/mesh-cfgtest.c:1453:17: warning: unknown escape sequence: '\%'
tools/sco-tester.c: note: in included file:
./lib/bluetooth.h:186:15: warning: array of flexible structures
./lib/bluetooth.h:191:31: warning: array of flexible structures
tools/bneptest.c:634:39: warning: unknown escape sequence: '\%'
tools/seq2bseq.c:57:26: warning: Variable length array is used.
tools/obex-client-tool.c: note: in included file (through /usr/include/readline/readline.h):
/usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function'
/usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction'
/usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction'
/usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction'
android/avctp.c:505:34: warning: Variable length array is used.
android/avctp.c:556:34: warning: Variable length array is used.
unit/test-avrcp.c:373:26: warning: Variable length array is used.
unit/test-avrcp.c:398:26: warning: Variable length array is used.
unit/test-avrcp.c:414:24: warning: Variable length array is used.
android/avrcp-lib.c:1085:34: warning: Variable length array is used.
android/avrcp-lib.c:1583:34: warning: Variable length array is used.
android/avrcp-lib.c:1612:34: warning: Variable length array is used.
android/avrcp-lib.c:1638:34: warning: Variable length array is used.
profiles/input/device.c:165:26: warning: Variable length array is used.
btio/btio.c:72:28: error: field ‘qos’ has incomplete type
72 | struct bt_iso_unicast_qos qos;
| ^~~
btio/btio.c: In function ‘iso_set’:
btio/btio.c:863:38: error: ‘BT_ISO_UNICAST_QOS’ undeclared (first use in this function)
863 | if (setsockopt(sock, SOL_BLUETOOTH, BT_ISO_UNICAST_QOS, qos,
| ^~~~~~~~~~~~~~~~~~
btio/btio.c:863:38: note: each undeclared identifier is reported only once for each function it appears in
btio/btio.c:864:12: error: dereferencing pointer to incomplete type ‘struct bt_iso_unicast_qos’
864 | sizeof(*qos)) < 0) {
| ^~~~
btio/btio.c: In function ‘iso_get’:
btio/btio.c:1574:28: error: storage size of ‘qos’ isn’t known
1574 | struct bt_iso_unicast_qos qos;
| ^~~
btio/btio.c:1580:38: error: ‘BT_ISO_UNICAST_QOS’ undeclared (first use in this function)
1580 | if (getsockopt(sock, SOL_BLUETOOTH, BT_ISO_UNICAST_QOS, &qos,
| ^~~~~~~~~~~~~~~~~~
btio/btio.c:1574:28: error: unused variable ‘qos’ [-Werror=unused-variable]
1574 | struct bt_iso_unicast_qos qos;
| ^~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:10380: btio/bluetoothd-btio.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:4506: all] Error 2
##############################
Test: bluezmakeextell - FAIL
Desc: Build Bluez with External ELL
Output:

btio/btio.c:72:28: error: field ‘qos’ has incomplete type
72 | struct bt_iso_unicast_qos qos;
| ^~~
btio/btio.c: In function ‘iso_set’:
btio/btio.c:863:38: error: ‘BT_ISO_UNICAST_QOS’ undeclared (first use in this function)
863 | if (setsockopt(sock, SOL_BLUETOOTH, BT_ISO_UNICAST_QOS, qos,
| ^~~~~~~~~~~~~~~~~~
btio/btio.c:863:38: note: each undeclared identifier is reported only once for each function it appears in
btio/btio.c:864:12: error: dereferencing pointer to incomplete type ‘struct bt_iso_unicast_qos’
864 | sizeof(*qos)) < 0) {
| ^~~~
btio/btio.c: In function ‘iso_get’:
btio/btio.c:1574:28: error: storage size of ‘qos’ isn’t known
1574 | struct bt_iso_unicast_qos qos;
| ^~~
btio/btio.c:1580:38: error: ‘BT_ISO_UNICAST_QOS’ undeclared (first use in this function)
1580 | if (getsockopt(sock, SOL_BLUETOOTH, BT_ISO_UNICAST_QOS, &qos,
| ^~~~~~~~~~~~~~~~~~
btio/btio.c:1574:28: error: unused variable ‘qos’ [-Werror=unused-variable]
1574 | struct bt_iso_unicast_qos qos;
| ^~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:10380: btio/bluetoothd-btio.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:4506: all] Error 2
##############################
Test: IncrementalBuild - FAIL
Desc: Incremental build with the patches in the series
Output:
[BlueZ,1/8] btio: Use unicast structure for ISO QoS options

tools/mgmt-tester.c: In function ‘main’:
tools/mgmt-tester.c:12514:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
12514 | int main(int argc, char *argv[])
| ^~~~
unit/test-avdtp.c: In function ‘main’:
unit/test-avdtp.c:766:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
766 | int main(int argc, char *argv[])
| ^~~~
unit/test-avrcp.c: In function ‘main’:
unit/test-avrcp.c:989:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
989 | int main(int argc, char *argv[])
| ^~~~
btio/btio.c:72:28: error: field ‘qos’ has incomplete type
72 | struct bt_iso_unicast_qos qos;
| ^~~
btio/btio.c: In function ‘iso_set’:
btio/btio.c:863:38: error: ‘BT_ISO_UNICAST_QOS’ undeclared (first use in this function)
863 | if (setsockopt(sock, SOL_BLUETOOTH, BT_ISO_UNICAST_QOS, qos,
| ^~~~~~~~~~~~~~~~~~
btio/btio.c:863:38: note: each undeclared identifier is reported only once for each function it appears in
btio/btio.c:864:12: error: dereferencing pointer to incomplete type ‘struct bt_iso_unicast_qos’
864 | sizeof(*qos)) < 0) {
| ^~~~
btio/btio.c: In function ‘iso_get’:
btio/btio.c:1574:28: error: storage size of ‘qos’ isn’t known
1574 | struct bt_iso_unicast_qos qos;
| ^~~
btio/btio.c:1580:38: error: ‘BT_ISO_UNICAST_QOS’ undeclared (first use in this function)
1580 | if (getsockopt(sock, SOL_BLUETOOTH, BT_ISO_UNICAST_QOS, &qos,
| ^~~~~~~~~~~~~~~~~~
btio/btio.c:1574:28: error: unused variable ‘qos’ [-Werror=unused-variable]
1574 | struct bt_iso_unicast_qos qos;
| ^~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:10380: btio/bluetoothd-btio.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:4506: all] Error 2
##############################
Test: ScanBuild - FAIL
Desc: Run Scan Build
Output:

src/shared/ad.c:369:19: warning: Use of zero-allocated memory
buf[(*pos)++] = ad_type;
^
1 warning generated.
src/shared/gatt-client.c:451:21: warning: Use of memory after it is freed
gatt_db_unregister(op->client->db, op->db_id);
^~~~~~~~~~
src/shared/gatt-client.c:696:2: warning: Use of memory after it is freed
discovery_op_complete(op, false, att_ecode);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:993:2: warning: Use of memory after it is freed
discovery_op_complete(op, success, att_ecode);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1099:2: warning: Use of memory after it is freed
discovery_op_complete(op, success, att_ecode);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1291:2: warning: Use of memory after it is freed
discovery_op_complete(op, success, att_ecode);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1356:2: warning: Use of memory after it is freed
discovery_op_complete(op, success, att_ecode);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1631:6: warning: Use of memory after it is freed
if (read_db_hash(op)) {
^~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1636:2: warning: Use of memory after it is freed
discover_all(op);
^~~~~~~~~~~~~~~~
src/shared/gatt-client.c:2140:6: warning: Use of memory after it is freed
if (read_db_hash(op)) {
^~~~~~~~~~~~~~~~
src/shared/gatt-client.c:2148:8: warning: Use of memory after it is freed
discovery_op_ref(op),
^~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:3236:2: warning: Use of memory after it is freed
complete_write_long_op(req, success, 0, false);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:3258:2: warning: Use of memory after it is freed
request_unref(req);
^~~~~~~~~~~~~~~~~~
12 warnings generated.
src/shared/shell.c:1180:13: warning: Access to field 'options' results in a dereference of a null pointer (loaded from variable 'opt')
if (c != opt->options[index - offset].val) {
^~~~~~~~~~~~
1 warning generated.
src/shared/ad.c:369:19: warning: Use of zero-allocated memory
buf[(*pos)++] = ad_type;
^
1 warning generated.
src/shared/gatt-client.c:451:21: warning: Use of memory after it is freed
gatt_db_unregister(op->client->db, op->db_id);
^~~~~~~~~~
src/shared/gatt-client.c:696:2: warning: Use of memory after it is freed
discovery_op_complete(op, false, att_ecode);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:993:2: warning: Use of memory after it is freed
discovery_op_complete(op, success, att_ecode);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1099:2: warning: Use of memory after it is freed
discovery_op_complete(op, success, att_ecode);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1291:2: warning: Use of memory after it is freed
discovery_op_complete(op, success, att_ecode);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1356:2: warning: Use of memory after it is freed
discovery_op_complete(op, success, att_ecode);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1631:6: warning: Use of memory after it is freed
if (read_db_hash(op)) {
^~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1636:2: warning: Use of memory after it is freed
discover_all(op);
^~~~~~~~~~~~~~~~
src/shared/gatt-client.c:2140:6: warning: Use of memory after it is freed
if (read_db_hash(op)) {
^~~~~~~~~~~~~~~~
src/shared/gatt-client.c:2148:8: warning: Use of memory after it is freed
discovery_op_ref(op),
^~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:3236:2: warning: Use of memory after it is freed
complete_write_long_op(req, success, 0, false);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:3258:2: warning: Use of memory after it is freed
request_unref(req);
^~~~~~~~~~~~~~~~~~
12 warnings generated.
src/shared/shell.c:1180:13: warning: Access to field 'options' results in a dereference of a null pointer (loaded from variable 'opt')
if (c != opt->options[index - offset].val) {
^~~~~~~~~~~~
1 warning generated.
tools/hciattach.c:816:7: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n'
if ((n = read_hci_event(fd, resp, 10)) < 0) {
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/hciattach.c:864:7: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n'
if ((n = read_hci_event(fd, resp, 4)) < 0) {
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/hciattach.c:886:8: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n'
if ((n = read_hci_event(fd, resp, 10)) < 0) {
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/hciattach.c:908:7: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n'
if ((n = read_hci_event(fd, resp, 4)) < 0) {
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/hciattach.c:929:7: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n'
if ((n = read_hci_event(fd, resp, 4)) < 0) {
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/hciattach.c:973:7: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n'
if ((n = read_hci_event(fd, resp, 6)) < 0) {
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
6 warnings generated.
src/oui.c:50:2: warning: Value stored to 'hwdb' is never read
hwdb = udev_hwdb_unref(hwdb);
^ ~~~~~~~~~~~~~~~~~~~~~
src/oui.c:53:2: warning: Value stored to 'udev' is never read
udev = udev_unref(udev);
^ ~~~~~~~~~~~~~~~~
2 warnings generated.
tools/hcidump.c:180:9: warning: Potential leak of memory pointed to by 'dp'
if (fds[i].fd == sock)
^~~
tools/hcidump.c:248:17: warning: Assigned value is garbage or undefined
dh->ts_sec = htobl(frm.ts.tv_sec);
^ ~~~~~~~~~~~~~~~~~~~~
tools/hcidump.c:326:9: warning: 1st function call argument is an uninitialized value
if (be32toh(dp.flags) & 0x02) {
^~~~~~~~~~~~~~~~~
/usr/include/endian.h:46:22: note: expanded from macro 'be32toh'
# define be32toh(x) __bswap_32 (x)
^~~~~~~~~~~~~~
tools/hcidump.c:341:20: warning: 1st function call argument is an uninitialized value
frm.data_len = be32toh(dp.len);
^~~~~~~~~~~~~~~
/usr/include/endian.h:46:22: note: expanded from macro 'be32toh'
# define be32toh(x) __bswap_32 (x)
^~~~~~~~~~~~~~
tools/hcidump.c:346:14: warning: 1st function call argument is an uninitialized value
opcode = be32toh(dp.flags) & 0xffff;
^~~~~~~~~~~~~~~~~
/usr/include/endian.h:46:22: note: expanded from macro 'be32toh'
# define be32toh(x) __bswap_32 (x)
^~~~~~~~~~~~~~
tools/hcidump.c:384:17: warning: Assigned value is garbage or undefined
frm.data_len = btohs(dh.len);
^ ~~~~~~~~~~~~~
tools/hcidump.c:394:11: warning: Assigned value is garbage or undefined
frm.len = frm.data_len;
^ ~~~~~~~~~~~~
tools/hcidump.c:398:9: warning: 1st function call argument is an uninitialized value
ts = be64toh(ph.ts);
^~~~~~~~~~~~~~
/usr/include/endian.h:51:22: note: expanded from macro 'be64toh'
# define be64toh(x) __bswap_64 (x)
^~~~~~~~~~~~~~
tools/hcidump.c:403:13: warning: 1st function call argument is an uninitialized value
frm.in = be32toh(dp.flags) & 0x01;
^~~~~~~~~~~~~~~~~
/usr/include/endian.h:46:22: note: expanded from macro 'be32toh'
# define be32toh(x) __bswap_32 (x)
^~~~~~~~~~~~~~
tools/hcidump.c:408:11: warning: Assigned value is garbage or undefined
frm.in = dh.in;
^ ~~~~~
tools/hcidump.c:437:7: warning: Null pointer passed to 1st parameter expecting 'nonnull'
fd = open(file, open_flags, 0644);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
11 warnings generated.
tools/rfcomm.c:228:3: warning: Value stored to 'i' is never read
i = execvp(cmdargv[0], cmdargv);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/rfcomm.c:228:7: warning: Null pointer passed to 1st parameter expecting 'nonnull'
i = execvp(cmdargv[0], cmdargv);
^~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/rfcomm.c:348:8: warning: Although the value stored to 'fd' is used in the enclosing expression, the value is never actually read from 'fd'
if ((fd = open(devname, O_RDONLY | O_NOCTTY)) < 0) {
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/rfcomm.c:491:14: warning: Assigned value is garbage or undefined
req.channel = raddr.rc_channel;
^ ~~~~~~~~~~~~~~~~
tools/rfcomm.c:509:8: warning: Although the value stored to 'fd' is used in the enclosing expression, the value is never actually read from 'fd'
if ((fd = open(devname, O_RDONLY | O_NOCTTY)) < 0) {
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 warnings generated.
src/sdp-xml.c:126:10: warning: Assigned value is garbage or undefined
buf[1] = data[i + 1];
^ ~~~~~~~~~~~
src/sdp-xml.c:300:11: warning: Assigned value is garbage or undefined
buf[1] = data[i + 1];
^ ~~~~~~~~~~~
src/sdp-xml.c:338:11: warning: Assigned value is garbage or undefined
buf[1] = data[i + 1];
^ ~~~~~~~~~~~
3 warnings generated.
tools/ciptool.c:350:7: warning: 5th function call argument is an uninitialized value
sk = do_connect(ctl, dev_id, &src, &dst, psm, (1 << CMTP_LOOPBACK));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
tools/sdptool.c:941:26: warning: Result of 'malloc' is converted to a pointer of type 'uint32_t', which is incompatible with sizeof operand type 'int'
uint32_t *value_int = malloc(sizeof(int));
~~~~~~~~~~ ^~~~~~ ~~~~~~~~~~~
tools/sdptool.c:980:4: warning: 1st function call argument is an uninitialized value
free(allocArray[i]);
^~~~~~~~~~~~~~~~~~~
tools/sdptool.c:3777:2: warning: Potential leak of memory pointed to by 'si.name'
return add_service(0, &si);
^~~~~~~~~~~~~~~~~~~~~~~~~~
tools/sdptool.c:4112:4: warning: Potential leak of memory pointed to by 'context.svc'
return -1;
^~~~~~~~~
4 warnings generated.
tools/avtest.c:224:5: warning: Value stored to 'len' is never read
len = write(sk, buf, 3);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:234:5: warning: Value stored to 'len' is never read
len = write(sk, buf, 4);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:243:5: warning: Value stored to 'len' is never read
len = write(sk, buf, 3);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:257:5: warning: Value stored to 'len' is never read
len = write(sk, buf,
^ ~~~~~~~~~~~~~~
tools/avtest.c:264:5: warning: Value stored to 'len' is never read
len = write(sk, buf,
^ ~~~~~~~~~~~~~~
tools/avtest.c:271:5: warning: Value stored to 'len' is never read
len = write(sk, buf,
^ ~~~~~~~~~~~~~~
tools/avtest.c:278:5: warning: Value stored to 'len' is never read
len = write(sk, buf,
^ ~~~~~~~~~~~~~~
tools/avtest.c:289:5: warning: Value stored to 'len' is never read
len = write(sk, buf, 4);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:293:5: warning: Value stored to 'len' is never read
len = write(sk, buf, 2);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:302:5: warning: Value stored to 'len' is never read
len = write(sk, buf, 3);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:306:5: warning: Value stored to 'len' is never read
len = write(sk, buf, 2);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:315:5: warning: Value stored to 'len' is never read
len = write(sk, buf, 3);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:322:5: warning: Value stored to 'len' is never read
len = write(sk, buf, 2);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:344:5: warning: Value stored to 'len' is never read
len = write(sk, buf, 4);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:348:5: warning: Value stored to 'len' is never read
len = write(sk, buf, 2);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:357:5: warning: Value stored to 'len' is never read
len = write(sk, buf, 3);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:361:5: warning: Value stored to 'len' is never read
len = write(sk, buf, 2);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:374:5: warning: Value stored to 'len' is never read
len = write(sk, buf, 4);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:378:5: warning: Value stored to 'len' is never read
len = write(sk, buf, 2);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:385:4: warning: Value stored to 'len' is never read
len = write(sk, buf, 2);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:395:4: warning: Value stored to 'len' is never read
len = write(sk, buf, 2);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:559:3: warning: Value stored to 'len' is never read
len = write(sk, buf, 2);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:567:3: warning: Value stored to 'len' is never read
len = write(sk, buf, invalid ? 2 : 3);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/avtest.c:581:3: warning: Value stored to 'len' is never read
len = write(sk, buf, 4 + sizeof(media_transport));
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/avtest.c:594:3: warning: Value stored to 'len' is never read
len = write(sk, buf, 3);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:604:3: warning: Value stored to 'len' is never read
len = write(sk, buf, 3);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:616:3: warning: Value stored to 'len' is never read
len = write(sk, buf, 3);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:631:3: warning: Value stored to 'len' is never read
len = write(sk, buf, 3);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:643:3: warning: Value stored to 'len' is never read
len = write(sk, buf, 3);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:652:3: warning: Value stored to 'len' is never read
len = write(sk, buf, 3);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:659:3: warning: Value stored to 'len' is never read
len = write(sk, buf, 2);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:695:2: warning: Value stored to 'len' is never read
len = write(sk, buf, AVCTP_HEADER_LENGTH + sizeof(play_pressed));
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32 warnings generated.
tools/btproxy.c:836:15: warning: Null pointer passed to 1st parameter expecting 'nonnull'
tcp_port = atoi(optarg);
^~~~~~~~~~~~
tools/btproxy.c:839:8: warning: Null pointer passed to 1st parameter expecting 'nonnull'
if (strlen(optarg) > 3 && !strncmp(optarg, "hci", 3))
^~~~~~~~~~~~~~
2 warnings generated.
tools/create-image.c:76:3: warning: Value stored to 'fd' is never read
fd = -1;
^ ~~
tools/create-image.c:84:3: warning: Value stored to 'fd' is never read
fd = -1;
^ ~~
tools/create-image.c:92:3: warning: Value stored to 'fd' is never read
fd = -1;
^ ~~
tools/create-image.c:105:2: warning: Value stored to 'fd' is never read
fd = -1;
^ ~~
4 warnings generated.
tools/btgatt-client.c:1597:2: warning: Value stored to 'argv' is never read
argv += optind;
^ ~~~~~~
1 warning generated.
tools/btgatt-server.c:1212:2: warning: Value stored to 'argv' is never read
argv -= optind;
^ ~~~~~~
1 warning generated.
tools/check-selftest.c:42:3: warning: Value stored to 'ptr' is never read
ptr = fgets(result, sizeof(result), fp);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
tools/gatt-service.c:294:2: warning: 2nd function call argument is an uninitialized value
chr_write(chr, value, len);
^~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
tools/obex-server-tool.c:133:13: warning: Null pointer passed to 1st parameter expecting 'nonnull'
data->fd = open(name, O_WRONLY | O_CREAT | O_NOCTTY, 0600);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/obex-server-tool.c:192:13: warning: Null pointer passed to 1st parameter expecting 'nonnull'
data->fd = open(name, O_RDONLY | O_NOCTTY, 0);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.
tools/btpclientctl.c:402:3: warning: Value stored to 'bit' is never read
bit = 0;
^ ~
tools/btpclientctl.c:1655:2: warning: Null pointer passed to 2nd parameter expecting 'nonnull'
memcpy(cp->data, ad_data, ad_len);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.
src/sdpd-request.c:211:13: warning: Result of 'malloc' is converted to a pointer of type 'char', which is incompatible with sizeof operand type 'uint16_t'
pElem = malloc(sizeof(uint16_t));
^~~~~~ ~~~~~~~~~~~~~~~~
src/sdpd-request.c:239:13: warning: Result of 'malloc' is converted to a pointer of type 'char', which is incompatible with sizeof operand type 'uint32_t'
pElem = malloc(sizeof(uint32_t));
^~~~~~ ~~~~~~~~~~~~~~~~
2 warnings generated.
android/avrcp-lib.c:1968:3: warning: 1st function call argument is an uninitialized value
g_free(text[i]);
^~~~~~~~~~~~~~~
1 warning generated.
unit/test-midi.c:541:82: error: function definition is not allowed here
void compare_events_cb(const struct midi_write_parser *parser, void *user_data) {
^
unit/test-midi.c:587:17: error: use of undeclared identifier 'compare_events_cb'; did you mean 'compare_events'?
compare_events_cb, &midi_data);
^~~~~~~~~~~~~~~~~
compare_events
unit/test-midi.c:237:13: note: 'compare_events' declared here
static void compare_events(const snd_seq_event_t *ev1,
^
2 errors generated.
profiles/health/hdp.c:644:3: warning: Use of memory after it is freed
hdp_tmp_dc_data_unref(dc_data);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
profiles/health/hdp.c:800:19: warning: Use of memory after it is freed
path = g_strdup(chan->path);
^~~~~~~~~~
profiles/health/hdp.c:1779:6: warning: Use of memory after it is freed
hdp_tmp_dc_data_ref(hdp_conn),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
profiles/health/hdp.c:1836:30: warning: Use of memory after it is freed
reply = g_dbus_create_error(data->msg, ERROR_INTERFACE ".HealthError",
^~~~~~~~~
4 warnings generated.
profiles/health/hdp_util.c:1053:2: warning: Use of memory after it is freed
conn_data->func(conn_data->data, gerr);
^~~~~~~~~~~~~~~
1 warning generated.
profiles/midi/midi.c:61:75: error: function definition is not allowed here
void foreach_cb(const struct midi_write_parser *parser, void *user_data) {
^
profiles/midi/midi.c:78:40: error: use of undeclared identifier 'foreach_cb'
midi_read_ev(&midi->midi_out, event, foreach_cb, midi);
^
2 errors generated.
btio/btio.c:72:28: error: field ‘qos’ has incomplete type
72 | struct bt_iso_unicast_qos qos;
| ^~~
btio/btio.c: In function ‘iso_set’:
btio/btio.c:863:38: error: ‘BT_ISO_UNICAST_QOS’ undeclared (first use in this function)
863 | if (setsockopt(sock, SOL_BLUETOOTH, BT_ISO_UNICAST_QOS, qos,
| ^~~~~~~~~~~~~~~~~~
btio/btio.c:863:38: note: each undeclared identifier is reported only once for each function it appears in
btio/btio.c:864:12: error: dereferencing pointer to incomplete type ‘struct bt_iso_unicast_qos’
864 | sizeof(*qos)) < 0) {
| ^~~~
btio/btio.c: In function ‘iso_get’:
btio/btio.c:1574:28: error: storage size of ‘qos’ isn’t known
1574 | struct bt_iso_unicast_qos qos;
| ^~~
btio/btio.c:1580:38: error: ‘BT_ISO_UNICAST_QOS’ undeclared (first use in this function)
1580 | if (getsockopt(sock, SOL_BLUETOOTH, BT_ISO_UNICAST_QOS, &qos,
| ^~~~~~~~~~~~~~~~~~
btio/btio.c:1574:28: error: unused variable ‘qos’ [-Werror=unused-variable]
1574 | struct bt_iso_unicast_qos qos;
| ^~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:10380: btio/bluetoothd-btio.o] Error 1
make[1]: *** Waiting for unfinished jobs....
attrib/gatt.c:970:2: warning: Potential leak of memory pointed to by 'long_write'
return prepare_write(long_write);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
make: *** [Makefile:4506: all] Error 2


---
Regards,
Linux Bluetooth