All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ 0/2] Allow endpoint config without local endpoint argument
@ 2024-03-20 14:41 Silviu Florian Barbulescu
  2024-03-20 14:41 ` [PATCH BlueZ 1/2] bap: Add bcast source support for MediaEndpoint Codec Silviu Florian Barbulescu
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Silviu Florian Barbulescu @ 2024-03-20 14:41 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: mihai-octavian.urzica, silviu.barbulescu, vlad.pruteanu,
	andrei.istodorescu, luiz.dentz, iulia.tanasescu

Update endpoint config command to create a local endpoint for broadcast
endpoint.
This will be used to configure a broadcast source/sink if
register endpoint is done from another application like PipeWire

Sample output from using the endpoint.config with endpoint and preset
to configure a broadcast sink to connect to a BIS.
The register endpoint for the broadcast sink has been done with PipeWire.
[Waiting to connect to bluetoothd...
[bluetooth]Agent registered
[bluetooth]hci0 new_settings: powered bondable le secure-conn
cis-central cis-peripheral iso-broadcaster sync-receiver
[bluetooth][CHG[0m] Controller C0:07:E8:CE:94:CD Pairable: yes
[bluetooth]AdvertisementMonitor path registered
[bluetooth]scan on
[?2004h[bluetooth]SetDiscoveryFilter success
[bluetooth]Discovery started
[bluetooth][CHG Controller C0:07:E8:CE:94:CD Discovering: yes
[bluetooth][NEW [Device 18:41:1D:57:63:C6 18-41-1D-57-63-C6
[bluetooth][NEW Endpoint /org/bluez/hci0/dev_18_41_1D_57_63_C6/pac_bcast0
mendpoint.config /org/bluez/hci0/dev_18_41_1D_57_63_C6/pac_bcast0 48_4_1
endpoint.config /org/bluez/hci0/dev_18_41_1D_57_63_C6/pac_bcast0 48_4_1
Configuration.#0: len 0x02 type 0x01
Configuration.Sampling Frequency: 48 Khz (0x08)
Configuration.#1: len 0x02 type 0x02
Configuration.Frame Duration: 10 ms (0x01)
Configuration.#2: len 0x03 type 0x04
Configuration.Frame Length: 120 (0x0078)
BCode:
01 02 68 05 53 f1 41 5a a2 65 bb af c6 ea 03 b8 ..h.S.AZ.e......
Framing 0x00
PresentationDelay 40000
Interval 10000
PHY 0x02
SDU 120
Retransmissions 4
Latency 20
[NEW Transport /org/bluez/hci0/dev_18_41_1D_57_63_C6/pac_bcast0/fd0
[bluetooth]Endpoint /local/endpoint/baa/lc3 configured
Sample output from using the endpoint.config with endpoint and preset
to configure a broadcast source BIS.
The register endpoint has been done with PipeWire.
[Waiting to connect to bluetoothd...
[[bluetooth][0m# Agent registered
[[bluetooth][0m# hci0 new_settings: powered bondable le secure-conn
cis-central cis-peripheral iso-broadcaster sync-receiver
[[bluetooth][0m# [[CHG[0m] Controller C0:07:E8:CE:94:CD Pairable: yes
[[bluetooth][0m# AdvertisementMonitor path registered
[[bluetooth][0m# [[NEW[0m] Endpoint /org/bluez/hci0/pac_bcast0
[[bluetooth][0m# [7mendpoint.config /org/bluez/hci0/pac_bcast0 48_4_1
endpoint.config /org/bluez/hci0/pac_bcast0 48_4_1
[[1;39m[/local/endpoint/bcaa/lc3] BIG (auto/value): [0m0
[[1;39m[/local/endpoint/bcaa/lc3] Enter channel location (value/no): [0m1
[[1;39m[/local/endpoint/bcaa/lc3] Enter Metadata (value/no): [0mn
Configuration.#0: len 0x02 type 0x01
Configuration.Sampling Frequency: 48 Khz (0x08)
Configuration.#1: len 0x02 type 0x02
Configuration.Frame Duration: 10 ms (0x01)
Configuration.#2: len 0x03 type 0x04
Configuration.Frame Length: 120 (0x0078)
Configuration.#3: len 0x05 type 0x03
Configuration.Location: 0x00000001
Configuration.Location: Front Left (0x00000001)
BIG 0x00
BCode:
01 02 68 05 53 f1 41 5a a2 65 bb af c6 ea 03 b8 ..h.S.AZ.e......
Framing 0x00
PresentationDelay 40000
Interval 10000
PHY 0x02
SDU 120
Retransmissions 4
Latency 20
[[[bluetooth][0m# [[NEW[0m] Transport /org/bluez/hci0/pac_bcast0/fd0
[[bluetooth][0m# Endpoint /local/endpoint/bcaa/lc3 configured

Silviu Florian Barbulescu (2):
  bap: Fix MediaEndpoint prop codec returns 0 for bcast src endpoint
  player: Update endpoint config command to create local endpoint

 client/player.c      | 80 ++++++++++++++++++++++++++++++++++++++++++--
 profiles/audio/bap.c |  8 ++++-
 2 files changed, 84 insertions(+), 4 deletions(-)


base-commit: b8ad3490a3507476844d6c6a87b2cb336f7d4eb9
-- 
2.39.2


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH BlueZ 1/2] bap: Add bcast source support for MediaEndpoint Codec
  2024-03-20 14:41 [PATCH BlueZ 0/2] Allow endpoint config without local endpoint argument Silviu Florian Barbulescu
@ 2024-03-20 14:41 ` Silviu Florian Barbulescu
  2024-03-20 17:05   ` Allow endpoint config without local endpoint argument bluez.test.bot
  2024-03-20 14:41 ` [PATCH BlueZ 2/2] player: " Silviu Florian Barbulescu
  2024-03-28 14:40 ` [PATCH BlueZ 0/2] " patchwork-bot+bluetooth
  2 siblings, 1 reply; 7+ messages in thread
From: Silviu Florian Barbulescu @ 2024-03-20 14:41 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: mihai-octavian.urzica, silviu.barbulescu, vlad.pruteanu,
	andrei.istodorescu, luiz.dentz, iulia.tanasescu

MediaEndpoint property Codec returns 0 for the broadcast source endpoint

---
 profiles/audio/bap.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
index 964ba9c21..3ab13a51e 100644
--- a/profiles/audio/bap.c
+++ b/profiles/audio/bap.c
@@ -277,7 +277,13 @@ static gboolean get_codec(const GDBusPropertyTable *property,
 	struct bap_ep *ep = data;
 	uint8_t codec;
 
-	bt_bap_pac_get_codec(ep->rpac, &codec, NULL, NULL);
+	/* For broadcast source, rpac is null so the codec
+	 * is retrieved from the lpac
+	 */
+	if (ep->rpac == NULL)
+		bt_bap_pac_get_codec(ep->lpac, &codec, NULL, NULL);
+	else
+		bt_bap_pac_get_codec(ep->rpac, &codec, NULL, NULL);
 
 	dbus_message_iter_append_basic(iter, DBUS_TYPE_BYTE, &codec);
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH BlueZ 2/2] player: Allow endpoint config without local endpoint argument
  2024-03-20 14:41 [PATCH BlueZ 0/2] Allow endpoint config without local endpoint argument Silviu Florian Barbulescu
  2024-03-20 14:41 ` [PATCH BlueZ 1/2] bap: Add bcast source support for MediaEndpoint Codec Silviu Florian Barbulescu
