diff mbox series

[BlueZ,1/7] client/player: Add support to set empty bcode

Message ID 20241008080126.48703-2-iulia.tanasescu@nxp.com
State New
Headers show
Series Add Scan Delegator support for Set Broadcast Code op | expand

Commit Message

Iulia Tanasescu Oct. 8, 2024, 8:01 a.m. UTC
A Broadcast Sink might scan encrypted streams, and the user might not
know the Broadcast Code to decrypt them.

This commit adds the option to set an empty Broadcast Code when prompted
for it after transport.select, if the Code is unknown. In this case, if
the Broadcast Sink is acting as a Scan Delegator, it can ask its peer
Broadcast Assistants to provide the Code through BASS.
---
 client/player.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

Comments

bluez.test.bot@gmail.com Oct. 8, 2024, 12:14 p.m. UTC | #1
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=896570

---Test result---

Test Summary:
CheckPatch                    PASS      2.88 seconds
GitLint                       PASS      1.85 seconds
BuildEll                      PASS      24.33 seconds
BluezMake                     PASS      1581.36 seconds
MakeCheck                     PASS      13.28 seconds
MakeDistcheck                 PASS      176.72 seconds
CheckValgrind                 PASS      249.58 seconds
CheckSmatch                   PASS      350.78 seconds
bluezmakeextell               PASS      118.16 seconds
IncrementalBuild              PASS      10361.16 seconds
ScanBuild                     PASS      1063.81 seconds



---
Regards,
Linux Bluetooth
diff mbox series

Patch

diff --git a/client/player.c b/client/player.c
index df2246516..188378175 100644
--- a/client/player.c
+++ b/client/player.c
@@ -5150,15 +5150,23 @@  static void set_bcode_cb(const DBusError *error, void *user_data)
 static void set_bcode(const char *input, void *user_data)
 {
 	GDBusProxy *proxy = user_data;
-	char *bcode = g_strdup(input);
+	char *bcode;
+
+	if (!strcasecmp(input, "n") || !strcasecmp(input, "no"))
+		bcode = g_new0(char, 16);
+	else
+		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");
+		g_free(bcode);
 		return bt_shell_noninteractive_quit(EXIT_FAILURE);
 	}
+
+	g_free(bcode);
 }
 
 static void transport_select(GDBusProxy *proxy, bool prompt)
@@ -5183,7 +5191,8 @@  static void transport_select(GDBusProxy *proxy, bool prompt)
 			dbus_message_iter_get_basic(&value, &encryption);
 			if (encryption == 1) {
 				bt_shell_prompt_input("",
-				"Enter broadcast code:", set_bcode, proxy);
+					"Enter brocast code[value/no]:",
+					set_bcode, proxy);
 				return;
 			}
 			break;