Skip to contentSkip to conversation

bap: Use defer setup when syncing to a BIS source

PATCH Superseded Vlad Pruteanu 3 participants 5 messages Sep 11, 2023 Bluetooth drivers

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover bap: Use defer setup when syncing to a BIS source

This commit uses the newly added bt_io_bcast_accept function from btio.c to implement the defer setup for the BIS sync process. Now, information from the BIG Info advertising report can be used when sending the BIG Create Sync command.

Vlad Pruteanu (1):
bap: Use defer setup when syncing to a BIS source

 profiles/audio/bap.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 1/1 bap: Use defer setup when syncing to a BIS source

This commit uses the newly added bt_io_bcast_accept function from btio.c to implement the defer setup for the BIS sync process. Now, information from the BIG Info advertising report can be used when sending the BIG Create Sync command.

---
 profiles/audio/bap.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
profiles/audio/bap.c +17 -1
index ee90426b9..8a2da24dd 100644
@@ -840,6 +840,22 @@ drop:
 
 }
 
+static void iso_pa_sync_confirm_cb(GIOChannel *io, void *user_data)
+{
+	GError *err = NULL;
+
+	if (!bt_io_bcast_accept(io, iso_bcast_confirm_cb,
+				user_data, NULL, &err)) {
+		error("bt_io_bcast_accept: %s", err->message);
+		g_error_free(err);
+		goto drop;
+	}
+	return;
+
+drop:
+	g_io_channel_shutdown(io, TRUE, NULL);
+}
+
 static bool match_data_bap_data(const void *data, const void *match_data)
 {
 	const struct bap_data *bdata = data;
@@ -1587,7 +1603,7 @@ static void bap_listen_io_broadcast(struct bap_data *data, struct bap_ep *ep,
 	if (bt_bap_stream_get_io(stream) || data->listen_io)
 		return;
 
-	io = bt_io_listen(iso_bcast_confirm_cb, NULL, ep->data, NULL, &err,
+	io = bt_io_listen(NULL, iso_pa_sync_confirm_cb, ep->data, NULL, &err,
 			BT_IO_OPT_SOURCE_BDADDR,
 			btd_adapter_get_address(ep->data->adapter),
 			BT_IO_OPT_DEST_BDADDR,
Signature · 1 line
2.34.1
#2 lore raw
Quoted 21 lines

This commit uses the newly added bt_io_bcast_accept function from btio.c to implement the defer setup for the BIS sync process. Now, information from the BIG Info advertising report can be used when sending the BIG Create Sync command.

---
 profiles/audio/bap.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
profiles/audio/bap.c +5 -0
index ee90426b9..8a2da24dd 100644
@@ -840,6 +840,22 @@ drop:
 
 }
 
+static void iso_pa_sync_confirm_cb(GIOChannel *io, void *user_data)
+{
+	GError *err = NULL;
+
+	if (!bt_io_bcast_accept(io, iso_bcast_confirm_cb,

profiles/audio/bap.c drop: · line 857

Quoted 10 lines
profiles/audio/bap.c +10 -0
+				user_data, NULL, &err)) {
+		error("bt_io_bcast_accept: %s", err->message);
+		g_error_free(err);
+		goto drop;
+	}
+	return;
+
+drop:
+	g_io_channel_shutdown(io, TRUE, NULL);
+}

Maybe we do not need goto. It's can be more concise as following:

static void iso_pa_sync_confirm_cb(GIOChannel *io, void *user_data)

{
	GError *err = NULL;

	if (!bt_io_bcast_accept(io, iso_bcast_confirm_cb,
				user_data, NULL, &err)) {
		error("bt_io_bcast_accept: %s", err->message);
		g_error_free(err);
		g_io_channel_shutdown(io, TRUE, NULL);
	}
}

or

static void iso_pa_sync_confirm_cb(GIOChannel *io, void *user_data)

{
	GError *err = NULL;

	if (bt_io_bcast_accept(io, iso_bcast_confirm_cb,
				user_data, NULL, &err)) {
		return;
	}

	error("bt_io_bcast_accept: %s", err->message);
	g_error_free(err);
	g_io_channel_shutdown(io, TRUE, NULL);
}

William Xuan

Quoted 14 lines
profiles/audio/bap.c +2 -1
+
 static bool match_data_bap_data(const void *data, const void *match_data)
 {
 	const struct bap_data *bdata = data;
@@ -1587,7 +1603,7 @@ static void bap_listen_io_broadcast(struct bap_data *data, struct bap_ep *ep,
 	if (bt_bap_stream_get_io(stream) || data->listen_io)
 		return;
 
-	io = bt_io_listen(iso_bcast_confirm_cb, NULL, ep->data, NULL, &err,
+	io = bt_io_listen(NULL, iso_pa_sync_confirm_cb, ep->data, NULL, &err,
 			BT_IO_OPT_SOURCE_BDADDR,
 			btd_adapter_get_address(ep->data->adapter),
 			BT_IO_OPT_DEST_BDADDR,
#3 lore raw

Hi William,

Quoted 73 lines

-----Original Message-----
From: Ziyang Xuan (William) <[email protected]>
Sent: Monday, September 11, 2023 10:05 AM
To: Vlad Pruteanu <[email protected]>; [email protected]
Cc: Claudia Cristina Draghicescu <[email protected]>; Mihai-Octavian Urzica <[email protected]>; Silviu Florian Barbulescu <[email protected]>; Iulia Tanasescu <[email protected]>; Andrei Istodorescu <[email protected]>
Subject: [EXT] Re: [PATCH BlueZ v2 1/1] bap: Use defer setup when syncing to a BIS source

Caution: This is an external email. Please take care when clicking links or opening attachments. When in doubt, report the message using the 'Report this email' button

Quoted 19 lines

This commit uses the newly added bt_io_bcast_accept function from btio.c to implement the defer setup for the BIS sync process. Now, information from the BIG Info advertising report can be used when sending the BIG Create Sync command.

---
 profiles/audio/bap.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
profiles/audio/bap.c index renamed from profiles/audio/bap.c +0 -0

ee90426b9..8a2da24dd 100644

profiles/audio/bap.c +3 -0
@@ -840,6 +840,22 @@ drop:
 
 }
 
+static void iso_pa_sync_confirm_cb(GIOChannel *io, void *user_data) {
+     GError *err = NULL;
+

profiles/audio/bap.c drop: · line 855

Quoted 10 lines
profiles/audio/bap.c +10 -0
+     if (!bt_io_bcast_accept(io, iso_bcast_confirm_cb,
+                             user_data, NULL, &err)) {
+             error("bt_io_bcast_accept: %s", err->message);
+             g_error_free(err);
+             goto drop;
+     }
+     return;
+
+drop:
+     g_io_channel_shutdown(io, TRUE, NULL); }

Maybe we do not need goto. It's can be more concise as following:

static void iso_pa_sync_confirm_cb(GIOChannel *io, void *user_data) {
        GError *err = NULL;

        if (!bt_io_bcast_accept(io, iso_bcast_confirm_cb,
                                user_data, NULL, &err)) {
                error("bt_io_bcast_accept: %s", err->message);
                g_error_free(err);
                g_io_channel_shutdown(io, TRUE, NULL);
        }
}

or

static void iso_pa_sync_confirm_cb(GIOChannel *io, void *user_data) {
        GError *err = NULL;

        if (bt_io_bcast_accept(io, iso_bcast_confirm_cb,
                                user_data, NULL, &err)) {
                return;
        }

        error("bt_io_bcast_accept: %s", err->message);
        g_error_free(err);
        g_io_channel_shutdown(io, TRUE, NULL); }
Quoted 1 line

William Xuan

You're right, I'll update the patch using the first option. Thanks for the input!

Quoted 15 lines
Quoted 15 lines
profiles/audio/bap.c +1 -0
+
 static bool match_data_bap_data(const void *data, const void
 *match_data)  {
      const struct bap_data *bdata = data; @@ -1587,7 +1603,7 @@

static void bap_listen_io_broadcast(struct bap_data *data, struct bap_ep *ep,

      if (bt_bap_stream_get_io(stream) || data->listen_io)
              return;
profiles/audio/bap.c +2 -1
-     io = bt_io_listen(iso_bcast_confirm_cb, NULL, ep->data, NULL, &err,
+     io = bt_io_listen(NULL, iso_pa_sync_confirm_cb, ep->data, NULL,
+ &err,
                      BT_IO_OPT_SOURCE_BDADDR,
                      btd_adapter_get_address(ep->data->adapter),
                      BT_IO_OPT_DEST_BDADDR,
#4 lore raw
In reply to Vlad Pruteanu

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

---Test result---

Test Summary:

CheckPatch                    PASS      0.57 seconds
GitLint                       PASS      0.36 seconds
BuildEll                      PASS      28.20 seconds
BluezMake                     PASS      934.65 seconds
MakeCheck                     PASS      12.39 seconds
MakeDistcheck                 PASS      162.65 seconds
CheckValgrind                 PASS      264.44 seconds
CheckSmatch                   PASS      356.71 seconds
bluezmakeextell               PASS      108.14 seconds
IncrementalBuild              PASS      765.23 seconds
ScanBuild                     PASS      1121.72 seconds

---
Regards,
Linux Bluetooth