@ 2024-03-20 14:41 ` Silviu Florian Barbulescu
  2024-03-20 17:32   ` Luiz Augusto von Dentz
  2024-03-28 14:40 ` [PATCH BlueZ 0/2] " patchwork-bot+bluetooth
  2 siblings, 1 reply; 7+ messages in thread
From: Silviu Florian Barbulescu @ 2024-03-20 14:41 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: mihai-octavian.urzica, silviu.barbulescu, vlad.pruteanu,
	andrei.istodorescu, luiz.dentz, iulia.tanasescu

Update endpoint config command to create local endpoint for broadcast
 endpoint, this will be used to configure a broadcast source\sink if
 register endpoint is done from another application like PipeWire
---
 client/player.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 77 insertions(+), 3 deletions(-)

diff --git a/client/player.c b/client/player.c
index ab33bfc46..b02a40423 100644
--- a/client/player.c
+++ b/client/player.c
@@ -3662,10 +3662,15 @@ static void endpoint_set_config_bcast(struct endpoint_config *cfg)
 		config_endpoint_iso_group, cfg);
 }
 
+static void endpoint_init_defaults(struct endpoint *ep);
 static void cmd_config_endpoint(int argc, char *argv[])
 {
+	DBusMessageIter iter;
 	struct endpoint_config *cfg;
-	const struct codec_preset *preset;
+	const struct codec_preset *preset = NULL;
+	const struct capabilities *cap;
+	uint8_t codec;
+	const char *uuid;
 
 	cfg = new0(struct endpoint_config, 1);
 
@@ -3680,8 +3685,75 @@ static void cmd_config_endpoint(int argc, char *argv[])
 	/* Search for the local endpoint */
 	cfg->ep = endpoint_find(argv[2]);
 	if (!cfg->ep) {
-		bt_shell_printf("Local Endpoint %s not found\n", argv[2]);
-		goto fail;
+		/* If argc != 3 then argv[2] should be the
+		 * local endpoint. Return error.
+		 */
+		if (argc != 3) {
+			bt_shell_printf("Local Endpoint %s not found\n",
+					argv[2]);
+			goto fail;
+		}
+
+		/* If local endpoint is not found verify if this is a
+		 * broadcast remote endpoint because this can be an
+		 * endpoint config command with remote endpoint and
+		 * preset. In this case we have to create its own
+		 * local endpoint.
+		 */
+		if (!g_dbus_proxy_get_property(cfg->proxy, "UUID", &iter))
+			return;
+		dbus_message_iter_get_basic(&iter, &uuid);
+
+		/* The local endpoint must have the UUID of local pac but
+		 * the remote endpoint has the UUID of the remote pac, so
+		 * based on this information we determine the UUID for the
+		 * local endpoint.
+		 */
+		if (!strcmp(uuid, BAA_SERVICE_UUID))
+			uuid = BCAA_SERVICE_UUID;
+		else if (!strcmp(uuid, BCAA_SERVICE_UUID))
+			uuid = BAA_SERVICE_UUID;
+		else {
+			/* This should be a local endpoint because is not
+			 * a broadcast endpoint.
+			 */
+			bt_shell_printf("Local Endpoint %s not found\n",
+					argv[2]);
+			goto fail;
+		}
+
+		if (!g_dbus_proxy_get_property(cfg->proxy, "Codec", &iter))
+			return;
+
+		dbus_message_iter_get_basic(&iter, &codec);
+
+		/* Verify if the local endpoint already exists */
+		cfg->ep = endpoint_find(uuid);
+		if ((!cfg->ep) || (cfg->ep->codec != codec)) {
+			/* Get capabilities to create the local endpoint */
+			cap = find_capabilities(uuid, codec);
+			if (!cap) {
+				bt_shell_printf(
+					"Capabilities not found for UUID %s, codec id %d",
+					uuid, codec);
+				goto fail;
+			}
+
+			cfg->ep = endpoint_new(cap);
+			endpoint_init_defaults(cfg->ep);
+		}
+
+		/* Verify if argv[2] parameter is a valid preset */
+		preset = preset_find_name(cfg->ep->preset, argv[2]);
+		if (!preset) {
+			bt_shell_printf("Preset %s not found\n",
+				argv[2]);
+			/* Free created endpoint */
+			local_endpoints = g_list_remove(local_endpoints,
+						cfg->ep);
+			endpoint_free(cfg->ep);
+			goto fail;
+		}
 	}
 
 	if (argc > 3) {
@@ -3690,7 +3762,9 @@ static void cmd_config_endpoint(int argc, char *argv[])
 			bt_shell_printf("Preset %s not found\n", argv[3]);
 			goto fail;
 		}
+	}
 
+	if (preset) {
 		cfg->caps = g_new0(struct iovec, 1);
 		/* Copy capabilities */
 		util_iov_append(cfg->caps, preset->data.iov_base,
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* RE: Allow endpoint config without local endpoint argument
  2024-03-20 14:41 ` [PATCH BlueZ 1/2] bap: Add bcast source support for MediaEndpoint Codec Silviu Florian Barbulescu
@ 2024-03-20 17:05   ` bluez.test.bot
  0 siblings, 0 replies; 7+ messages in thread
From: bluez.test.bot @ 2024-03-20 17:05 UTC (permalink / raw)
  To: linux-bluetooth, silviu.barbulescu

[-- Attachment #1: Type: text/plain, Size: 948 bytes --]

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=836768

---Test result---

Test Summary:
CheckPatch                    PASS      1.05 seconds
GitLint                       PASS      0.69 seconds
BuildEll                      PASS      24.15 seconds
BluezMake                     PASS      1635.87 seconds
MakeCheck                     PASS      13.48 seconds
MakeDistcheck                 PASS      176.67 seconds
CheckValgrind                 PASS      247.02 seconds
CheckSmatch                   PASS      350.17 seconds
bluezmakeextell               PASS      120.34 seconds
IncrementalBuild              PASS      3014.45 seconds
ScanBuild                     PASS      990.72 seconds



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH BlueZ 2/2] player: Allow endpoint config without local endpoint argument
  2024-03-20 14:41 ` [PATCH BlueZ 2/2] player: " Silviu Florian Barbulescu
@ 2024-03-20 17:32   ` Luiz Augusto von Dentz
  2024-03-21 11:33     ` Silviu Florian Barbulescu
  0 siblings, 1 reply; 7+ messages in thread
From: Luiz Augusto von Dentz @ 2024-03-20 17:32 UTC (permalink / raw)
  To: Silviu Florian Barbulescu
  Cc: linux-bluetooth, mihai-octavian.urzica, vlad.pruteanu,
	andrei.istodorescu, iulia.tanasescu

Hi Silviu,

On Wed, Mar 20, 2024 at 2:42 PM Silviu Florian Barbulescu
<silviu.barbulescu@nxp.com> wrote:
>
> Update endpoint config command to create local endpoint for broadcast
>  endpoint, this will be used to configure a broadcast source\sink if
>  register endpoint is done from another application like PipeWire

Sorry but will not gona fly, we don't have any business with endpoints
from other process in the system, in fact we might actually make it
strictly prohibit for third-party process to use SetConfiguration with
endpoint that do not belong their own D-Bus connection, same for
MediaTransport, they shall only be acquired by the process that
created them.

Also I remember quite clearly stating that we would move away from
using MediaEndpoint for Broadcast Sink, instead what we shall be doing
is enumerating BIS as MediaTransport directly so the likes of pipewire
can Acquire them directly without doing any configuration since they
are already configured over the air. Broadcast source will probably
require a special interface at pipewire side, or perhaps a dedicated
card which gets configured via some configuration file, etc, but we
shall not depend on bluetoothctl to configured it, that will just make
things more complicated than really helping.

