public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* RE: Add support for setting bcode on bcast sink
  2024-08-20 10:39 [PATCH BlueZ 1/8] doc/media: Add Encryption and BCode fields to QoS property Vlad Pruteanu
@ 2024-08-20 15:54 ` bluez.test.bot
  0 siblings, 0 replies; 12+ messages in thread
From: bluez.test.bot @ 2024-08-20 15:54 UTC (permalink / raw)
  To: linux-bluetooth, vlad.pruteanu

[-- Attachment #1: Type: text/plain, Size: 2907 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=881300

---Test result---

Test Summary:
CheckPatch                    PASS      3.79 seconds
GitLint                       PASS      2.60 seconds
BuildEll                      PASS      24.77 seconds
BluezMake                     PASS      1755.43 seconds
MakeCheck                     FAIL      13.18 seconds
MakeDistcheck                 FAIL      161.22 seconds
CheckValgrind                 FAIL      253.71 seconds
CheckSmatch                   WARNING   358.86 seconds
bluezmakeextell               PASS      120.62 seconds
IncrementalBuild              PASS      13060.40 seconds
ScanBuild                     PASS      1016.95 seconds

Details
##############################
Test: MakeCheck - FAIL
Desc: Run Bluez Make Check
Output:

make[3]: *** [Makefile:11764: test-suite.log] Error 1
make[2]: *** [Makefile:11872: check-TESTS] Error 2
make[1]: *** [Makefile:12301: check-am] Error 2
make: *** [Makefile:12303: check] Error 2
##############################
Test: MakeDistcheck - FAIL
Desc: Run Bluez Make Distcheck
Output:

Package cups was not found in the pkg-config search path.
Perhaps you should add the directory containing `cups.pc'
to the PKG_CONFIG_PATH environment variable
No package 'cups' found
make[4]: *** [Makefile:11764: test-suite.log] Error 1
make[3]: *** [Makefile:11872: check-TESTS] Error 2
make[2]: *** [Makefile:12301: check-am] Error 2
make[1]: *** [Makefile:12303: check] Error 2
make: *** [Makefile:12224: 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:12725:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
12725 | int main(int argc, char *argv[])
      |     ^~~~
make[3]: *** [Makefile:11764: test-suite.log] Error 1
make[2]: *** [Makefile:11872: check-TESTS] Error 2
make[1]: *** [Makefile:12301: check-am] Error 2
make: *** [Makefile:12303: check] Error 2
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
src/shared/bap.c:288:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:288:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:288:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structures


---
Regards,
Linux Bluetooth


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

* [PATCH BlueZ v2 0/8] Add support for setting bcode on bcast sink
@ 2024-08-22 13:12 Vlad Pruteanu
  2024-08-22 13:12 ` [PATCH BlueZ v2 1/8] doc/media: Add Encryption and BCode fields to QoS property Vlad Pruteanu
                   ` (7 more replies)
  0 siblings, 8 replies; 12+ messages in thread
From: Vlad Pruteanu @ 2024-08-22 13:12 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: mihai-octavian.urzica, iulia.tanasescu, andrei.istodorescu,
	luiz.dentz, Vlad Pruteanu

This series allows the user to set the broadcast code before syncing
to a broadcast source. Upon calling transport.select if the source is
encrypted the user will be prompted to enter the broadcast code. Then,
the code is set in the associated stream's QoS. From here it can be
accessed by iso_do_big_sync, which will pass it to the kernel.

Vlad Pruteanu (8):
  doc/media: Add Encryption and BCode fields to QoS property
  transport: Make get_bcast_qos return the encryption flag
  gdbus: Add g_dbus_proxy_set_property_dict
  doc/media: Make QoS property readwrite
  transport: Add set_bcast_qos method
  shared/bap: Enable set qos method for BT_BAP_BCAST_SINK stream
  client/player: Prompt the user to enter the bcode
  bap: Refresh qos stored in setup before doing BIG sync

 client/player.c                  |  59 ++++++++++++++++
 doc/org.bluez.MediaTransport.rst |  12 +++-
 gdbus/client.c                   | 115 +++++++++++++++++++++++++++++++
 gdbus/gdbus.h                    |   6 ++
 profiles/audio/bap.c             |   2 +
 profiles/audio/transport.c       |  39 ++++++++++-
 src/shared/bap.c                 |   2 +-
 7 files changed, 230 insertions(+), 5 deletions(-)

-- 
2.40.1


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

* [PATCH BlueZ v2 1/8] doc/media: Add Encryption and BCode fields to QoS property
  2024-08-22 13:12 [PATCH BlueZ v2 0/8] Add support for setting bcode on bcast sink Vlad Pruteanu
@ 2024-08-22 13:12 ` Vlad Pruteanu
  2024-08-22 18:10   ` Add support for setting bcode on bcast sink bluez.test.bot
  2024-08-22 13:12 ` [PATCH BlueZ v2 2/8] transport: Make get_bcast_qos return the encryption flag Vlad Pruteanu
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 12+ messages in thread
From: Vlad Pruteanu @ 2024-08-22 13:12 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: mihai-octavian.urzica, iulia.tanasescu, andrei.istodorescu,
	luiz.dentz, Vlad Pruteanu

This adds the missing QoS fields, Encryption and BCode.
---
 doc/org.bluez.MediaTransport.rst | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/doc/org.bluez.MediaTransport.rst b/doc/org.bluez.MediaTransport.rst
index eb3e04ae2..b53c0cd26 100644
--- a/doc/org.bluez.MediaTransport.rst
+++ b/doc/org.bluez.MediaTransport.rst
@@ -242,6 +242,14 @@ dict QoS [readonly, optional, ISO only, experimental]
 
 		Indicates configured framing.
 
+	:array{byte} BCode:
+
+		Indicates the string used for encryption/decryption.
+
+	:byte encryption:
+
+		Indicates if the stream is encrypted.
+
 	:byte Options:
 
 		Indicates configured broadcast options.
-- 
2.40.1


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

* [PATCH BlueZ v2 2/8] transport: Make get_bcast_qos return the encryption flag
  2024-08-22 13:12 [PATCH BlueZ v2 0/8] Add support for setting bcode on bcast sink Vlad Pruteanu
  2024-08-22 13:12 ` [PATCH BlueZ v2 1/8] doc/media: Add Encryption and BCode fields to QoS property Vlad Pruteanu
@ 2024-08-22 13:12 ` Vlad Pruteanu
  2024-08-22 13:12 ` [PATCH BlueZ v2 3/8] gdbus: Add g_dbus_proxy_set_property_dict Vlad Pruteanu
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Vlad Pruteanu @ 2024-08-22 13:12 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: mihai-octavian.urzica, iulia.tanasescu, andrei.istodorescu,
	luiz.dentz, Vlad Pruteanu

This adds the encryption flag to the response returned by the
get_bcast_qos method.
---
 profiles/audio/transport.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c
index 300145794..e8915490d 100644
--- a/profiles/audio/transport.c
+++ b/profiles/audio/transport.c
@@ -1174,6 +1174,8 @@ static gboolean get_bcast_qos(const GDBusPropertyTable *property,
 					&bap->qos.bcast.packing);
 	dict_append_entry(&dict, "Framing", DBUS_TYPE_BYTE,
 					&bap->qos.bcast.framing);
+	dict_append_entry(&dict, "Encryption", DBUS_TYPE_BYTE,
+					&bap->qos.bcast.encryption);
 	if (bap->qos.bcast.bcode)
 		dict_append_array(&dict, "BCode", DBUS_TYPE_BYTE,
 					&bap->qos.bcast.bcode->iov_base,
-- 
2.40.1


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

* [PATCH BlueZ v2 3/8] gdbus: Add g_dbus_proxy_set_property_dict
  2024-08-22 13:12 [PATCH BlueZ v2 0/8] Add support for setting bcode on bcast sink Vlad Pruteanu
  2024-08-22 13:12 ` [PATCH BlueZ v2 1/8] doc/media: Add Encryption and BCode fields to QoS property Vlad Pruteanu
  2024-08-22 13:12 ` [PATCH BlueZ v2 2/8] transport: Make get_bcast_qos return the encryption flag Vlad Pruteanu
@ 2024-08-22 13:12 ` Vlad Pruteanu
  2024-08-22 13:12 ` [PATCH BlueZ v2 4/8] doc/media: Make QoS property readwrite Vlad Pruteanu
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Vlad Pruteanu @ 2024-08-22 13:12 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: mihai-octavian.urzica, iulia.tanasescu, andrei.istodorescu,
	luiz.dentz, Vlad Pruteanu

This adds a new gdbus function to allow for the setting of a
dictionary-type property (a{sv}). It receives the name of the
property, the name of the first entry to be set from the
dictionary, it's type and value, followed by the second pair of
entry_name, type, value, and so on, marking the end of the
entries with NULL. Additionally, if the type is an array, the
type of the array and it's length must also be proviedd. These
values are passed as a dict entry, to the set method associated
with the property. There, it must be parsed and the appropriate
entry updated.

Example of usage:

g_dbus_proxy_set_property_dict(proxy, "dict_property_name", cb,
user_data, NULL, "entry_1", DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE,
value_1_len, value_1, "entry_2", DBUS_TYPE_BYTE, value_2, NULL)
---
 gdbus/client.c | 115 +++++++++++++++++++++++++++++++++++++++++++++++++
 gdbus/gdbus.h  |   6 +++
 2 files changed, 121 insertions(+)

diff --git a/gdbus/client.c b/gdbus/client.c
index 3b7faa4e4..deeb01dab 100644
--- a/gdbus/client.c
+++ b/gdbus/client.c
@@ -4,6 +4,7 @@
  *  D-Bus helper library
  *
  *  Copyright (C) 2004-2011  Marcel Holtmann <marcel@holtmann.org>
+ *  Copyright 2024 NXP
  *
  *
  */
@@ -15,6 +16,7 @@
 #define _GNU_SOURCE
 #include <stdio.h>
 #include <string.h>
+#include <stdarg.h>
 #include <glib.h>
 #include <dbus/dbus.h>
 
@@ -208,6 +210,44 @@ void g_dbus_dict_append_array(DBusMessageIter *dict,
 								n_elements);
 }
 
+static void append_dict_variant(DBusMessageIter *iter, char *entry, int type,
+							void *val, ...)
+{
+	DBusMessageIter variant, dict;
+	va_list args;
+	int array_type, size;
+
+	dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT,
+					DBUS_TYPE_ARRAY_AS_STRING
+					DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
+					DBUS_TYPE_STRING_AS_STRING
+					DBUS_TYPE_VARIANT_AS_STRING
+					DBUS_DICT_ENTRY_END_CHAR_AS_STRING,
+					&variant);
+
+	dbus_message_iter_open_container(&variant, DBUS_TYPE_ARRAY,
+					DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
+					DBUS_TYPE_STRING_AS_STRING
+					DBUS_TYPE_VARIANT_AS_STRING
+					DBUS_DICT_ENTRY_END_CHAR_AS_STRING,
+					&dict);
+
+	va_start(args, val);
+
+	if (type == DBUS_TYPE_ARRAY) {
+		array_type = va_arg(args, int);
+		size = va_arg(args, int);
+		g_dbus_dict_append_array(&dict, entry, array_type, val, size);
+	} else
+		g_dbus_dict_append_entry(&dict, entry, type, val);
+
+	va_end(args);
+
+	dbus_message_iter_close_container(&variant, &dict);
+
+	dbus_message_iter_close_container(iter, &variant);
+}
+
 static void iter_append_iter(DBusMessageIter *base, DBusMessageIter *iter)
 {
 	int type;
@@ -885,6 +925,81 @@ gboolean g_dbus_proxy_set_property_basic(GDBusProxy *proxy,
 	return TRUE;
 }
 
+gboolean g_dbus_proxy_set_property_dict(GDBusProxy *proxy,
+				const char *name, GDBusResultFunction function,
+				void *user_data, GDBusDestroyFunction destroy,
+				char *entry, ...)
+{
+	struct set_property_data *data;
+	GDBusClient *client;
+	DBusMessage *msg;
+	DBusMessageIter iter;
+	DBusPendingCall *call;
+	va_list args;
+	int type, array_type, size;
+	void *value;
+
+	if (proxy == NULL || name == NULL)
+		return FALSE;
+
+	client = proxy->client;
+	if (client == NULL)
+		return FALSE;
+
+	data = g_try_new0(struct set_property_data, 1);
+	if (data == NULL)
+		return FALSE;
+
+	data->function = function;
+	data->user_data = user_data;
+	data->destroy = destroy;
+
+	msg = dbus_message_new_method_call(client->service_name,
+			proxy->obj_path, DBUS_INTERFACE_PROPERTIES, "Set");
+	if (msg == NULL) {
+		g_free(data);
+		return FALSE;
+	}
+
+	dbus_message_iter_init_append(msg, &iter);
+	dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING,
+							&proxy->interface);
+	dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &name);
+
+	va_start(args, entry);
+
+	while (entry != NULL) {
+		type = va_arg(args, int);
+		if (type == DBUS_TYPE_ARRAY) {
+			array_type = va_arg(args, int);
+			size = va_arg(args, int);
+			value = va_arg(args, void *);
+			append_dict_variant(&iter, entry, type, &value,
+							array_type, size);
+		} else {
+			value = va_arg(args, void *);
+			append_dict_variant(&iter, entry, type, &value);
+		}
+		entry = va_arg(args, char *);
+	}
+
+	va_end(args);
+
+	if (g_dbus_send_message_with_reply(client->dbus_conn, msg,
+							&call, -1) == FALSE) {
+		dbus_message_unref(msg);
+		g_free(data);
+		return FALSE;
+	}
+
+	dbus_pending_call_set_notify(call, set_property_reply, data, g_free);
+	dbus_pending_call_unref(call);
+
+	dbus_message_unref(msg);
+
+	return TRUE;
+}
+
 gboolean g_dbus_proxy_set_property_array(GDBusProxy *proxy,
 				const char *name, int type, const void *value,
 				size_t size, GDBusResultFunction function,
diff --git a/gdbus/gdbus.h b/gdbus/gdbus.h
index 6fe09b743..d7be17661 100644
--- a/gdbus/gdbus.h
+++ b/gdbus/gdbus.h
@@ -4,6 +4,7 @@
  *  D-Bus helper library
  *
  *  Copyright (C) 2004-2011  Marcel Holtmann <marcel@holtmann.org>
+ *  Copyright 2024 NXP
  *
  *
  */
@@ -362,6 +363,11 @@ gboolean g_dbus_proxy_set_property_basic(GDBusProxy *proxy,
 				GDBusResultFunction function, void *user_data,
 				GDBusDestroyFunction destroy);
 
+gboolean g_dbus_proxy_set_property_dict(GDBusProxy *proxy,
+				const char *name, GDBusResultFunction function,
+				void *user_data, GDBusDestroyFunction destroy,
+				char *entry, ...);
+
 gboolean g_dbus_proxy_set_property_array(GDBusProxy *proxy,
 				const char *name, int type, const void *value,
 				size_t size, GDBusResultFunction function,
-- 
2.40.1


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

* [PATCH BlueZ v2 4/8] doc/media: Make QoS property readwrite
  2024-08-22 13:12 [PATCH BlueZ v2 0/8] Add support for setting bcode on bcast sink Vlad Pruteanu
                   ` (2 preceding siblings ...)
  2024-08-22 13:12 ` [PATCH BlueZ v2 3/8] gdbus: Add g_dbus_proxy_set_property_dict Vlad Pruteanu
@ 2024-08-22 13:12 ` Vlad Pruteanu
  2024-08-22 13:12 ` [PATCH BlueZ v2 5/8] transport: Add set_bcast_qos method Vlad Pruteanu
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Vlad Pruteanu @ 2024-08-22 13:12 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: mihai-octavian.urzica, iulia.tanasescu, andrei.istodorescu,
	luiz.dentz, Vlad Pruteanu

Update the QoS property to allow for write, so that fields such as
BCode can be updated.
---
 doc/org.bluez.MediaTransport.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/org.bluez.MediaTransport.rst b/doc/org.bluez.MediaTransport.rst
index b53c0cd26..4d998b2a8 100644
--- a/doc/org.bluez.MediaTransport.rst
+++ b/doc/org.bluez.MediaTransport.rst
@@ -149,8 +149,8 @@ array{object} Links [readonly, optional, ISO only, experimental]
 
 	Linked transport objects which the transport is associated with.
 
-dict QoS [readonly, optional, ISO only, experimental]
-`````````````````````````````````````````````````````
+dict QoS [readwrite, optional, ISO only, experimental]
+``````````````````````````````````````````````````````
 
 	Only present when QoS is configured.
 
-- 
2.40.1


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

* [PATCH BlueZ v2 5/8] transport: Add set_bcast_qos method
  2024-08-22 13:12 [PATCH BlueZ v2 0/8] Add support for setting bcode on bcast sink Vlad Pruteanu
                   ` (3 preceding siblings ...)
  2024-08-22 13:12 ` [PATCH BlueZ v2 4/8] doc/media: Make QoS property readwrite Vlad Pruteanu
@ 2024-08-22 13:12 ` Vlad Pruteanu
  2024-08-22 13:12 ` [PATCH BlueZ v2 6/8] shared/bap: Enable set qos method for BT_BAP_BCAST_SINK stream Vlad Pruteanu
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Vlad Pruteanu @ 2024-08-22 13:12 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: mihai-octavian.urzica, iulia.tanasescu, andrei.istodorescu,
	luiz.dentz, Vlad Pruteanu

This adds a set method for the QoS property of bcast transports.
This is needed so that applications like bluetoothctl are able to
modify the QoS (for example, for setting the broadcast code).
---
 profiles/audio/transport.c | 37 +++++++++++++++++++++++++++++++++++--
 1 file changed, 35 insertions(+), 2 deletions(-)

diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c
index e8915490d..c4b6ce7e3 100644
--- a/profiles/audio/transport.c
+++ b/profiles/audio/transport.c
@@ -5,7 +5,7 @@
  *
  *  Copyright (C) 2006-2007  Nokia Corporation
  *  Copyright (C) 2004-2009  Marcel Holtmann <marcel@holtmann.org>
- *  Copyright 2023 NXP
+ *  Copyright 2023-2024 NXP
  *
  *
  */
@@ -1208,13 +1208,46 @@ static gboolean qos_bcast_exists(const GDBusPropertyTable *property, void *data)
 	return bap->qos.bcast.io_qos.phy != 0x00;
 }
 
+static void set_bcast_qos(const GDBusPropertyTable *property,
+			DBusMessageIter *dict, GDBusPendingPropertySet id,
+			void *data)
+{
+	DBusMessageIter array, entry, value;
+	struct media_transport *transport = data;
+	struct bap_transport *bap = transport->data;
+	struct bt_bap_qos *bap_qos = bt_bap_stream_get_qos(bap->stream);
+	char *key;
+
+	dbus_message_iter_recurse(dict, &array);
+
+	dbus_message_iter_recurse(&array, &entry);
+	dbus_message_iter_get_basic(&entry, &key);
+
+	dbus_message_iter_next(&entry);
+	dbus_message_iter_recurse(&entry, &value);
+
+	if (!strcasecmp(key, "BCode")) {
+		uint8_t *val;
+		int len;
+		DBusMessageIter array;
+
+		dbus_message_iter_recurse(&value, &array);
+		dbus_message_iter_get_fixed_array(&array, &val, &len);
+
+		bap_qos->bcast.bcode = util_iov_new(val, len);
+	}
+
+	bt_bap_stream_qos(bap->stream, bap_qos, NULL, NULL);
+	g_dbus_pending_property_success(id);
+}
+
 static const GDBusPropertyTable transport_bap_bc_properties[] = {
 	{ "Device", "o", get_device },
 	{ "UUID", "s", get_uuid },
 	{ "Codec", "y", get_codec },
 	{ "Configuration", "ay", get_configuration },
 	{ "State", "s", get_state },
-	{ "QoS", "a{sv}", get_bcast_qos, NULL, qos_bcast_exists },
+	{ "QoS", "a{sv}", get_bcast_qos, set_bcast_qos, qos_bcast_exists },
 	{ "Endpoint", "o", get_endpoint, NULL, endpoint_exists },
 	{ "Location", "u", get_location },
 	{ "Metadata", "ay", get_metadata },
-- 
2.40.1


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

* [PATCH BlueZ v2 6/8] shared/bap: Enable set qos method for BT_BAP_BCAST_SINK stream
  2024-08-22 13:12 [PATCH BlueZ v2 0/8] Add support for setting bcode on bcast sink Vlad Pruteanu
                   ` (4 preceding siblings ...)
  2024-08-22 13:12 ` [PATCH BlueZ v2 5/8] transport: Add set_bcast_qos method Vlad Pruteanu
@ 2024-08-22 13:12 ` Vlad Pruteanu
  2024-08-22 13:12 ` [PATCH BlueZ v2 7/8] client/player: Prompt the user to enter the bcode Vlad Pruteanu
  2024-08-22 13:12 ` [PATCH BlueZ v2 8/8] bap: Refresh qos stored in setup before doing BIG sync Vlad Pruteanu
  7 siblings, 0 replies; 12+ messages in thread
From: Vlad Pruteanu @ 2024-08-22 13:12 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: mihai-octavian.urzica, iulia.tanasescu, andrei.istodorescu,
	luiz.dentz, Vlad Pruteanu

This enables the set qos method, bap_bcast_qos, for the bcast sink
streams as well.
---
 src/shared/bap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/shared/bap.c b/src/shared/bap.c
index a7217b417..97b96e49f 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -2243,7 +2243,7 @@ static const struct bt_bap_stream_ops stream_ops[] = {
 			bap_ucast_release, bap_ucast_detach),
 	STREAM_OPS(BT_BAP_BCAST_SINK, bap_bcast_set_state,
 			bap_bcast_get_state,
-			bap_bcast_config, NULL, bap_bcast_sink_enable,
+			bap_bcast_config, bap_bcast_qos, bap_bcast_sink_enable,
 			bap_bcast_start, bap_bcast_disable, NULL,
 			bap_bcast_metadata, bap_bcast_sink_get_dir,
 			bap_bcast_get_location,
-- 
2.40.1


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

* [PATCH BlueZ v2 7/8] client/player: Prompt the user to enter the bcode
  2024-08-22 13:12 [PATCH BlueZ v2 0/8] Add support for setting bcode on bcast sink Vlad Pruteanu
                   ` (5 preceding siblings ...)
  2024-08-22 13:12 ` [PATCH BlueZ v2 6/8] shared/bap: Enable set qos method for BT_BAP_BCAST_SINK stream Vlad Pruteanu
@ 2024-08-22 13:12 ` Vlad Pruteanu
  2024-08-22 13:12 ` [PATCH BlueZ v2 8/8] bap: Refresh qos stored in setup before doing BIG sync Vlad Pruteanu
  7 siblings, 0 replies; 12+ messages in thread
From: Vlad Pruteanu @ 2024-08-22 13:12 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: mihai-octavian.urzica, iulia.tanasescu, andrei.istodorescu,
	luiz.dentz, Vlad Pruteanu

This adds support for entering the broadcast code on sink side. When
the user selects a transport, if the transport is encrypted, the user
will be prompted to enter the broadcast code before the process of
transport selection can continue.
---
 client/player.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)

diff --git a/client/player.c b/client/player.c
index f1cd90966..eb944a560 100644
--- a/client/player.c
+++ b/client/player.c
@@ -5022,8 +5022,67 @@ static void cmd_acquire_transport(int argc, char *argv[])
 	return bt_shell_noninteractive_quit(EXIT_SUCCESS);
 }
 
+static void set_bcode_cb(const DBusError *error, void *user_data)
+{
+	GDBusProxy *proxy = user_data;
+
+	if (dbus_error_is_set(error)) {
+		bt_shell_printf("Failed to set broadcast code: %s\n",
+								error->name);
+		return bt_shell_noninteractive_quit(EXIT_FAILURE);
+	}
+
+	bt_shell_printf("Setting broadcast code succeeded\n");
+
+	if (!g_dbus_proxy_method_call(proxy, "Select", NULL,
+				select_reply, proxy, NULL))
+		return bt_shell_noninteractive_quit(EXIT_FAILURE);
+}
+
+static void set_bcode(const char *input, void *user_data)
+{
+	GDBusProxy *proxy = user_data;
+	char *bcode = g_strdup(input);
+
+	if (g_dbus_proxy_set_property_dict(proxy, "QoS",
+				set_bcode_cb, user_data,
+				NULL, "BCode", DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE,
+				strlen(bcode), bcode, NULL) == FALSE) {
+		bt_shell_printf("Setting broadcast code failed\n");
+		return bt_shell_noninteractive_quit(EXIT_FAILURE);
+	}
+}
+
 static void transport_select(GDBusProxy *proxy, bool prompt)
 {
+	DBusMessageIter iter, array, entry, value;
+	unsigned char encryption;
+	const char *key;
+
+	if (g_dbus_proxy_get_property(proxy, "QoS", &iter) == FALSE)
+		return;
+
+	dbus_message_iter_recurse(&iter, &array);
+
+	while (dbus_message_iter_get_arg_type(&array) !=
+						DBUS_TYPE_INVALID) {
+		dbus_message_iter_recurse(&array, &entry);
+		dbus_message_iter_get_basic(&entry, &key);
+
+		if (!strcasecmp(key, "Encryption")) {
+			dbus_message_iter_next(&entry);
+			dbus_message_iter_recurse(&entry, &value);
+			dbus_message_iter_get_basic(&value, &encryption);
+			if (encryption == 1) {
+				bt_shell_prompt_input("",
+				"Enter broadcast code:", set_bcode, proxy);
+				return;
+			}
+			break;
+		}
+		dbus_message_iter_next(&array);
+	}
+
 	if (!g_dbus_proxy_method_call(proxy, "Select", NULL,
 					select_reply, proxy, NULL)) {
 		bt_shell_printf("Failed select transport\n");
-- 
2.40.1


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

* [PATCH BlueZ v2 8/8] bap: Refresh qos stored in setup before doing BIG sync
  2024-08-22 13:12 [PATCH BlueZ v2 0/8] Add support for setting bcode on bcast sink Vlad Pruteanu
                   ` (6 preceding siblings ...)
  2024-08-22 13:12 ` [PATCH BlueZ v2 7/8] client/player: Prompt the user to enter the bcode Vlad Pruteanu
@ 2024-08-22 13:12 ` Vlad Pruteanu
  7 siblings, 0 replies; 12+ messages in thread
From: Vlad Pruteanu @ 2024-08-22 13:12 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: mihai-octavian.urzica, iulia.tanasescu, andrei.istodorescu,
	luiz.dentz, Vlad Pruteanu

When syncing to an encrypted stream, after setting the broadcast
code, the qos values stored in the setup must be refreshed so that
they reflect this change.
---
 profiles/audio/bap.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
index a2c5a546d..80ed1a7ea 100644
--- a/profiles/audio/bap.c
+++ b/profiles/audio/bap.c
@@ -3066,6 +3066,8 @@ static void iso_do_big_sync(GIOChannel *io, void *user_data)
 	iso_bc_addr.bc_bis[0] = bis_index;
 	iso_bc_addr.bc_num_bis = 1;
 
+	/* Refresh qos stored in setup */
+	setup->qos = *bt_bap_stream_get_qos(setup->stream);
 	/* Set the user requested QOS */
 	memset(&qos, 0, sizeof(qos));
 	qos.bcast.big = setup->qos.bcast.big;
-- 
2.40.1


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

* RE: Add support for setting bcode on bcast sink
  2024-08-22 13:12 ` [PATCH BlueZ v2 1/8] doc/media: Add Encryption and BCode fields to QoS property Vlad Pruteanu
@ 2024-08-22 18:10   ` bluez.test.bot
  0 siblings, 0 replies; 12+ messages in thread
From: bluez.test.bot @ 2024-08-22 18:10 UTC (permalink / raw)
  To: linux-bluetooth, vlad.pruteanu

[-- Attachment #1: Type: text/plain, Size: 2907 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=882169

---Test result---

Test Summary:
CheckPatch                    PASS      2.50 seconds
GitLint                       PASS      1.66 seconds
BuildEll                      PASS      24.64 seconds
BluezMake                     PASS      1746.93 seconds
MakeCheck                     FAIL      13.38 seconds
MakeDistcheck                 FAIL      166.88 seconds
CheckValgrind                 FAIL      259.97 seconds
CheckSmatch                   WARNING   363.46 seconds
bluezmakeextell               PASS      122.30 seconds
IncrementalBuild              PASS      13684.76 seconds
ScanBuild                     PASS      1035.90 seconds

Details
##############################
Test: MakeCheck - FAIL
Desc: Run Bluez Make Check
Output:

make[3]: *** [Makefile:11766: test-suite.log] Error 1
make[2]: *** [Makefile:11874: check-TESTS] Error 2
make[1]: *** [Makefile:12303: check-am] Error 2
make: *** [Makefile:12305: check] Error 2
##############################
Test: MakeDistcheck - FAIL
Desc: Run Bluez Make Distcheck
Output:

Package cups was not found in the pkg-config search path.
Perhaps you should add the directory containing `cups.pc'
to the PKG_CONFIG_PATH environment variable
No package 'cups' found
make[4]: *** [Makefile:11766: test-suite.log] Error 1
make[3]: *** [Makefile:11874: check-TESTS] Error 2
make[2]: *** [Makefile:12303: check-am] Error 2
make[1]: *** [Makefile:12305: check] Error 2
make: *** [Makefile:12226: 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:12725:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
12725 | int main(int argc, char *argv[])
      |     ^~~~
make[3]: *** [Makefile:11766: test-suite.log] Error 1
make[2]: *** [Makefile:11874: check-TESTS] Error 2
make[1]: *** [Makefile:12303: check-am] Error 2
make: *** [Makefile:12305: check] Error 2
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
src/shared/bap.c:288:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:288:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:288:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structures


---
Regards,
Linux Bluetooth


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

* RE: Add support for setting bcode on bcast sink
  2024-08-29  9:51 [PATCH BlueZ v2 1/8] doc/media: Add Encryption and BCode fields to QoS property Vlad Pruteanu
@ 2024-08-29 14:56 ` bluez.test.bot
  0 siblings, 0 replies; 12+ messages in thread
From: bluez.test.bot @ 2024-08-29 14:56 UTC (permalink / raw)
  To: linux-bluetooth, vlad.pruteanu

[-- Attachment #1: Type: text/plain, Size: 1561 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=884682

---Test result---

Test Summary:
CheckPatch                    PASS      3.21 seconds
GitLint                       PASS      2.12 seconds
BuildEll                      PASS      27.19 seconds
BluezMake                     PASS      1750.76 seconds
MakeCheck                     PASS      13.11 seconds
MakeDistcheck                 PASS      181.81 seconds
CheckValgrind                 PASS      255.83 seconds
CheckSmatch                   WARNING   360.37 seconds
bluezmakeextell               PASS      122.20 seconds
IncrementalBuild              PASS      12970.89 seconds
ScanBuild                     PASS      1055.91 seconds

Details
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
src/shared/bap.c:288:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:288:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:288:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structures


---
Regards,
Linux Bluetooth


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

end of thread, other threads:[~2024-08-29 14:56 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-22 13:12 [PATCH BlueZ v2 0/8] Add support for setting bcode on bcast sink Vlad Pruteanu
2024-08-22 13:12 ` [PATCH BlueZ v2 1/8] doc/media: Add Encryption and BCode fields to QoS property Vlad Pruteanu
2024-08-22 18:10   ` Add support for setting bcode on bcast sink bluez.test.bot
2024-08-22 13:12 ` [PATCH BlueZ v2 2/8] transport: Make get_bcast_qos return the encryption flag Vlad Pruteanu
2024-08-22 13:12 ` [PATCH BlueZ v2 3/8] gdbus: Add g_dbus_proxy_set_property_dict Vlad Pruteanu
2024-08-22 13:12 ` [PATCH BlueZ v2 4/8] doc/media: Make QoS property readwrite Vlad Pruteanu
2024-08-22 13:12 ` [PATCH BlueZ v2 5/8] transport: Add set_bcast_qos method Vlad Pruteanu
2024-08-22 13:12 ` [PATCH BlueZ v2 6/8] shared/bap: Enable set qos method for BT_BAP_BCAST_SINK stream Vlad Pruteanu
2024-08-22 13:12 ` [PATCH BlueZ v2 7/8] client/player: Prompt the user to enter the bcode Vlad Pruteanu
2024-08-22 13:12 ` [PATCH BlueZ v2 8/8] bap: Refresh qos stored in setup before doing BIG sync Vlad Pruteanu
  -- strict thread matches above, loose matches on Subject: below --
2024-08-29  9:51 [PATCH BlueZ v2 1/8] doc/media: Add Encryption and BCode fields to QoS property Vlad Pruteanu
2024-08-29 14:56 ` Add support for setting bcode on bcast sink bluez.test.bot
2024-08-20 10:39 [PATCH BlueZ 1/8] doc/media: Add Encryption and BCode fields to QoS property Vlad Pruteanu
2024-08-20 15:54 ` Add support for setting bcode on bcast sink bluez.test.bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox