All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ 0/1] btio: Allow binding a bcast listener before accept
@ 2023-10-18 14:39 Iulia Tanasescu
  2023-10-18 14:39 ` [PATCH BlueZ 1/1] " Iulia Tanasescu
  0 siblings, 1 reply; 5+ messages in thread
From: Iulia Tanasescu @ 2023-10-18 14:39 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: claudia.rosu, mihai-octavian.urzica, silviu.barbulescu,
	vlad.pruteanu, andrei.istodorescu, luiz.dentz, Iulia Tanasescu

This patch adds btio support for binding a PA sync io to a number of
BISes, before proceeding with BIG Create Sync.

This depends on the kernel update introduced by
[PATCH v2 0/1] Bluetooth: ISO: Allow binding a PA sync socket.

Iulia Tanasescu (1):
  btio: Allow binding a bcast listener before accept

 btio/btio.c          | 51 +++++++++++++++++++++++++++++++++++++++++++-
 btio/btio.h          |  2 +-
 profiles/audio/bap.c |  2 +-
 src/shared/bass.c    |  9 ++++----
 4 files changed, 57 insertions(+), 7 deletions(-)


base-commit: 0c757e8eeef69ff2b1eefa59e590f171c9fe1c88
-- 
2.39.2


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH BlueZ 1/1] btio: Allow binding a bcast listener before accept
  2023-10-18 14:39 [PATCH BlueZ 0/1] btio: Allow binding a bcast listener before accept Iulia Tanasescu
@ 2023-10-18 14:39 ` Iulia Tanasescu
  2023-10-18 16:12   ` bluez.test.bot
  0 siblings, 1 reply; 5+ messages in thread
From: Iulia Tanasescu @ 2023-10-18 14:39 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: claudia.rosu, mihai-octavian.urzica, silviu.barbulescu,
	vlad.pruteanu, andrei.istodorescu, luiz.dentz, Iulia Tanasescu

This adds btio support for binding a PA sync io to a number of BISes,
before proceeding with BIG Create Sync.

---
 btio/btio.c          | 51 +++++++++++++++++++++++++++++++++++++++++++-
 btio/btio.h          |  2 +-
 profiles/audio/bap.c |  2 +-
 src/shared/bass.c    |  9 ++++----
 4 files changed, 57 insertions(+), 7 deletions(-)

diff --git a/btio/btio.c b/btio/btio.c
index d45b8240d..82b45c152 100644
--- a/btio/btio.c
+++ b/btio/btio.c
@@ -1796,14 +1796,63 @@ gboolean bt_io_accept(GIOChannel *io, BtIOConnect connect, gpointer user_data,
 
 gboolean bt_io_bcast_accept(GIOChannel *io, BtIOConnect connect,
 				gpointer user_data, GDestroyNotify destroy,
-				GError * *err)
+				GError * *err, BtIOOption opt1, ...)
 {
 	int sock;
 	char c;
 	struct pollfd pfd;
+	va_list args;
+	struct sockaddr_iso *addr = NULL;
+	uint8_t bc_num_bis = 0;
+	uint8_t bc_bis[ISO_MAX_NUM_BIS] = {0};
+	BtIOOption opt = opt1;
+
+	va_start(args, opt1);
+
+	while (opt != BT_IO_OPT_INVALID) {
+		if (opt == BT_IO_OPT_ISO_BC_NUM_BIS)  {
+			bc_num_bis = va_arg(args, int);
+		} else if (opt == BT_IO_OPT_ISO_BC_BIS) {
+			memcpy(bc_bis, va_arg(args, uint8_t *),
+					bc_num_bis);
+		} else {
+			g_set_error(err, BT_IO_ERROR, EINVAL,
+					"Invalid option %d", opt);
+			break;
+		}
+
+		opt = va_arg(args, int);
+	}
+
+	va_end(args);
+
+	if (*err)
+		return FALSE;
 
 	sock = g_io_channel_unix_get_fd(io);
 
+	if (bc_num_bis) {
+		addr = malloc(sizeof(*addr) + sizeof(*addr->iso_bc));
+
+		if (!addr) {
+			ERROR_FAILED(err, "poll", ENOMEM);
+			return FALSE;
+		}
+
+		memset(addr, 0, sizeof(*addr) + sizeof(*addr->iso_bc));
+		addr->iso_family = AF_BLUETOOTH;
+
+		addr->iso_bc->bc_num_bis = bc_num_bis;
+		memcpy(addr->iso_bc->bc_bis, bc_bis,
+			addr->iso_bc->bc_num_bis);
+
+		if (bind(sock, (struct sockaddr *)addr,
+			sizeof(*addr) + sizeof(*addr->iso_bc)) < 0) {
+			ERROR_FAILED(err, "bind", errno);
+			return FALSE;
+		}
+	}
+
 	memset(&pfd, 0, sizeof(pfd));
 	pfd.fd = sock;
 	pfd.events = POLLOUT;
diff --git a/btio/btio.h b/btio/btio.h
index 3169bebf3..3e69092b1 100644
--- a/btio/btio.h
+++ b/btio/btio.h
@@ -77,7 +77,7 @@ gboolean bt_io_accept(GIOChannel *io, BtIOConnect connect, gpointer user_data,
 
 gboolean bt_io_bcast_accept(GIOChannel *io, BtIOConnect connect,
 				gpointer user_data, GDestroyNotify destroy,
-				GError **err);
+				GError **err, BtIOOption opt1, ...);
 
 gboolean bt_io_set(GIOChannel *io, GError **err, BtIOOption opt1, ...);
 
diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
index fa5cf1f54..b74498c4c 100644
--- a/profiles/audio/bap.c
+++ b/profiles/audio/bap.c
@@ -981,7 +981,7 @@ 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)) {
+				user_data, NULL, &err, BT_IO_OPT_INVALID)) {
 		error("bt_io_bcast_accept: %s", err->message);
 		g_error_free(err);
 		g_io_channel_shutdown(io, TRUE, NULL);
diff --git a/src/shared/bass.c b/src/shared/bass.c
index 0ee3187d1..ce8b239f3 100644
--- a/src/shared/bass.c
+++ b/src/shared/bass.c
@@ -743,8 +743,9 @@ static void confirm_cb(GIOChannel *io, gpointer user_data)
 
 		if (bass_trigger_big_sync(bcast_src)) {
 			if (!bt_io_bcast_accept(bcast_src->pa_sync_io,
-				connect_cb, bcast_src, NULL, &gerr)) {
-				DBG(bcast_src->bass, "bt_io_accept: %s",
+				connect_cb, bcast_src, NULL, &gerr,
+				BT_IO_OPT_INVALID)) {
+				DBG(bcast_src->bass, "bt_io_bcast_accept: %s",
 				gerr->message);
 				g_error_free(gerr);
 			}
@@ -1129,8 +1130,8 @@ static void bass_handle_set_bcast_code_op(struct bt_bass *bass,
 	}
 
 	if (!bt_io_bcast_accept(bcast_src->pa_sync_io, connect_cb,
-		bcast_src, NULL, &gerr)) {
-		DBG(bcast_src->bass, "bt_io_accept: %s", gerr->message);
+		bcast_src, NULL, &gerr,  BT_IO_OPT_INVALID)) {
+		DBG(bcast_src->bass, "bt_io_bcast_accept: %s", gerr->message);
 		g_error_free(gerr);
 	}
 }
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* RE: btio: Allow binding a bcast listener before accept
  2023-10-18 14:39 ` [PATCH BlueZ 1/1] " Iulia Tanasescu
