[PATCH BlueZ 1/1] client/player: Add command for control of BIS encryption

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Currently there is no way to set the BIS encryption from
the bluetoothctl application. This commit adds support
for one.

Usage:
	encryption [on/off]
---
 client/player.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/client/player.c b/client/player.c
index 42721c210..b1da5e839 100644
--- a/client/player.c
+++ b/client/player.c
@@ -3196,6 +3196,28 @@ done:
 	return bt_shell_noninteractive_quit(EXIT_SUCCESS);
 }
 
+static void cmd_encryption_endpoint(int argc, char *argv[])
+{
+
+	uint8_t value;
+
+	if (argc < 2) {
+		bt_shell_printf("Encryption: %s\n",
+				bcast_qos.bcast.encryption ? "on" : "off");
+		return bt_shell_noninteractive_quit(EXIT_SUCCESS);
+	}
+
+	if (!strcmp(argv[1], "on") || !strcmp(argv[1], "yes"))
+		value = 1;
+	else if (!strcmp(argv[1], "off") || !strcmp(argv[1], "no"))
+		value = 0;
+	else
+		return bt_shell_noninteractive_quit(EXIT_FAILURE);
+
+	bcast_qos.bcast.encryption = value;
+	return bt_shell_noninteractive_quit(EXIT_SUCCESS);
+}
+
 static const struct bt_shell_menu endpoint_menu = {
 	.name = "endpoint",
 	.desc = "Media Endpoint Submenu",
@@ -3221,6 +3243,10 @@ static const struct bt_shell_menu endpoint_menu = {
 						cmd_presets_endpoint,
 						"List available presets",
 						uuid_generator },
+	{ "encryption",    "[on/off]",
+						cmd_encryption_endpoint,
+						"Enable/disable BIS encryption (mode 3 security)",
+						NULL },
 	{} },
 };
 
-- 
2.34.1




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux