@@ -74,6 +74,7 @@ struct bap_setup {
unsigned int io_id;
bool recreate;
bool cig_active;
+ uint8_t sid;
struct iovec *caps;
struct iovec *metadata;
unsigned int id;
@@ -1053,8 +1054,9 @@ static void iso_bcast_confirm_cb(GIOChannel *io, GError *err, void *user_data)
}
static void create_stream_for_bis(struct bap_data *bap_data,
- struct bt_bap_pac *lpac, struct bt_bap_qos *qos,
- struct iovec *caps, struct iovec *meta, char *path)
+ struct bt_bap_pac *lpac, uint8_t sid,
+ struct bt_bap_qos *qos, struct iovec *caps,
+ struct iovec *meta, char *path)
{
struct bap_setup *setup;
@@ -1072,6 +1074,7 @@ static void create_stream_for_bis(struct bap_data *bap_data,
setup->stream = bt_bap_stream_new(bap_data->bap,
lpac, NULL, &setup->qos, caps);
+ setup->sid = sid;
bt_bap_stream_set_user_data(setup->stream, path);
bt_bap_stream_config(setup->stream, &setup->qos,
caps, NULL, NULL);
@@ -1079,29 +1082,27 @@ static void create_stream_for_bis(struct bap_data *bap_data,
NULL, NULL);
}
-static void bis_handler(uint8_t bis, uint8_t sgrp, struct iovec *caps,
- struct iovec *meta, struct bt_bap_qos *qos, void *user_data)
+static void bis_handler(uint8_t sid, uint8_t bis, uint8_t sgrp,
+ struct iovec *caps, struct iovec *meta,
+ struct bt_bap_qos *qos, void *user_data)
{
struct bap_data *data = user_data;
struct bt_bap_pac *lpac;
char *path;
- bt_bap_bis_probe(data->bap, bis, sgrp, caps, meta, qos);
+ bt_bap_bis_probe(data->bap, sid, bis, sgrp, caps, meta, qos);
/* Check if this BIS matches any local PAC */
- bt_bap_verify_bis(data->bap, bis,
- caps, &lpac);
+ bt_bap_verify_bis(data->bap, bis, caps, &lpac);
if (!lpac)
return;
- if (asprintf(&path, "%s/bis%d",
- device_get_path(data->device),
- bis) < 0)
+ if (asprintf(&path, "%s/sid%d/bis%d", device_get_path(data->device),
+ sid, bis) < 0)
return;
- create_stream_for_bis(data, lpac, qos,
- caps, meta, path);
+ create_stream_for_bis(data, lpac, sid, qos, caps, meta, path);
}
static gboolean big_info_report_cb(GIOChannel *io, GIOCondition cond,
@@ -1113,12 +1114,14 @@ static gboolean big_info_report_cb(GIOChannel *io, GIOCondition cond,
struct bt_iso_qos qos;
struct iovec iov;
struct bt_bap_qos bap_qos = {0};
+ uint8_t sid;
DBG("BIG Info received");
bt_io_get(io, &err,
BT_IO_OPT_BASE, &base,
BT_IO_OPT_QOS, &qos,
+ BT_IO_OPT_ISO_BC_SID, &sid,
BT_IO_OPT_INVALID);
if (err) {
error("%s", err->message);
@@ -1147,7 +1150,7 @@ static gboolean big_info_report_cb(GIOChannel *io, GIOCondition cond,
/* Create BAP QoS structure */
bt_bap_iso_qos_to_bap_qos(&qos, &bap_qos);
- bt_bap_parse_base(&iov, &bap_qos, bap_debug, bis_handler, data);
+ bt_bap_parse_base(sid, &iov, &bap_qos, bap_debug, bis_handler, data);
util_iov_free(bap_qos.bcast.bcode, 1);
@@ -2941,6 +2944,7 @@ static void pa_and_big_sync(struct bap_setup *setup)
btd_device_get_bdaddr_type(bap_data->device),
BT_IO_OPT_MODE, BT_IO_MODE_ISO,
BT_IO_OPT_QOS, &bap_sink_pa_qos,
+ BT_IO_OPT_ISO_BC_SID, setup->sid,
BT_IO_OPT_INVALID);
if (!bap_data->listen_io) {
error("%s", err->message);
@@ -141,8 +141,9 @@ static struct bass_data *bass_data_new(struct btd_device *device);
static void bass_data_add(struct bass_data *data);
static void bass_data_remove(struct bass_data *data);
-static void bis_probe(uint8_t bis, uint8_t sgrp, struct iovec *caps,
- struct iovec *meta, struct bt_bap_qos *qos, void *user_data);
+static void bis_probe(uint8_t sid, uint8_t bis, uint8_t sgrp,
+ struct iovec *caps, struct iovec *meta,
+ struct bt_bap_qos *qos, void *user_data);
static void bis_remove(struct bt_bap *bap, void *user_data);
@@ -482,8 +483,9 @@ static void bass_add_bis(struct bass_setup *setup)
setup_configure_stream(setup);
}
-static void bis_handler(uint8_t bis, uint8_t sgrp, struct iovec *caps,
- struct iovec *meta, struct bt_bap_qos *qos, void *user_data)
+static void bis_handler(uint8_t sid, uint8_t bis, uint8_t sgrp,
+ struct iovec *caps, struct iovec *meta,
+ struct bt_bap_qos *qos, void *user_data)
{
struct bass_delegator *dg = user_data;
struct bt_bap_pac *lpac;
@@ -526,12 +528,14 @@ static gboolean big_info_cb(GIOChannel *io, GIOCondition cond,
struct bt_iso_qos qos;
struct iovec iov;
struct bt_bap_qos bap_qos = {0};
+ uint8_t sid;
dg->io_id = 0;
bt_io_get(io, &err,
BT_IO_OPT_BASE, &base,
BT_IO_OPT_QOS, &qos,
+ BT_IO_OPT_ISO_BC_SID, &sid,
BT_IO_OPT_INVALID);
if (err) {
error("%s", err->message);
@@ -545,7 +549,7 @@ static gboolean big_info_cb(GIOChannel *io, GIOCondition cond,
/* Create BAP QoS structure */
bt_bap_iso_qos_to_bap_qos(&qos, &bap_qos);
- bt_bap_parse_base(&iov, &bap_qos, bass_debug, bis_handler, dg);
+ bt_bap_parse_base(sid, &iov, &bap_qos, bass_debug, bis_handler, dg);
util_iov_free(bap_qos.bcast.bcode, 1);
@@ -1107,8 +1111,9 @@ static struct bass_assistant *assistant_new(struct btd_adapter *adapter,
return assistant;
}
-static void bis_probe(uint8_t bis, uint8_t sgrp, struct iovec *caps,
- struct iovec *meta, struct bt_bap_qos *qos, void *user_data)
+static void bis_probe(uint8_t sid, uint8_t bis, uint8_t sgrp,
+ struct iovec *caps, struct iovec *meta,
+ struct bt_bap_qos *qos, void *user_data)
{
struct btd_device *device = user_data;
const struct queue_entry *entry;
@@ -5721,8 +5721,9 @@ bool bt_bap_bis_cb_unregister(struct bt_bap *bap, unsigned int id)
return false;
}
-void bt_bap_bis_probe(struct bt_bap *bap, uint8_t bis, uint8_t sgrp,
- struct iovec *caps, struct iovec *meta, struct bt_bap_qos *qos)
+void bt_bap_bis_probe(struct bt_bap *bap, uint8_t sid, uint8_t bis,
+ uint8_t sgrp, struct iovec *caps, struct iovec *meta,
+ struct bt_bap_qos *qos)
{
const struct queue_entry *entry;
@@ -5737,7 +5738,7 @@ void bt_bap_bis_probe(struct bt_bap *bap, uint8_t bis, uint8_t sgrp,
entry = entry->next;
if (cb->probe)
- cb->probe(bis, sgrp, caps, meta, qos, cb->data);
+ cb->probe(sid, bis, sgrp, caps, meta, qos, cb->data);
}
bt_bap_unref(bap);
@@ -7341,7 +7342,7 @@ void bt_bap_verify_bis(struct bt_bap *bap, uint8_t bis_index,
}
-bool bt_bap_parse_base(struct iovec *iov,
+bool bt_bap_parse_base(uint8_t sid, struct iovec *iov,
struct bt_bap_qos *qos,
util_debug_func_t func,
bt_bap_bis_func_t handler,
@@ -7452,7 +7453,7 @@ bool bt_bap_parse_base(struct iovec *iov,
if (!bis_cc)
continue;
- handler(bis_index, idx, bis_cc, &meta,
+ handler(sid, bis_index, idx, bis_cc, &meta,
qos, user_data);
util_iov_free(bis_cc, 1);
@@ -40,9 +40,9 @@ typedef void (*bt_bap_stream_func_t)(struct bt_bap_stream *stream,
void *user_data);
typedef void (*bt_bap_func_t)(struct bt_bap *bap, void *user_data);
-typedef void (*bt_bap_bis_func_t)(uint8_t bis, uint8_t sgrp,
- struct iovec *caps, struct iovec *meta,
- struct bt_bap_qos *qos, void *user_data);
+typedef void (*bt_bap_bis_func_t)(uint8_t sid, uint8_t bis, uint8_t sgrp,
+ struct iovec *caps, struct iovec *meta,
+ struct bt_bap_qos *qos, void *user_data);
typedef void (*bt_bap_bcode_reply_t)(void *user_data, int err);
@@ -271,7 +271,7 @@ void bt_bap_verify_bis(struct bt_bap *bap, uint8_t bis_index,
struct iovec *caps,
struct bt_bap_pac **lpac);
-bool bt_bap_parse_base(struct iovec *base,
+bool bt_bap_parse_base(uint8_t sid, struct iovec *base,
struct bt_bap_qos *qos,
util_debug_func_t func,
bt_bap_bis_func_t handler,
@@ -284,8 +284,9 @@ unsigned int bt_bap_bis_cb_register(struct bt_bap *bap,
bt_bap_destroy_func_t destroy);
bool bt_bap_bis_cb_unregister(struct bt_bap *bap, unsigned int id);
-void bt_bap_bis_probe(struct bt_bap *bap, uint8_t bis, uint8_t sgrp,
- struct iovec *caps, struct iovec *meta, struct bt_bap_qos *qos);
+void bt_bap_bis_probe(struct bt_bap *bap, uint8_t sid, uint8_t bis,
+ uint8_t sgrp, struct iovec *caps, struct iovec *meta,
+ struct bt_bap_qos *qos);
void bt_bap_bis_remove(struct bt_bap *bap);
void bt_bap_req_bcode(struct bt_bap_stream *stream,
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> Broadcast receiver needs to set the SID of the advertisement, for now that is done by using 0xff which indicates to the kernel to perform to discover what is the actual SID in use over the air. --- profiles/audio/bap.c | 30 +++++++++++++++++------------- profiles/audio/bass.c | 19 ++++++++++++------- src/shared/bap.c | 11 ++++++----- src/shared/bap.h | 13 +++++++------ 4 files changed, 42 insertions(+), 31 deletions(-)