> ---
>  client/player.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++--
>  1 file changed, 77 insertions(+), 3 deletions(-)
>
> diff --git a/client/player.c b/client/player.c
> index ab33bfc46..b02a40423 100644
> --- a/client/player.c
> +++ b/client/player.c
> @@ -3662,10 +3662,15 @@ static void endpoint_set_config_bcast(struct endpoint_config *cfg)
>                 config_endpoint_iso_group, cfg);
>  }
>
> +static void endpoint_init_defaults(struct endpoint *ep);
>  static void cmd_config_endpoint(int argc, char *argv[])
>  {
> +       DBusMessageIter iter;
>         struct endpoint_config *cfg;
> -       const struct codec_preset *preset;
> +       const struct codec_preset *preset = NULL;
> +       const struct capabilities *cap;
> +       uint8_t codec;
> +       const char *uuid;
>
>         cfg = new0(struct endpoint_config, 1);
>
> @@ -3680,8 +3685,75 @@ static void cmd_config_endpoint(int argc, char *argv[])
>         /* Search for the local endpoint */
>         cfg->ep = endpoint_find(argv[2]);
>         if (!cfg->ep) {
> -               bt_shell_printf("Local Endpoint %s not found\n", argv[2]);
> -               goto fail;
> +               /* If argc != 3 then argv[2] should be the
> +                * local endpoint. Return error.
> +                */
> +               if (argc != 3) {
> +                       bt_shell_printf("Local Endpoint %s not found\n",
> +                                       argv[2]);
> +                       goto fail;
> +               }
> +
> +               /* If local endpoint is not found verify if this is a
> +                * broadcast remote endpoint because this can be an
> +                * endpoint config command with remote endpoint and
> +                * preset. In this case we have to create its own
> +                * local endpoint.
> +                */
> +               if (!g_dbus_proxy_get_property(cfg->proxy, "UUID", &iter))
> +                       return;
> +               dbus_message_iter_get_basic(&iter, &uuid);
> +
> +               /* The local endpoint must have the UUID of local pac but
> +                * the remote endpoint has the UUID of the remote pac, so
> +                * based on this information we determine the UUID for the
> +                * local endpoint.
> +                */
> +               if (!strcmp(uuid, BAA_SERVICE_UUID))
> +                       uuid = BCAA_SERVICE_UUID;
> +               else if (!strcmp(uuid, BCAA_SERVICE_UUID))
> +                       uuid = BAA_SERVICE_UUID;
> +               else {
> +                       /* This should be a local endpoint because is not
> +                        * a broadcast endpoint.
> +                        */
> +                       bt_shell_printf("Local Endpoint %s not found\n",
> +                                       argv[2]);
> +                       goto fail;
> +               }
> +
> +               if (!g_dbus_proxy_get_property(cfg->proxy, "Codec", &iter))
> +                       return;
> +
> +               dbus_message_iter_get_basic(&iter, &codec);
> +
> +               /* Verify if the local endpoint already exists */
> +               cfg->ep = endpoint_find(uuid);
> +               if ((!cfg->ep) || (cfg->ep->codec != codec)) {
> +                       /* Get capabilities to create the local endpoint */
> +                       cap = find_capabilities(uuid, codec);
> +                       if (!cap) {
> +                               bt_shell_printf(
> +                                       "Capabilities not found for UUID %s, codec id %d",
> +                                       uuid, codec);
> +                               goto fail;
> +                       }
> +
> +                       cfg->ep = endpoint_new(cap);
> +                       endpoint_init_defaults(cfg->ep);
> +               }
> +
> +               /* Verify if argv[2] parameter is a valid preset */
> +               preset = preset_find_name(cfg->ep->preset, argv[2]);
> +               if (!preset) {
> +                       bt_shell_printf("Preset %s not found\n",
> +                               argv[2]);
> +                       /* Free created endpoint */
> +                       local_endpoints = g_list_remove(local_endpoints,
> +                                               cfg->ep);
> +                       endpoint_free(cfg->ep);
> +                       goto fail;
> +               }
>         }
>
>         if (argc > 3) {
> @@ -3690,7 +3762,9 @@ static void cmd_config_endpoint(int argc, char *argv[])
>                         bt_shell_printf("Preset %s not found\n", argv[3]);
>                         goto fail;
>                 }
> +       }
>
> +       if (preset) {
>                 cfg->caps = g_new0(struct iovec, 1);
>                 /* Copy capabilities */
>                 util_iov_append(cfg->caps, preset->data.iov_base,
> --
> 2.39.2
>


-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH BlueZ 2/2] player: Allow endpoint config without local endpoint argument
  2024-03-20 17:32   ` Luiz Augusto von Dentz
@ 2024-03-21 11:33     ` Silviu Florian Barbulescu
  0 siblings, 0 replies; 7+ messages in thread
From: Silviu Florian Barbulescu @ 2024-03-21 11:33 UTC (permalink / raw)
  To: luiz.dentz
  Cc: andrei.istodorescu, iulia.tanasescu, linux-bluetooth,
	mihai-octavian.urzica, silviu.barbulescu, vlad.pruteanu

Hi Luiz, 

> -----Original Message-----
> From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
> Sent: Wednesday, March 20, 2024 7:33 PM
> To: Silviu Florian Barbulescu <silviu.barbulescu@nxp.com>
> Cc: linux-bluetooth@vger.kernel.org; Mihai-Octavian Urzica <mihai-
> octavian.urzica@nxp.com>; Vlad Pruteanu <vlad.pruteanu@nxp.com>; Andrei
> Istodorescu <andrei.istodorescu@nxp.com>; Iulia Tanasescu
> <iulia.tanasescu@nxp.com>
> Subject: [EXT] Re: [PATCH BlueZ 2/2] player: Allow endpoint config without local
> endpoint argument
> 
> Caution: This is an external email. Please take care when clicking links or
> opening attachments. When in doubt, report the message using the 'Report this
> email' button
> 
> 
> Hi Silviu,
> 
> On Wed, Mar 20, 2024 at 2:42PM Silviu Florian Barbulescu
> <silviu.barbulescu@nxp.com> wrote:
> >
> > Update endpoint config command to create local endpoint for broadcast
> > endpoint, this will be used to configure a broadcast source\sink if
> > register endpoint is done from another application like PipeWire
> 
> Sorry but will not gona fly, we don't have any business with endpoints from
> other process in the system, in fact we might actually make it strictly prohibit
> for third-party process to use SetConfiguration with endpoint that do not belong
> their own D-Bus connection, same for MediaTransport, they shall only be
> acquired by the process that created them.
> 
> Also I remember quite clearly stating that we would move away from using
> MediaEndpoint for Broadcast Sink, instead what we shall be doing is
> enumerating BIS as MediaTransport directly so the likes of pipewire can Acquire
> them directly without doing any configuration since they are already configured
> over the air. Broadcast source will probably require a special interface at
> pipewire side, or perhaps a dedicated card which gets configured via some
> configuration file, etc, but we shall not depend on bluetoothctl to configured it,
> that will just make things more complicated than really helping.
> 

We are investigating a solution with the broadcast source configuration
from PipeWire and also removing the MediaEndpoint reliance for the broadcast sink.

> > ---
> >  client/player.c | 80
> > +++++++++++++++++++++++++++++++++++++++++++++++--
> >  1 file changed, 77 insertions(+), 3 deletions(-)
> >
> > diff --git a/client/player.c b/client/player.c index
> > ab33bfc46..b02a40423 100644
> > --- a/client/player.c
> > +++ b/client/player.c
> > @@ -3662,10 +3662,15 @@ static void endpoint_set_config_bcast(struct
> endpoint_config *cfg)
> >                 config_endpoint_iso_group, cfg);  }
> >
> > +static void endpoint_init_defaults(struct endpoint *ep);
> >  static void cmd_config_endpoint(int argc, char *argv[])  {
> > +       DBusMessageIter iter;
> >         struct endpoint_config *cfg;
> > -       const struct codec_preset *preset;
> > +       const struct codec_preset *preset = NULL;
> > +       const struct capabilities *cap;
> > +       uint8_t codec;
> > +       const char *uuid;
> >
> >         cfg = new0(struct endpoint_config, 1);
> >
> > @@ -3680,8 +3685,75 @@ static void cmd_config_endpoint(int argc, char
> *argv[])
> >         /* Search for the local endpoint */
> >         cfg->ep = endpoint_find(argv[2]);
> >         if (!cfg->ep) {
> > -               bt_shell_printf("Local Endpoint %s not found\n", argv[2]);
> > -               goto fail;
> > +               /* If argc != 3 then argv[2] should be the
> > +                * local endpoint. Return error.
> > +                */
> > +               if (argc != 3) {
> > +                       bt_shell_printf("Local Endpoint %s not found\n",
> > +                                       argv[2]);
> > +                       goto fail;
> > +               }
> > +
> > +               /* If local endpoint is not found verify if this is a
> > +                * broadcast remote endpoint because this can be an
> > +                * endpoint config command with remote endpoint and
> > +                * preset. In this case we have to create its own
> > +                * local endpoint.
> > +                */
> > +               if (!g_dbus_proxy_get_property(cfg->proxy, "UUID", &iter))
> > +                       return;
> > +               dbus_message_iter_get_basic(&iter, &uuid);
> > +
> > +               /* The local endpoint must have the UUID of local pac but
> > +                * the remote endpoint has the UUID of the remote pac, so
> > +                * based on this information we determine the UUID for the
> > +                * local endpoint.
> > +                */
> > +               if (!strcmp(uuid, BAA_SERVICE_UUID))
> > +                       uuid = BCAA_SERVICE_UUID;
> > +               else if (!strcmp(uuid, BCAA_SERVICE_UUID))
> > +                       uuid = BAA_SERVICE_UUID;
> > +               else {
> > +                       /* This should be a local endpoint because is not
> > +                        * a broadcast endpoint.
> > +                        */
> > +                       bt_shell_printf("Local Endpoint %s not found\n",
> > +                                       argv[2]);
> > +                       goto fail;
> > +               }
> > +
> > +               if (!g_dbus_proxy_get_property(cfg->proxy, "Codec", &iter))
> > +                       return;
> > +
> > +               dbus_message_iter_get_basic(&iter, &codec);
> > +
> > +               /* Verify if the local endpoint already exists */
> > +               cfg->ep = endpoint_find(uuid);
> > +               if ((!cfg->ep) || (cfg->ep->codec != codec)) {
> > +                       /* Get capabilities to create the local endpoint */
> > +                       cap = find_capabilities(uuid, codec);
> > +                       if (!cap) {
> > +                               bt_shell_printf(
> > +                                       "Capabilities not found for UUID %s, codec id %d",
> > +                                       uuid, codec);
> > +                               goto fail;
> > +                       }
> > +
> > +                       cfg->ep = endpoint_new(cap);
> > +                       endpoint_init_defaults(cfg->ep);
> > +               }
> > +
> > +               /* Verify if argv[2] parameter is a valid preset */
> > +               preset = preset_find_name(cfg->ep->preset, argv[2]);
> > +               if (!preset) {
> > +                       bt_shell_printf("Preset %s not found\n",
> > +                               argv[2]);
> > +                       /* Free created endpoint */
> > +                       local_endpoints = g_list_remove(local_endpoints,
> > +                                               cfg->ep);
> > +                       endpoint_free(cfg->ep);
> > +                       goto fail;
> > +               }
> >         }
> >
> >         if (argc > 3) {
> > @@ -3690,7 +3762,9 @@ static void cmd_config_endpoint(int argc, char
> *argv[])
> >                         bt_shell_printf("Preset %s not found\n", argv[3]);
> >                         goto fail;
> >                 }
> > +       }
> >
> > +       if (preset) {
> >                 cfg->caps = g_new0(struct iovec, 1);
> >                 /* Copy capabilities */
> >                 util_iov_append(cfg->caps, preset->data.iov_base,
> > --
> > 2.39.2
> >
> 
> 
> --
> Luiz Augusto von Dentz


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH BlueZ 0/2] Allow endpoint config without local endpoint argument
  2024-03-20 14:41 [PATCH BlueZ 0/2] Allow endpoint config without local endpoint argument Silviu Florian Barbulescu
  2024-03-20 14:41 ` [PATCH BlueZ 1/2] bap: Add bcast source support for MediaEndpoint Codec Silviu Florian Barbulescu
  2024-03-20 14:41 ` [PATCH BlueZ 2/2] player: " Silviu Florian Barbulescu
@ 2024-03-28 14:40 ` patchwork-bot+bluetooth
  2 siblings, 0 replies; 7+ messages in thread
From: patchwork-bot+bluetooth @ 2024-03-28 14:40 UTC (permalink / raw)
  To: Silviu Florian Barbulescu
  Cc: linux-bluetooth, mihai-octavian.urzica, vlad.pruteanu,
	andrei.istodorescu, luiz.dentz, iulia.tanasescu

Hello:

This series was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Wed, 20 Mar 2024 16:41:51 +0200 you wrote:
> Update endpoint config command to create a local endpoint for broadcast
> endpoint.
> This will be used to configure a broadcast source/sink if
> register endpoint is done from another application like PipeWire
> 
> Sample output from using the endpoint.config with endpoint and preset
> to configure a broadcast sink to connect to a BIS.
> The register endpoint for the broadcast sink has been done with PipeWire.
> [Waiting to connect to bluetoothd...
> [bluetooth]Agent registered
> [bluetooth]hci0 new_settings: powered bondable le secure-conn
> cis-central cis-peripheral iso-broadcaster sync-receiver
> [bluetooth][CHG[0m] Controller C0:07:E8:CE:94:CD Pairable: yes
> [bluetooth]AdvertisementMonitor path registered
> [bluetooth]scan on
> [?2004h[bluetooth]SetDiscoveryFilter success
> [bluetooth]Discovery started
> [bluetooth][CHG Controller C0:07:E8:CE:94:CD Discovering: yes
> [bluetooth][NEW [Device 18:41:1D:57:63:C6 18-41-1D-57-63-C6
> [bluetooth][NEW Endpoint /org/bluez/hci0/dev_18_41_1D_57_63_C6/pac_bcast0
> mendpoint.config /org/bluez/hci0/dev_18_41_1D_57_63_C6/pac_bcast0 48_4_1
> endpoint.config /org/bluez/hci0/dev_18_41_1D_57_63_C6/pac_bcast0 48_4_1
> Configuration.#0: len 0x02 type 0x01
> Configuration.Sampling Frequency: 48 Khz (0x08)
> Configuration.#1: len 0x02 type 0x02
> Configuration.Frame Duration: 10 ms (0x01)
> Configuration.#2: len 0x03 type 0x04
> Configuration.Frame Length: 120 (0x0078)
> BCode:
> 01 02 68 05 53 f1 41 5a a2 65 bb af c6 ea 03 b8 ..h.S.AZ.e......
> Framing 0x00
> PresentationDelay 40000
> Interval 10000
> PHY 0x02
> SDU 120
> Retransmissions 4
> Latency 20
> [NEW Transport /org/bluez/hci0/dev_18_41_1D_57_63_C6/pac_bcast0/fd0
> [bluetooth]Endpoint /local/endpoint/baa/lc3 configured
> Sample output from using the endpoint.config with endpoint and preset
> to configure a broadcast source BIS.
> The register endpoint has been done with PipeWire.
> [Waiting to connect to bluetoothd...
> [[bluetooth][0m# Agent registered
> [[bluetooth][0m# hci0 new_settings: powered bondable le secure-conn
> cis-central cis-peripheral iso-broadcaster sync-receiver
> [[bluetooth][0m# [[CHG[0m] Controller C0:07:E8:CE:94:CD Pairable: yes
> [[bluetooth][0m# AdvertisementMonitor path registered
> [[bluetooth][0m# [[NEW[0m] Endpoint /org/bluez/hci0/pac_bcast0
> [[bluetooth][0m# [7mendpoint.config /org/bluez/hci0/pac_bcast0 48_4_1
> endpoint.config /org/bluez/hci0/pac_bcast0 48_4_1
> [[1;39m[/local/endpoint/bcaa/lc3] BIG (auto/value): [0m0
> [[1;39m[/local/endpoint/bcaa/lc3] Enter channel location (value/no): [0m1
> [[1;39m[/local/endpoint/bcaa/lc3] Enter Metadata (value/no): [0mn
> Configuration.#0: len 0x02 type 0x01
> Configuration.Sampling Frequency: 48 Khz (0x08)
> Configuration.#1: len 0x02 type 0x02
> Configuration.Frame Duration: 10 ms (0x01)
> Configuration.#2: len 0x03 type 0x04
> Configuration.Frame Length: 120 (0x0078)
> Configuration.#3: len 0x05 type 0x03
> Configuration.Location: 0x00000001
> Configuration.Location: Front Left (0x00000001)
> BIG 0x00
> BCode:
> 01 02 68 05 53 f1 41 5a a2 65 bb af c6 ea 03 b8 ..h.S.AZ.e......
> Framing 0x00
> PresentationDelay 40000
> Interval 10000
> PHY 0x02
> SDU 120
> Retransmissions 4
> Latency 20
> [[[bluetooth][0m# [[NEW[0m] Transport /org/bluez/hci0/pac_bcast0/fd0
> [[bluetooth][0m# Endpoint /local/endpoint/bcaa/lc3 configured
> 
> [...]

Here is the summary with links:
  - [BlueZ,1/2] bap: Add bcast source support for MediaEndpoint Codec
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=0ff7392af164
  - [BlueZ,2/2] player: Allow endpoint config without local endpoint argument
    (no matching commit)

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-03-28 14:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-20 14:41 [PATCH BlueZ 0/2] Allow endpoint config without local endpoint argument Silviu Florian Barbulescu
2024-03-20 14:41 ` [PATCH BlueZ 1/2] bap: Add bcast source support for MediaEndpoint Codec Silviu Florian Barbulescu
2024-03-20 17:05   ` Allow endpoint config without local endpoint argument bluez.test.bot
2024-03-20 14:41 ` [PATCH BlueZ 2/2] player: " Silviu Florian Barbulescu
2024-03-20 17:32   ` Luiz Augusto von Dentz
2024-03-21 11:33     ` Silviu Florian Barbulescu
2024-03-28 14:40 ` [PATCH BlueZ 0/2] " patchwork-bot+bluetooth

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.