[PATCH BlueZ v2 1/1] Add command to create local endpoint in bluetoothctl

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

 



Example:
endpoint.new_local_ep 00001852-0000-1000-8000-00805f9b34fb 0x06
Endpoint /local/endpoint/bcaa/lc3 registered

---
 client/player.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/client/player.c b/client/player.c
index a40bf66e3..e297bb615 100644
--- a/client/player.c
+++ b/client/player.c
@@ -4263,6 +4263,8 @@ done:
 	return bt_shell_noninteractive_quit(EXIT_SUCCESS);
 }
 
+static void cmd_new_local_endpoint(int argc, char *argv[]);
+
 static const struct bt_shell_menu endpoint_menu = {
 	.name = "endpoint",
 	.desc = "Media Endpoint Submenu",
@@ -4287,6 +4289,10 @@ static const struct bt_shell_menu endpoint_menu = {
 						cmd_presets_endpoint,
 						"List available presets",
 						uuid_generator },
+	{ "new_local_ep",  "<UUID> <codec[:company]>",
+						cmd_new_local_endpoint,
+						"Create local endpoint",
+						uuid_generator },
 	{} },
 };
 
@@ -4372,6 +4378,27 @@ static void register_endpoints(GDBusProxy *proxy)
 	}
 }
 
+static void cmd_new_local_endpoint(int argc, char *argv[])
+{
+	struct endpoint *ep = NULL;
+	size_t i;
+	char *uuid = g_strdup(argv[1]);
+
+	for (i = 0; i < ARRAY_SIZE(caps); i++) {
+		const struct capabilities *cap = &caps[i];
+
+		if (strcasecmp(cap->uuid, uuid))
+			continue;
+
+		ep = endpoint_new(cap);
+		endpoint_init_defaults(ep);
+		break;
+	}
+
+	if (ep)
+		bt_shell_printf("Endpoint %s registered\n", ep->path);
+}
+
 static void media_added(GDBusProxy *proxy)
 {
 	medias = g_list_append(medias, proxy);
-- 
2.39.2





[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