All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vlad Pruteanu <vlad.pruteanu@nxp.com>
To: linux-bluetooth@vger.kernel.org
Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com,
	silviu.barbulescu@nxp.com, iulia.tanasescu@nxp.com,
	andrei.istodorescu@nxp.com, Vlad Pruteanu <vlad.pruteanu@nxp.com>
Subject: [PATCH BlueZ 1/1] client/player: Add command for control of BIS encryption
Date: Tue, 12 Sep 2023 09:40:26 +0300	[thread overview]
Message-ID: <20230912064026.1203509-2-vlad.pruteanu@nxp.com> (raw)
In-Reply-To: <20230912064026.1203509-1-vlad.pruteanu@nxp.com>

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


  reply	other threads:[~2023-09-12  6:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-12  6:40 [PATCH BlueZ 0/1] client/player: Add command for control of BIS encryption Vlad Pruteanu
2023-09-12  6:40 ` Vlad Pruteanu [this message]
2023-09-12  8:12   ` bluez.test.bot
2023-09-12 18:28   ` [PATCH BlueZ 1/1] " Luiz Augusto von Dentz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230912064026.1203509-2-vlad.pruteanu@nxp.com \
    --to=vlad.pruteanu@nxp.com \
    --cc=andrei.istodorescu@nxp.com \
    --cc=claudia.rosu@nxp.com \
    --cc=iulia.tanasescu@nxp.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=mihai-octavian.urzica@nxp.com \
    --cc=silviu.barbulescu@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.