@ 2023-10-18 16:12   ` bluez.test.bot
  0 siblings, 0 replies; 5+ messages in thread
From: bluez.test.bot @ 2023-10-18 16:12 UTC (permalink / raw)
  To: linux-bluetooth, iulia.tanasescu

[-- Attachment #1: Type: text/plain, Size: 1394 bytes --]

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

---Test result---

Test Summary:
CheckPatch                    PASS      0.59 seconds
GitLint                       PASS      0.33 seconds
BuildEll                      PASS      27.53 seconds
BluezMake                     PASS      789.64 seconds
MakeCheck                     PASS      11.80 seconds
MakeDistcheck                 PASS      173.62 seconds
CheckValgrind                 PASS      267.62 seconds
CheckSmatch                   PASS      357.61 seconds
bluezmakeextell               PASS      115.04 seconds
IncrementalBuild              PASS      684.20 seconds
ScanBuild                     WARNING   1047.51 seconds

Details
##############################
Test: ScanBuild - WARNING
Desc: Run Scan Build
Output:
btio/btio.c:1851:4: warning: Potential leak of memory pointed to by 'addr'
                        ERROR_FAILED(err, "bind", errno);
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
btio/btio.c:41:3: note: expanded from macro 'ERROR_FAILED'
                g_set_error(gerr, BT_IO_ERROR, err, \
                ^~~~~~~~~~~
1 warning generated.



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: btio: Allow binding a bcast listener before accept
  2023-10-19 14:52 [PATCH BlueZ v2 1/1] " Iulia Tanasescu
@ 2023-10-19 16:37 ` bluez.test.bot
  0 siblings, 0 replies; 5+ messages in thread
