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

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

 



In the case of using BlueZ with Pipewire to start a BAP broadcast source,
Pipewire will do the register endpoint but bluetoothctl is still required
to configure the broadcast streams, but no local broadcast endpoint is defined
in bluetoothctl.
To resolve this problem I added the new_local_ep that will create a local
 endpoint that can be used to configure the Bap broadcast source\sink.
Example how to configure a BAP broadcast source:

endpoint.new_local_ep 00001852-0000-1000-8000-00805f9b34fb 0x06
endpoint.config /org/bluez/hci0/pac_bcast0 /local/endpoint/ep0 48_4_1
endpoint.config /org/bluez/hci0/pac_bcast0 /local/endpoint/ep0 48_4_1

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

diff --git a/client/player.c b/client/player.c
index a40bf66e3..e6041b4d0 100644
--- a/client/player.c
+++ b/client/player.c
@@ -3582,6 +3582,26 @@ static void cmd_register_endpoint(int argc, char *argv[])
 	}
 }
 
+static void cmd_new_local_endpoint(int argc, char *argv[])
+{
+	struct endpoint *ep;
+	char *endptr = NULL;
+
+	ep = g_new0(struct endpoint, 1);
+	ep->uuid = g_strdup(argv[1]);
+	ep->codec = strtol(argv[2], &endptr, 0);
+	ep->cid = 0x0000;
+	ep->vid = 0x0000;
+	ep->path = g_strdup_printf("%s/ep%u", BLUEZ_MEDIA_ENDPOINT_PATH,
+					g_list_length(local_endpoints));
+	local_endpoints = g_list_append(local_endpoints, ep);
+
+	ep->broadcast = true;
+	ep->auto_accept = true;
+	ep->preset = find_presets_name(ep->uuid, argv[2]);
+	bt_shell_printf("Endpoint %s registered\n", ep->path);
+}
+
 static void unregister_endpoint_setup(DBusMessageIter *iter, void *user_data)
 {
 	struct endpoint *ep = user_data;
@@ -4287,6 +4307,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 },
 	{} },
 };
 
-- 
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