* [PATCH BlueZ 1/8] doc/media: Add Encryption and BCode fields to QoS property
2024-08-20 10:39 [PATCH BlueZ 0/8] Add support for setting bcode on bcast sink Vlad Pruteanu
@ 2024-08-20 10:39 ` Vlad Pruteanu
2024-08-20 15:54 ` Add support for setting bcode on bcast sink bluez.test.bot
2024-08-20 10:39 ` [PATCH BlueZ 2/8] transport: Make get_bcast_qos return the encryption flag Vlad Pruteanu
` (6 subsequent siblings)
7 siblings, 1 reply; 13+ messages in thread
From: Vlad Pruteanu @ 2024-08-20 10:39 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] 13+ messages in thread* 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; 13+ 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] 13+ messages in thread
* [PATCH BlueZ 2/8] transport: Make get_bcast_qos return the encryption flag
2024-08-20 10:39 [PATCH BlueZ 0/8] Add support for setting bcode on bcast sink Vlad Pruteanu
2024-08-20 10:39 ` [PATCH BlueZ 1/8] doc/media: Add Encryption and BCode fields to QoS property Vlad Pruteanu
@ 2024-08-20 10:39 ` Vlad Pruteanu
2024-08-20 10:39 ` [PATCH BlueZ 3/8] gdbus: Add g_dbus_proxy_set_property_dict Vlad Pruteanu
` (5 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Vlad Pruteanu @ 2024-08-20 10:39 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] 13+ messages in thread* [PATCH BlueZ 3/8] gdbus: Add g_dbus_proxy_set_property_dict
2024-08-20 10:39 [PATCH BlueZ 0/8] Add support for setting bcode on bcast sink Vlad Pruteanu
2024-08-20 10:39 ` [PATCH BlueZ 1/8] doc/media: Add Encryption and BCode fields to QoS property Vlad Pruteanu
2024-08-20 10:39 ` [PATCH BlueZ 2/8] transport: Make get_bcast_qos return the encryption flag Vlad Pruteanu
@ 2024-08-20 10:39 ` Vlad Pruteanu
2024-08-20 10:39 ` [PATCH BlueZ 4/8] doc/media: Make QoS property readwrite Vlad Pruteanu
` (4 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Vlad Pruteanu @ 2024-08-20 10:39 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 received the name of the
property, the name of the entry to be set from the dictionary,
it's type and value. 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.
---
gdbus/client.c | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++
gdbus/gdbus.h | 6 ++++
2 files changed, 92 insertions(+)
diff --git a/gdbus/client.c b/gdbus/client.c
index 3b7faa4e4..980f8fc0f 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
*
*
*/
@@ -184,6 +185,33 @@ void g_dbus_dict_append_entry(DBusMessageIter *dict,
dict_append_basic(dict, DBUS_TYPE_STRING, &key, type, val);
}
+static void append_dict_variant(DBusMessageIter *iter, char *entry, int type,
+ void *val)
+{
+ DBusMessageIter variant, dict;
+
+ 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);
+
+ g_dbus_dict_append_entry(&dict, entry, type, val);
+
+ dbus_message_iter_close_container(&variant, &dict);
+
+ dbus_message_iter_close_container(iter, &variant);
+}
+
void g_dbus_dict_append_basic_array(DBusMessageIter *dict, int key_type,
const void *key, int type, void *val,
int n_elements)
@@ -885,6 +913,64 @@ gboolean g_dbus_proxy_set_property_basic(GDBusProxy *proxy,
return TRUE;
}
+gboolean g_dbus_proxy_set_property_dict(GDBusProxy *proxy,
+ const char *name, char *entry, int type,
+ const void *value, GDBusResultFunction function,
+ void *user_data, GDBusDestroyFunction destroy)
+{
+ struct set_property_data *data;
+ GDBusClient *client;
+ DBusMessage *msg;
+ DBusMessageIter iter;
+ DBusPendingCall *call;
+
+ if (proxy == NULL || name == NULL || value == NULL)
+ return FALSE;
+
+ if (dbus_type_is_basic(type) == FALSE)
+ 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);
+
+ append_dict_variant(&iter, entry, type, &value);
+
+ 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..4aaf73b62 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, char *entry, int type,
+ const void *value, GDBusResultFunction function,
+ void *user_data, GDBusDestroyFunction destroy);
+
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] 13+ messages in thread* [PATCH BlueZ 4/8] doc/media: Make QoS property readwrite
2024-08-20 10:39 [PATCH BlueZ 0/8] Add support for setting bcode on bcast sink Vlad Pruteanu
` (2 preceding siblings ...)
2024-08-20 10:39 ` [PATCH BlueZ 3/8] gdbus: Add g_dbus_proxy_set_property_dict Vlad Pruteanu
@ 2024-08-20 10:39 ` Vlad Pruteanu
2024-08-20 10:39 ` [PATCH BlueZ 5/8] transport: Add set_bcast_qos method Vlad Pruteanu
` (3 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Vlad Pruteanu @ 2024-08-20 10:39 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] 13+ messages in thread* [PATCH BlueZ 5/8] transport: Add set_bcast_qos method
2024-08-20 10:39 [PATCH BlueZ 0/8] Add support for setting bcode on bcast sink Vlad Pruteanu
` (3 preceding siblings ...)
2024-08-20 10:39 ` [PATCH BlueZ 4/8] doc/media: Make QoS property readwrite Vlad Pruteanu
@ 2024-08-20 10:39 ` Vlad Pruteanu
2024-08-20 14:44 ` Luiz Augusto von Dentz
2024-08-20 10:39 ` [PATCH BlueZ 6/8] shared/bap: Enable set qos method for BT_BAP_BCAST_SINK stream Vlad Pruteanu
` (2 subsequent siblings)
7 siblings, 1 reply; 13+ messages in thread
From: Vlad Pruteanu @ 2024-08-20 10:39 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 | 33 +++++++++++++++++++++++++++++++--
1 file changed, 31 insertions(+), 2 deletions(-)
diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c
index e8915490d..854b30601 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,42 @@ 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, *str;
+
+ 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")) {
+ dbus_message_iter_get_basic(&value, &str);
+ bap_qos->bcast.bcode = new0(struct iovec, 1);
+ util_iov_append(bap_qos->bcast.bcode, str, strlen(str));
+ }
+
+ 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] 13+ messages in thread* Re: [PATCH BlueZ 5/8] transport: Add set_bcast_qos method
2024-08-20 10:39 ` [PATCH BlueZ 5/8] transport: Add set_bcast_qos method Vlad Pruteanu
@ 2024-08-20 14:44 ` Luiz Augusto von Dentz
0 siblings, 0 replies; 13+ messages in thread
From: Luiz Augusto von Dentz @ 2024-08-20 14:44 UTC (permalink / raw)
To: Vlad Pruteanu
Cc: linux-bluetooth, mihai-octavian.urzica, iulia.tanasescu,
andrei.istodorescu
Hi Vlad,
On Tue, Aug 20, 2024 at 6:43 AM Vlad Pruteanu <vlad.pruteanu@nxp.com> wrote:
>
> 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 | 33 +++++++++++++++++++++++++++++++--
> 1 file changed, 31 insertions(+), 2 deletions(-)
>
> diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c
> index e8915490d..854b30601 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,42 @@ 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, *str;
> +
> + 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")) {
> + dbus_message_iter_get_basic(&value, &str);
Hmm, isn't BCode a byte array? How come we are parsing as a string here?
> + bap_qos->bcast.bcode = new0(struct iovec, 1);
> + util_iov_append(bap_qos->bcast.bcode, str, strlen(str));
> + }
> +
> + 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
>
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH BlueZ 6/8] shared/bap: Enable set qos method for BT_BAP_BCAST_SINK stream
2024-08-20 10:39 [PATCH BlueZ 0/8] Add support for setting bcode on bcast sink Vlad Pruteanu
` (4 preceding siblings ...)
2024-08-20 10:39 ` [PATCH BlueZ 5/8] transport: Add set_bcast_qos method Vlad Pruteanu
@ 2024-08-20 10:39 ` Vlad Pruteanu
2024-08-20 10:39 ` [PATCH BlueZ 7/8] client/player: Prompt the user to enter the bcode Vlad Pruteanu
2024-08-20 10:39 ` [PATCH BlueZ 8/8] bap: Refresh qos stored in setup before doing BIG sync Vlad Pruteanu
7 siblings, 0 replies; 13+ messages in thread
From: Vlad Pruteanu @ 2024-08-20 10:39 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] 13+ messages in thread* [PATCH BlueZ 7/8] client/player: Prompt the user to enter the bcode
2024-08-20 10:39 [PATCH BlueZ 0/8] Add support for setting bcode on bcast sink Vlad Pruteanu
` (5 preceding siblings ...)
2024-08-20 10:39 ` [PATCH BlueZ 6/8] shared/bap: Enable set qos method for BT_BAP_BCAST_SINK stream Vlad Pruteanu
@ 2024-08-20 10:39 ` Vlad Pruteanu
2024-08-20 10:39 ` [PATCH BlueZ 8/8] bap: Refresh qos stored in setup before doing BIG sync Vlad Pruteanu
7 siblings, 0 replies; 13+ messages in thread
From: Vlad Pruteanu @ 2024-08-20 10:39 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 | 57 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 57 insertions(+)
diff --git a/client/player.c b/client/player.c
index f1cd90966..6c79cb27c 100644
--- a/client/player.c
+++ b/client/player.c
@@ -5022,8 +5022,65 @@ 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", "BCode",
+ DBUS_TYPE_STRING, bcode,
+ set_bcode_cb, user_data, NULL) == FALSE){
+ 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] 13+ messages in thread* [PATCH BlueZ 8/8] bap: Refresh qos stored in setup before doing BIG sync
2024-08-20 10:39 [PATCH BlueZ 0/8] Add support for setting bcode on bcast sink Vlad Pruteanu
` (6 preceding siblings ...)
2024-08-20 10:39 ` [PATCH BlueZ 7/8] client/player: Prompt the user to enter the bcode Vlad Pruteanu
@ 2024-08-20 10:39 ` Vlad Pruteanu
7 siblings, 0 replies; 13+ messages in thread
From: Vlad Pruteanu @ 2024-08-20 10:39 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] 13+ messages in thread