All of lore.kernel.org
 help / color / mirror / Atom feed
From: Silviu Florian Barbulescu <silviu.barbulescu@nxp.com>
To: linux-bluetooth@vger.kernel.org
Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com,
	silviu.barbulescu@nxp.com, vlad.pruteanu@nxp.com,
	andrei.istodorescu@nxp.com, iulia.tanasescu@nxp.com
Subject: [PATCH v3 2/3] bap: For broadcast ep extract capabilities from BASE
Date: Fri, 18 Aug 2023 16:35:51 +0300	[thread overview]
Message-ID: <20230818133552.20673-3-silviu.barbulescu@nxp.com> (raw)
In-Reply-To: <20230818133552.20673-1-silviu.barbulescu@nxp.com>

From: Claudia Draghicescu <claudia.rosu@nxp.com>

bap: For broadcast ep parse BASE to extract capabilities

---
 profiles/audio/bap.c | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
index 8cbb238ef..de19023a9 100644
--- a/profiles/audio/bap.c
+++ b/profiles/audio/bap.c
@@ -74,6 +74,7 @@ struct bap_ep {
 	struct bt_bap_qos qos;
 	unsigned int id;
 	DBusMessage *msg;
+	struct iovec *base;
 };
 
 struct bap_data {
@@ -272,7 +273,8 @@ static int parse_array(DBusMessageIter *iter, struct iovec **iov)
 }
 
 static int parse_properties(DBusMessageIter *props, struct iovec **caps,
-				struct iovec **metadata, struct bt_bap_qos *qos)
+				struct iovec **metadata, struct iovec **base,
+				struct bt_bap_qos *qos)
 {
 	const char *key;
 	struct bt_bap_io_qos io_qos;
@@ -438,9 +440,20 @@ static int parse_properties(DBusMessageIter *props, struct iovec **caps,
 	}
 
 	if (broadcast) {
+		uint32_t presDelay;
+		uint8_t numSubgroups, numBis;
+		struct bt_bap_codec codec;
+
 		memcpy(&qos->bcast.io_qos, &io_qos, sizeof(io_qos));
 		qos->bcast.framing = framing;
-
+		if (!base)
+			return 0;
+		if (!(*base))
+			*base = new0(struct iovec, 1);
+		util_iov_memcpy(*base, (*caps)->iov_base, (*caps)->iov_len);
+		bap_parse_base((*caps)->iov_base, (*caps)->iov_len, bap_debug,
+			&presDelay, &numSubgroups, &numBis, &codec,
+			caps, NULL);
 	} else {
 		memcpy(&qos->ucast.io_qos, &io_qos, sizeof(io_qos));
 		qos->ucast.framing = framing;
@@ -565,7 +578,8 @@ static DBusMessage *set_configuration(DBusConnection *conn, DBusMessage *msg,
 		ep->qos.ucast.cis_id = BT_ISO_QOS_CIS_UNSET;
 	}
 
-	if (parse_properties(&props, &ep->caps, &ep->metadata, &ep->qos) < 0) {
+	if (parse_properties(&props, &ep->caps, &ep->metadata,
+				&ep->base, &ep->qos) < 0) {
 		DBG("Unable to parse properties");
 		return btd_error_invalid_args(msg);
 	}
@@ -1244,10 +1258,10 @@ static void bap_connect_io_broadcast(struct bap_data *data, struct bap_ep *ep,
 		g_source_remove(ep->io_id);
 		ep->io_id = 0;
 	}
-	base.base_len = ep->caps->iov_len;
+	base.base_len = ep->base->iov_len;
 
 	memset(base.base, 0, 248);
-	memcpy(base.base, ep->caps->iov_base, base.base_len);
+	memcpy(base.base, ep->base->iov_base, ep->base->iov_len);
 	DBG("ep %p stream %p ", ep, stream);
 	ba2str(btd_adapter_get_address(adapter), addr);
 
-- 
2.34.1


  parent reply	other threads:[~2023-08-18 13:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-18 13:35 [PATCH v3 0/3] Configure broadcast endpoint with BASE Silviu Florian Barbulescu
2023-08-18 13:35 ` [PATCH v3 1/3] shared/bap: Add function that parses a BASE structure Silviu Florian Barbulescu
2023-08-18 16:09   ` Configure broadcast endpoint with BASE bluez.test.bot
2023-08-18 13:35 ` Silviu Florian Barbulescu [this message]
2023-08-18 13:35 ` [PATCH v3 3/3] client/player: Update Codec Config size in BASE Silviu Florian Barbulescu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230818133552.20673-3-silviu.barbulescu@nxp.com \
    --to=silviu.barbulescu@nxp.com \
    --cc=andrei.istodorescu@nxp.com \
    --cc=claudia.rosu@nxp.com \
    --cc=iulia.tanasescu@nxp.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=mihai-octavian.urzica@nxp.com \
    --cc=vlad.pruteanu@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.