From: bluez.test.bot @ 2023-10-19 16:37 UTC (permalink / raw)
  To: linux-bluetooth, iulia.tanasescu

[-- Attachment #1: Type: text/plain, Size: 949 bytes --]

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

---Test result---

Test Summary:
CheckPatch                    PASS      0.62 seconds
GitLint                       PASS      0.31 seconds
BuildEll                      PASS      35.85 seconds
BluezMake                     PASS      1190.48 seconds
MakeCheck                     PASS      13.41 seconds
MakeDistcheck                 PASS      225.22 seconds
CheckValgrind                 PASS      337.52 seconds
CheckSmatch                   PASS      468.80 seconds
bluezmakeextell               PASS      149.45 seconds
IncrementalBuild              PASS      1075.92 seconds
ScanBuild                     PASS      1427.41 seconds



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: btio: Allow binding a bcast listener before accept
  2023-10-24 11:04 [PATCH BlueZ v2 1/1] " Iulia Tanasescu
@ 2023-10-24 12:09 ` bluez.test.bot
  0 siblings, 0 replies; 5+ messages in thread
From: bluez.test.bot @ 2023-10-24 12:09 UTC (permalink / raw)
  To: linux-bluetooth, iulia.tanasescu

[-- Attachment #1: Type: text/plain, Size: 947 bytes --]

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

---Test result---

Test Summary:
CheckPatch                    PASS      0.52 seconds
GitLint                       PASS      0.28 seconds
BuildEll                      PASS      27.76 seconds
BluezMake                     PASS      789.97 seconds
MakeCheck                     PASS      11.45 seconds
MakeDistcheck                 PASS      172.73 seconds
CheckValgrind                 PASS      265.21 seconds
CheckSmatch                   PASS      357.15 seconds
bluezmakeextell               PASS      114.79 seconds
IncrementalBuild              PASS      683.68 seconds
ScanBuild                     PASS      1039.55 seconds



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-10-24 12:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-18 14:39 [PATCH BlueZ 0/1] btio: Allow binding a bcast listener before accept Iulia Tanasescu
2023-10-18 14:39 ` [PATCH BlueZ 1/1] " Iulia Tanasescu
2023-10-18 16:12   ` bluez.test.bot
  -- strict thread matches above, loose matches on Subject: below --
2023-10-19 14:52 [PATCH BlueZ v2 1/1] " Iulia Tanasescu
2023-10-19 16:37 ` bluez.test.bot
2023-10-24 11:04 [PATCH BlueZ v2 1/1] " Iulia Tanasescu
2023-10-24 12:09 ` bluez.test.bot

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.