All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC, BlueZ] bap: check adapter support before enabling BAP
@ 2023-01-27 20:52 Pauli Virtanen
  2023-01-27 21:12 ` [RFC,BlueZ] " bluez.test.bot
                   ` (4 more replies)
  0 siblings, 5 replies; 43+ messages in thread
From: Pauli Virtanen @ 2023-01-27 20:52 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Pauli Virtanen

Hi,

When the BT adapter does not have the "Connected Isochronous Stream - Central"
feature, establishing ISO connections fails at a late stage.  Namely, we get
EOPNOTSUPP in connect() due to cis_central_capable(hdev) being false.  However,
at that point BlueZ and the rest of the userspace like sound servers have
already set up the BAP stuff, and think they are trying to do something that
should succeed under normal conditions.

It appears the information about what features the adapter actually has should
be available to BlueZ earlier, and BlueZ should provide accurate information
about the adapter capabilities to the rest of the userspace.

For LE Audio in particular this is sort of important, because the adapter
support is not currently there, and only fairly new adapter models have these
features. There's also a few other bits (Core Sec 4.6, table 4.6) that BlueZ
might need to know later on, once support for more LE Audio parts is added.

At the moment the ISO sockets are under the experimental feature flag, so I'm
not sure if this is something that is to be added right now.

Below is a quick hack, which just exposes these bits to the mgmt settings a la
WBS and handles them in BlueZ.  But would this be the right place to put them
in the first place? Other ideas?  Trying to connect() to some random addresses
from userspace just to probe the feature capability probably is not the right
thing.


---
 doc/mgmt-api.txt       |  2 ++
 lib/mgmt.h             |  1 +
 profiles/audio/bap.c   |  5 +++++
 profiles/audio/media.c |  3 +++
 src/adapter.c          | 11 +++++++++++
 src/adapter.h          |  6 ++++++
 tools/btmgmt.c         |  1 +
 7 files changed, 29 insertions(+)

 include/net/bluetooth/mgmt.h | 1 +
 net/bluetooth/mgmt.c         | 6 ++++++
 2 files changed, 7 insertions(+)


diff --git a/doc/mgmt-api.txt b/doc/mgmt-api.txt
index 90d612ed8..11798629a 100644
--- a/doc/mgmt-api.txt
+++ b/doc/mgmt-api.txt
@@ -333,6 +333,7 @@ Read Controller Information Command
 		16	PHY Configuration
 		17	Wideband Speech
 		18	Quality Report
+		19	Connected Isochronous Stream Central
 
 	This command generates a Command Complete event on success or
 	a Command Status event on failure.
@@ -2926,6 +2927,7 @@ Read Extended Controller Information Command
 		16	PHY Configuration
 		17	Wideband Speech
 		18	Quality Report
+		19	Connected Isochronous Stream Central
 
 	The EIR_Data field contains information about class of device,
 	local name and other values. Not all of them might be present. For
diff --git a/lib/mgmt.h b/lib/mgmt.h
index 796190cd9..610770491 100644
--- a/lib/mgmt.h
+++ b/lib/mgmt.h
@@ -96,6 +96,7 @@ struct mgmt_rp_read_index_list {
 #define MGMT_SETTING_STATIC_ADDRESS	0x00008000
 #define MGMT_SETTING_PHY_CONFIGURATION	0x00010000
 #define MGMT_SETTING_WIDEBAND_SPEECH	0x00020000
+#define MGMT_SETTING_CIS_CENTRAL	0x00040000
 
 #define MGMT_OP_READ_INFO		0x0004
 struct mgmt_rp_read_info {
diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
index e5ffb7230..2cd12465a 100644
--- a/profiles/audio/bap.c
+++ b/profiles/audio/bap.c
@@ -1264,6 +1264,11 @@ static int bap_probe(struct btd_service *service)
 		return -ENOTSUP;
 	}
 
+	if (!btd_adapter_has_feature(adapter, ADAPTER_FEAT_CIS_CENTRAL)) {
+		error("BAP requires CIS Central, but unsupported by adapter");
+		return -ENOTSUP;
+	}
+
 	/* Ignore, if we were probed for this device already */
 	if (data) {
 		error("Profile probed twice for the same device!");
diff --git a/profiles/audio/media.c b/profiles/audio/media.c
index fbb350889..873dee33e 100644
--- a/profiles/audio/media.c
+++ b/profiles/audio/media.c
@@ -1259,6 +1259,9 @@ static bool experimental_endpoint_supported(struct btd_adapter *adapter)
 	if (!btd_adapter_has_exp_feature(adapter, EXP_FEAT_ISO_SOCKET))
 		return false;
 
+	if (!btd_adapter_has_feature(adapter, ADAPTER_FEAT_CIS_CENTRAL))
+		return false;
+
 	return g_dbus_get_flags() & G_DBUS_FLAG_ENABLE_EXPERIMENTAL;
 }
 
diff --git a/src/adapter.c b/src/adapter.c
index aadad4016..2e038ace0 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -10717,6 +10717,17 @@ bool btd_has_kernel_features(uint32_t features)
 	return (kernel_features & features) ? true : false;
 }
 
+bool btd_adapter_has_feature(struct btd_adapter *adapter, uint32_t feature)
+{
+	size_t i;
+	uint32_t features = 0;
+
+	if (adapter->supported_settings & MGMT_SETTING_CIS_CENTRAL)
+		features |= ADAPTER_FEAT_CIS_CENTRAL;
+
+	return features & feature;
+}
+
 bool btd_adapter_has_exp_feature(struct btd_adapter *adapter, uint32_t feature)
 {
 	size_t i;
diff --git a/src/adapter.h b/src/adapter.h
index 78eb069ae..6a9a626bc 100644
--- a/src/adapter.h
+++ b/src/adapter.h
@@ -256,6 +256,12 @@ void btd_adapter_for_each_device(struct btd_adapter *adapter,
 
 bool btd_le_connect_before_pairing(void);
 
+enum adapter_features {
+	ADAPTER_FEAT_CIS_CENTRAL	= 1 << 0,
+};
+
+bool btd_adapter_has_feature(struct btd_adapter *adapter, uint32_t feature);
+
 enum experimental_features {
 	EXP_FEAT_DEBUG			= 1 << 0,
 	EXP_FEAT_LE_SIMULT_ROLES	= 1 << 1,
diff --git a/tools/btmgmt.c b/tools/btmgmt.c
index 29f86091f..de614ced1 100644
--- a/tools/btmgmt.c
+++ b/tools/btmgmt.c
@@ -353,6 +353,7 @@ static const char *settings_str[] = {
 				"static-addr",
 				"phy-configuration",
 				"wide-band-speech",
+				"cis-central",
 };
 
 static const char *settings2str(uint32_t settings)
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
index 743f6f59dff8..dc284c5f5cbb 100644
--- a/include/net/bluetooth/mgmt.h
+++ b/include/net/bluetooth/mgmt.h
@@ -109,6 +109,7 @@ struct mgmt_rp_read_index_list {
 #define MGMT_SETTING_STATIC_ADDRESS	0x00008000
 #define MGMT_SETTING_PHY_CONFIGURATION	0x00010000
 #define MGMT_SETTING_WIDEBAND_SPEECH	0x00020000
+#define MGMT_SETTING_CIS_CENTRAL	0x00040000
 
 #define MGMT_OP_READ_INFO		0x0004
 #define MGMT_READ_INFO_SIZE		0
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 0dd30a3beb77..d802faf60f26 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -859,6 +859,9 @@ static u32 get_supported_settings(struct hci_dev *hdev)
 	    hdev->set_bdaddr)
 		settings |= MGMT_SETTING_CONFIGURATION;
 
+	if (cis_central_capable(hdev))
+		settings |= MGMT_SETTING_CIS_CENTRAL;
+
 	settings |= MGMT_SETTING_PHY_CONFIGURATION;
 
 	return settings;
@@ -932,6 +935,9 @@ static u32 get_current_settings(struct hci_dev *hdev)
 	if (hci_dev_test_flag(hdev, HCI_WIDEBAND_SPEECH_ENABLED))
 		settings |= MGMT_SETTING_WIDEBAND_SPEECH;
 
+	if (cis_central_capable(hdev) && iso_enabled())
+		settings |= MGMT_SETTING_CIS_CENTRAL;
+
 	return settings;
 }
 
-- 
2.39.1


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

* RE: [RFC,BlueZ] bap: check adapter support before enabling BAP
  2023-01-27 20:52 [RFC, BlueZ] bap: check adapter support before enabling BAP Pauli Virtanen
@ 2023-01-27 21:12 ` bluez.test.bot
  2023-01-28  0:28 ` [RFC, BlueZ] " Luiz Augusto von Dentz
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 43+ messages in thread
From: bluez.test.bot @ 2023-01-27 21:12 UTC (permalink / raw)
  To: linux-bluetooth, pav

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

This is an automated email and please do not reply to this email.

Dear Submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
While preparing the CI tests, the patches you submitted couldn't be applied to the current HEAD of the repository.

----- Output -----

error: include/net/bluetooth/mgmt.h: does not exist in index
error: net/bluetooth/mgmt.c: does not exist in index
hint: Use 'git am --show-current-patch' to see the failed patch

Please resolve the issue and submit the patches again.


---
Regards,
Linux Bluetooth


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

* Re: [RFC, BlueZ] bap: check adapter support before enabling BAP
  2023-01-27 20:52 [RFC, BlueZ] bap: check adapter support before enabling BAP Pauli Virtanen
  2023-01-27 21:12 ` [RFC,BlueZ] " bluez.test.bot
@ 2023-01-28  0:28 ` Luiz Augusto von Dentz
  2023-01-28  0:29   ` Luiz Augusto von Dentz
  2023-01-28  9:26   ` Pauli Virtanen
  2023-01-30 18:37 ` [PATCH BlueZ 1/8] doc: add MGMT setting for CIS features, remove Quality Report Pauli Virtanen
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 43+ messages in thread
From: Luiz Augusto von Dentz @ 2023-01-28  0:28 UTC (permalink / raw)
  To: Pauli Virtanen; +Cc: linux-bluetooth

Hi Pauli,

On Fri, Jan 27, 2023 at 12:56 PM Pauli Virtanen <pav@iki.fi> wrote:
>
> Hi,
>
> When the BT adapter does not have the "Connected Isochronous Stream - Central"
> feature, establishing ISO connections fails at a late stage.  Namely, we get
> EOPNOTSUPP in connect() due to cis_central_capable(hdev) being false.  However,
> at that point BlueZ and the rest of the userspace like sound servers have
> already set up the BAP stuff, and think they are trying to do something that
> should succeed under normal conditions.
>
> It appears the information about what features the adapter actually has should
> be available to BlueZ earlier, and BlueZ should provide accurate information
> about the adapter capabilities to the rest of the userspace.
>
> For LE Audio in particular this is sort of important, because the adapter
> support is not currently there, and only fairly new adapter models have these
> features. There's also a few other bits (Core Sec 4.6, table 4.6) that BlueZ
> might need to know later on, once support for more LE Audio parts is added.
>
> At the moment the ISO sockets are under the experimental feature flag, so I'm
> not sure if this is something that is to be added right now.
>
> Below is a quick hack, which just exposes these bits to the mgmt settings a la
> WBS and handles them in BlueZ.  But would this be the right place to put them
> in the first place? Other ideas?  Trying to connect() to some random addresses
> from userspace just to probe the feature capability probably is not the right
> thing.

While it is probably a good idea to add as a feature it should be
tight to ISO sockets itself, and perhaps we should have both central
and peripheral flags so we can detect if we need to register the GATT
services when registering the MediaEndpoint.

>
> ---
>  doc/mgmt-api.txt       |  2 ++
>  lib/mgmt.h             |  1 +
>  profiles/audio/bap.c   |  5 +++++
>  profiles/audio/media.c |  3 +++
>  src/adapter.c          | 11 +++++++++++
>  src/adapter.h          |  6 ++++++
>  tools/btmgmt.c         |  1 +
>  7 files changed, 29 insertions(+)
>
>  include/net/bluetooth/mgmt.h | 1 +
>  net/bluetooth/mgmt.c         | 6 ++++++
>  2 files changed, 7 insertions(+)
>
>
> diff --git a/doc/mgmt-api.txt b/doc/mgmt-api.txt
> index 90d612ed8..11798629a 100644
> --- a/doc/mgmt-api.txt
> +++ b/doc/mgmt-api.txt
> @@ -333,6 +333,7 @@ Read Controller Information Command
>                 16      PHY Configuration
>                 17      Wideband Speech
>                 18      Quality Report
> +               19      Connected Isochronous Stream Central
>
>         This command generates a Command Complete event on success or
>         a Command Status event on failure.
> @@ -2926,6 +2927,7 @@ Read Extended Controller Information Command
>                 16      PHY Configuration
>                 17      Wideband Speech
>                 18      Quality Report
> +               19      Connected Isochronous Stream Central
>
>         The EIR_Data field contains information about class of device,
>         local name and other values. Not all of them might be present. For
> diff --git a/lib/mgmt.h b/lib/mgmt.h
> index 796190cd9..610770491 100644
> --- a/lib/mgmt.h
> +++ b/lib/mgmt.h
> @@ -96,6 +96,7 @@ struct mgmt_rp_read_index_list {
>  #define MGMT_SETTING_STATIC_ADDRESS    0x00008000
>  #define MGMT_SETTING_PHY_CONFIGURATION 0x00010000
>  #define MGMT_SETTING_WIDEBAND_SPEECH   0x00020000
> +#define MGMT_SETTING_CIS_CENTRAL       0x00040000
>
>  #define MGMT_OP_READ_INFO              0x0004
>  struct mgmt_rp_read_info {
> diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
> index e5ffb7230..2cd12465a 100644
> --- a/profiles/audio/bap.c
> +++ b/profiles/audio/bap.c
> @@ -1264,6 +1264,11 @@ static int bap_probe(struct btd_service *service)
>                 return -ENOTSUP;
>         }
>
> +       if (!btd_adapter_has_feature(adapter, ADAPTER_FEAT_CIS_CENTRAL)) {
> +               error("BAP requires CIS Central, but unsupported by adapter");
> +               return -ENOTSUP;

In theory this is correct, BAP shall only be used by the central, but
we need to make sure the code doesn't assume bap driver is also needed
when acting as peripheral.

> +       }
> +
>         /* Ignore, if we were probed for this device already */
>         if (data) {
>                 error("Profile probed twice for the same device!");
> diff --git a/profiles/audio/media.c b/profiles/audio/media.c
> index fbb350889..873dee33e 100644
> --- a/profiles/audio/media.c
> +++ b/profiles/audio/media.c
> @@ -1259,6 +1259,9 @@ static bool experimental_endpoint_supported(struct btd_adapter *adapter)
>         if (!btd_adapter_has_exp_feature(adapter, EXP_FEAT_ISO_SOCKET))
>                 return false;
>
> +       if (!btd_adapter_has_feature(adapter, ADAPTER_FEAT_CIS_CENTRAL))
> +               return false;

We can act both as central and peripheral so we need to check none of
those are supported then the UUIDs shall not be listed.

>         return g_dbus_get_flags() & G_DBUS_FLAG_ENABLE_EXPERIMENTAL;
>  }
>
> diff --git a/src/adapter.c b/src/adapter.c
> index aadad4016..2e038ace0 100644
> --- a/src/adapter.c
> +++ b/src/adapter.c
> @@ -10717,6 +10717,17 @@ bool btd_has_kernel_features(uint32_t features)
>         return (kernel_features & features) ? true : false;
>  }
>
> +bool btd_adapter_has_feature(struct btd_adapter *adapter, uint32_t feature)
> +{
> +       size_t i;
> +       uint32_t features = 0;
> +
> +       if (adapter->supported_settings & MGMT_SETTING_CIS_CENTRAL)
> +               features |= ADAPTER_FEAT_CIS_CENTRAL;
> +
> +       return features & feature;
> +}
> +
>  bool btd_adapter_has_exp_feature(struct btd_adapter *adapter, uint32_t feature)
>  {
>         size_t i;
> diff --git a/src/adapter.h b/src/adapter.h
> index 78eb069ae..6a9a626bc 100644
> --- a/src/adapter.h
> +++ b/src/adapter.h
> @@ -256,6 +256,12 @@ void btd_adapter_for_each_device(struct btd_adapter *adapter,
>
>  bool btd_le_connect_before_pairing(void);
>
> +enum adapter_features {
> +       ADAPTER_FEAT_CIS_CENTRAL        = 1 << 0,
> +};
> +
> +bool btd_adapter_has_feature(struct btd_adapter *adapter, uint32_t feature);
> +
>  enum experimental_features {
>         EXP_FEAT_DEBUG                  = 1 << 0,
>         EXP_FEAT_LE_SIMULT_ROLES        = 1 << 1,
> diff --git a/tools/btmgmt.c b/tools/btmgmt.c
> index 29f86091f..de614ced1 100644
> --- a/tools/btmgmt.c
> +++ b/tools/btmgmt.c
> @@ -353,6 +353,7 @@ static const char *settings_str[] = {
>                                 "static-addr",
>                                 "phy-configuration",
>                                 "wide-band-speech",
> +                               "cis-central",
>  };
>
>  static const char *settings2str(uint32_t settings)
> diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
> index 743f6f59dff8..dc284c5f5cbb 100644
> --- a/include/net/bluetooth/mgmt.h
> +++ b/include/net/bluetooth/mgmt.h
> @@ -109,6 +109,7 @@ struct mgmt_rp_read_index_list {
>  #define MGMT_SETTING_STATIC_ADDRESS    0x00008000
>  #define MGMT_SETTING_PHY_CONFIGURATION 0x00010000
>  #define MGMT_SETTING_WIDEBAND_SPEECH   0x00020000
> +#define MGMT_SETTING_CIS_CENTRAL       0x00040000
>
>  #define MGMT_OP_READ_INFO              0x0004
>  #define MGMT_READ_INFO_SIZE            0
> diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
> index 0dd30a3beb77..d802faf60f26 100644
> --- a/net/bluetooth/mgmt.c
> +++ b/net/bluetooth/mgmt.c
> @@ -859,6 +859,9 @@ static u32 get_supported_settings(struct hci_dev *hdev)
>             hdev->set_bdaddr)
>                 settings |= MGMT_SETTING_CONFIGURATION;
>
> +       if (cis_central_capable(hdev))
> +               settings |= MGMT_SETTING_CIS_CENTRAL;
> +
>         settings |= MGMT_SETTING_PHY_CONFIGURATION;
>
>         return settings;
> @@ -932,6 +935,9 @@ static u32 get_current_settings(struct hci_dev *hdev)
>         if (hci_dev_test_flag(hdev, HCI_WIDEBAND_SPEECH_ENABLED))
>                 settings |= MGMT_SETTING_WIDEBAND_SPEECH;
>
> +       if (cis_central_capable(hdev) && iso_enabled())
> +               settings |= MGMT_SETTING_CIS_CENTRAL;

I'd drop iso_enabled() from above, the features bits shall indicate
the controller capability only, right now ISO packets can only be
transferred via ISO sockets but this may change in the future if
vendors decide they need a more specialized transport for audio.

>         return settings;
>  }
>
> --
> 2.39.1
>


-- 
Luiz Augusto von Dentz

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

* Re: [RFC, BlueZ] bap: check adapter support before enabling BAP
  2023-01-28  0:28 ` [RFC, BlueZ] " Luiz Augusto von Dentz
@ 2023-01-28  0:29   ` Luiz Augusto von Dentz
  2023-01-28  9:26   ` Pauli Virtanen
  1 sibling, 0 replies; 43+ messages in thread
From: Luiz Augusto von Dentz @ 2023-01-28  0:29 UTC (permalink / raw)
  To: Pauli Virtanen; +Cc: linux-bluetooth

Hi Pauli,

On Fri, Jan 27, 2023 at 4:28 PM Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
>
> Hi Pauli,
>
> On Fri, Jan 27, 2023 at 12:56 PM Pauli Virtanen <pav@iki.fi> wrote:
> >
> > Hi,
> >
> > When the BT adapter does not have the "Connected Isochronous Stream - Central"
> > feature, establishing ISO connections fails at a late stage.  Namely, we get
> > EOPNOTSUPP in connect() due to cis_central_capable(hdev) being false.  However,
> > at that point BlueZ and the rest of the userspace like sound servers have
> > already set up the BAP stuff, and think they are trying to do something that
> > should succeed under normal conditions.
> >
> > It appears the information about what features the adapter actually has should
> > be available to BlueZ earlier, and BlueZ should provide accurate information
> > about the adapter capabilities to the rest of the userspace.
> >
> > For LE Audio in particular this is sort of important, because the adapter
> > support is not currently there, and only fairly new adapter models have these
> > features. There's also a few other bits (Core Sec 4.6, table 4.6) that BlueZ
> > might need to know later on, once support for more LE Audio parts is added.
> >
> > At the moment the ISO sockets are under the experimental feature flag, so I'm
> > not sure if this is something that is to be added right now.
> >
> > Below is a quick hack, which just exposes these bits to the mgmt settings a la
> > WBS and handles them in BlueZ.  But would this be the right place to put them
> > in the first place? Other ideas?  Trying to connect() to some random addresses
> > from userspace just to probe the feature capability probably is not the right
> > thing.
>
> While it is probably a good idea to add as a feature it should be

Correction, *shouldn't

> tight to ISO sockets itself, and perhaps we should have both central
> and peripheral flags so we can detect if we need to register the GATT
> services when registering the MediaEndpoint.
>
> >
> > ---
> >  doc/mgmt-api.txt       |  2 ++
> >  lib/mgmt.h             |  1 +
> >  profiles/audio/bap.c   |  5 +++++
> >  profiles/audio/media.c |  3 +++
> >  src/adapter.c          | 11 +++++++++++
> >  src/adapter.h          |  6 ++++++
> >  tools/btmgmt.c         |  1 +
> >  7 files changed, 29 insertions(+)
> >
> >  include/net/bluetooth/mgmt.h | 1 +
> >  net/bluetooth/mgmt.c         | 6 ++++++
> >  2 files changed, 7 insertions(+)
> >
> >
> > diff --git a/doc/mgmt-api.txt b/doc/mgmt-api.txt
> > index 90d612ed8..11798629a 100644
> > --- a/doc/mgmt-api.txt
> > +++ b/doc/mgmt-api.txt
> > @@ -333,6 +333,7 @@ Read Controller Information Command
> >                 16      PHY Configuration
> >                 17      Wideband Speech
> >                 18      Quality Report
> > +               19      Connected Isochronous Stream Central
> >
> >         This command generates a Command Complete event on success or
> >         a Command Status event on failure.
> > @@ -2926,6 +2927,7 @@ Read Extended Controller Information Command
> >                 16      PHY Configuration
> >                 17      Wideband Speech
> >                 18      Quality Report
> > +               19      Connected Isochronous Stream Central
> >
> >         The EIR_Data field contains information about class of device,
> >         local name and other values. Not all of them might be present. For
> > diff --git a/lib/mgmt.h b/lib/mgmt.h
> > index 796190cd9..610770491 100644
> > --- a/lib/mgmt.h
> > +++ b/lib/mgmt.h
> > @@ -96,6 +96,7 @@ struct mgmt_rp_read_index_list {
> >  #define MGMT_SETTING_STATIC_ADDRESS    0x00008000
> >  #define MGMT_SETTING_PHY_CONFIGURATION 0x00010000
> >  #define MGMT_SETTING_WIDEBAND_SPEECH   0x00020000
> > +#define MGMT_SETTING_CIS_CENTRAL       0x00040000
> >
> >  #define MGMT_OP_READ_INFO              0x0004
> >  struct mgmt_rp_read_info {
> > diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
> > index e5ffb7230..2cd12465a 100644
> > --- a/profiles/audio/bap.c
> > +++ b/profiles/audio/bap.c
> > @@ -1264,6 +1264,11 @@ static int bap_probe(struct btd_service *service)
> >                 return -ENOTSUP;
> >         }
> >
> > +       if (!btd_adapter_has_feature(adapter, ADAPTER_FEAT_CIS_CENTRAL)) {
> > +               error("BAP requires CIS Central, but unsupported by adapter");
> > +               return -ENOTSUP;
>
> In theory this is correct, BAP shall only be used by the central, but
> we need to make sure the code doesn't assume bap driver is also needed
> when acting as peripheral.
>
> > +       }
> > +
> >         /* Ignore, if we were probed for this device already */
> >         if (data) {
> >                 error("Profile probed twice for the same device!");
> > diff --git a/profiles/audio/media.c b/profiles/audio/media.c
> > index fbb350889..873dee33e 100644
> > --- a/profiles/audio/media.c
> > +++ b/profiles/audio/media.c
> > @@ -1259,6 +1259,9 @@ static bool experimental_endpoint_supported(struct btd_adapter *adapter)
> >         if (!btd_adapter_has_exp_feature(adapter, EXP_FEAT_ISO_SOCKET))
> >                 return false;
> >
> > +       if (!btd_adapter_has_feature(adapter, ADAPTER_FEAT_CIS_CENTRAL))
> > +               return false;
>
> We can act both as central and peripheral so we need to check none of
> those are supported then the UUIDs shall not be listed.
>
> >         return g_dbus_get_flags() & G_DBUS_FLAG_ENABLE_EXPERIMENTAL;
> >  }
> >
> > diff --git a/src/adapter.c b/src/adapter.c
> > index aadad4016..2e038ace0 100644
> > --- a/src/adapter.c
> > +++ b/src/adapter.c
> > @@ -10717,6 +10717,17 @@ bool btd_has_kernel_features(uint32_t features)
> >         return (kernel_features & features) ? true : false;
> >  }
> >
> > +bool btd_adapter_has_feature(struct btd_adapter *adapter, uint32_t feature)
> > +{
> > +       size_t i;
> > +       uint32_t features = 0;
> > +
> > +       if (adapter->supported_settings & MGMT_SETTING_CIS_CENTRAL)
> > +               features |= ADAPTER_FEAT_CIS_CENTRAL;
> > +
> > +       return features & feature;
> > +}
> > +
> >  bool btd_adapter_has_exp_feature(struct btd_adapter *adapter, uint32_t feature)
> >  {
> >         size_t i;
> > diff --git a/src/adapter.h b/src/adapter.h
> > index 78eb069ae..6a9a626bc 100644
> > --- a/src/adapter.h
> > +++ b/src/adapter.h
> > @@ -256,6 +256,12 @@ void btd_adapter_for_each_device(struct btd_adapter *adapter,
> >
> >  bool btd_le_connect_before_pairing(void);
> >
> > +enum adapter_features {
> > +       ADAPTER_FEAT_CIS_CENTRAL        = 1 << 0,
> > +};
> > +
> > +bool btd_adapter_has_feature(struct btd_adapter *adapter, uint32_t feature);
> > +
> >  enum experimental_features {
> >         EXP_FEAT_DEBUG                  = 1 << 0,
> >         EXP_FEAT_LE_SIMULT_ROLES        = 1 << 1,
> > diff --git a/tools/btmgmt.c b/tools/btmgmt.c
> > index 29f86091f..de614ced1 100644
> > --- a/tools/btmgmt.c
> > +++ b/tools/btmgmt.c
> > @@ -353,6 +353,7 @@ static const char *settings_str[] = {
> >                                 "static-addr",
> >                                 "phy-configuration",
> >                                 "wide-band-speech",
> > +                               "cis-central",
> >  };
> >
> >  static const char *settings2str(uint32_t settings)
> > diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
> > index 743f6f59dff8..dc284c5f5cbb 100644
> > --- a/include/net/bluetooth/mgmt.h
> > +++ b/include/net/bluetooth/mgmt.h
> > @@ -109,6 +109,7 @@ struct mgmt_rp_read_index_list {
> >  #define MGMT_SETTING_STATIC_ADDRESS    0x00008000
> >  #define MGMT_SETTING_PHY_CONFIGURATION 0x00010000
> >  #define MGMT_SETTING_WIDEBAND_SPEECH   0x00020000
> > +#define MGMT_SETTING_CIS_CENTRAL       0x00040000
> >
> >  #define MGMT_OP_READ_INFO              0x0004
> >  #define MGMT_READ_INFO_SIZE            0
> > diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
> > index 0dd30a3beb77..d802faf60f26 100644
> > --- a/net/bluetooth/mgmt.c
> > +++ b/net/bluetooth/mgmt.c
> > @@ -859,6 +859,9 @@ static u32 get_supported_settings(struct hci_dev *hdev)
> >             hdev->set_bdaddr)
> >                 settings |= MGMT_SETTING_CONFIGURATION;
> >
> > +       if (cis_central_capable(hdev))
> > +               settings |= MGMT_SETTING_CIS_CENTRAL;
> > +
> >         settings |= MGMT_SETTING_PHY_CONFIGURATION;
> >
> >         return settings;
> > @@ -932,6 +935,9 @@ static u32 get_current_settings(struct hci_dev *hdev)
> >         if (hci_dev_test_flag(hdev, HCI_WIDEBAND_SPEECH_ENABLED))
> >                 settings |= MGMT_SETTING_WIDEBAND_SPEECH;
> >
> > +       if (cis_central_capable(hdev) && iso_enabled())
> > +               settings |= MGMT_SETTING_CIS_CENTRAL;
>
> I'd drop iso_enabled() from above, the features bits shall indicate
> the controller capability only, right now ISO packets can only be
> transferred via ISO sockets but this may change in the future if
> vendors decide they need a more specialized transport for audio.
>
> >         return settings;
> >  }
> >
> > --
> > 2.39.1
> >
>
>
> --
> Luiz Augusto von Dentz



-- 
Luiz Augusto von Dentz

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

* Re: [RFC, BlueZ] bap: check adapter support before enabling BAP
  2023-01-28  0:28 ` [RFC, BlueZ] " Luiz Augusto von Dentz
  2023-01-28  0:29   ` Luiz Augusto von Dentz
@ 2023-01-28  9:26   ` Pauli Virtanen
  1 sibling, 0 replies; 43+ messages in thread
From: Pauli Virtanen @ 2023-01-28  9:26 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

Hi Luiz,

pe, 2023-01-27 kello 16:28 -0800, Luiz Augusto von Dentz kirjoitti:
> On Fri, Jan 27, 2023 at 12:56 PM Pauli Virtanen <pav@iki.fi> wrote:
> > When the BT adapter does not have the "Connected Isochronous Stream - Central"
> > feature, establishing ISO connections fails at a late stage.  Namely, we get
> > EOPNOTSUPP in connect() due to cis_central_capable(hdev) being false.  However,
> > at that point BlueZ and the rest of the userspace like sound servers have
> > already set up the BAP stuff, and think they are trying to do something that
> > should succeed under normal conditions.
> > 
> > It appears the information about what features the adapter actually has should
> > be available to BlueZ earlier, and BlueZ should provide accurate information
> > about the adapter capabilities to the rest of the userspace.
> > 
> > For LE Audio in particular this is sort of important, because the adapter
> > support is not currently there, and only fairly new adapter models have these
> > features. There's also a few other bits (Core Sec 4.6, table 4.6) that BlueZ
> > might need to know later on, once support for more LE Audio parts is added.
> > 
> > At the moment the ISO sockets are under the experimental feature flag, so I'm
> > not sure if this is something that is to be added right now.
> > 
> > Below is a quick hack, which just exposes these bits to the mgmt settings a la
> > WBS and handles them in BlueZ.  But would this be the right place to put them
> > in the first place? Other ideas?  Trying to connect() to some random addresses
> > from userspace just to probe the feature capability probably is not the right
> > thing.
> 
> While it is probably a good idea to add as a feature it should be
> tight to ISO sockets itself, and perhaps we should have both central
> and peripheral flags so we can detect if we need to register the GATT
> services when registering the MediaEndpoint.

Thanks, I'll make a proper patch along these lines then, with the three
CIS and BIS feature bits that are currently checked on kernel side in
connect() in the mgmt controller info.

> > 
> > ---
> >  doc/mgmt-api.txt       |  2 ++
> >  lib/mgmt.h             |  1 +
> >  profiles/audio/bap.c   |  5 +++++
> >  profiles/audio/media.c |  3 +++
> >  src/adapter.c          | 11 +++++++++++
> >  src/adapter.h          |  6 ++++++
> >  tools/btmgmt.c         |  1 +
> >  7 files changed, 29 insertions(+)
> > 
> >  include/net/bluetooth/mgmt.h | 1 +
> >  net/bluetooth/mgmt.c         | 6 ++++++
> >  2 files changed, 7 insertions(+)
> > 
> > 
> > diff --git a/doc/mgmt-api.txt b/doc/mgmt-api.txt
> > index 90d612ed8..11798629a 100644
> > --- a/doc/mgmt-api.txt
> > +++ b/doc/mgmt-api.txt
> > @@ -333,6 +333,7 @@ Read Controller Information Command
> >                 16      PHY Configuration
> >                 17      Wideband Speech
> >                 18      Quality Report
> > +               19      Connected Isochronous Stream Central
> > 
> >         This command generates a Command Complete event on success or
> >         a Command Status event on failure.
> > @@ -2926,6 +2927,7 @@ Read Extended Controller Information Command
> >                 16      PHY Configuration
> >                 17      Wideband Speech
> >                 18      Quality Report
> > +               19      Connected Isochronous Stream Central
> > 
> >         The EIR_Data field contains information about class of device,
> >         local name and other values. Not all of them might be present. For
> > diff --git a/lib/mgmt.h b/lib/mgmt.h
> > index 796190cd9..610770491 100644
> > --- a/lib/mgmt.h
> > +++ b/lib/mgmt.h
> > @@ -96,6 +96,7 @@ struct mgmt_rp_read_index_list {
> >  #define MGMT_SETTING_STATIC_ADDRESS    0x00008000
> >  #define MGMT_SETTING_PHY_CONFIGURATION 0x00010000
> >  #define MGMT_SETTING_WIDEBAND_SPEECH   0x00020000
> > +#define MGMT_SETTING_CIS_CENTRAL       0x00040000
> > 
> >  #define MGMT_OP_READ_INFO              0x0004
> >  struct mgmt_rp_read_info {
> > diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
> > index e5ffb7230..2cd12465a 100644
> > --- a/profiles/audio/bap.c
> > +++ b/profiles/audio/bap.c
> > @@ -1264,6 +1264,11 @@ static int bap_probe(struct btd_service *service)
> >                 return -ENOTSUP;
> >         }
> > 
> > +       if (!btd_adapter_has_feature(adapter, ADAPTER_FEAT_CIS_CENTRAL)) {
> > +               error("BAP requires CIS Central, but unsupported by adapter");
> > +               return -ENOTSUP;
> 
> In theory this is correct, BAP shall only be used by the central, but
> we need to make sure the code doesn't assume bap driver is also needed
> when acting as peripheral.
> 
> > +       }
> > +
> >         /* Ignore, if we were probed for this device already */
> >         if (data) {
> >                 error("Profile probed twice for the same device!");
> > diff --git a/profiles/audio/media.c b/profiles/audio/media.c
> > index fbb350889..873dee33e 100644
> > --- a/profiles/audio/media.c
> > +++ b/profiles/audio/media.c
> > @@ -1259,6 +1259,9 @@ static bool experimental_endpoint_supported(struct btd_adapter *adapter)
> >         if (!btd_adapter_has_exp_feature(adapter, EXP_FEAT_ISO_SOCKET))
> >                 return false;
> > 
> > +       if (!btd_adapter_has_feature(adapter, ADAPTER_FEAT_CIS_CENTRAL))
> > +               return false;
> 
> We can act both as central and peripheral so we need to check none of
> those are supported then the UUIDs shall not be listed.
> 
> >         return g_dbus_get_flags() & G_DBUS_FLAG_ENABLE_EXPERIMENTAL;
> >  }
> > 
> > diff --git a/src/adapter.c b/src/adapter.c
> > index aadad4016..2e038ace0 100644
> > --- a/src/adapter.c
> > +++ b/src/adapter.c
> > @@ -10717,6 +10717,17 @@ bool btd_has_kernel_features(uint32_t features)
> >         return (kernel_features & features) ? true : false;
> >  }
> > 
> > +bool btd_adapter_has_feature(struct btd_adapter *adapter, uint32_t feature)
> > +{
> > +       size_t i;
> > +       uint32_t features = 0;
> > +
> > +       if (adapter->supported_settings & MGMT_SETTING_CIS_CENTRAL)
> > +               features |= ADAPTER_FEAT_CIS_CENTRAL;
> > +
> > +       return features & feature;
> > +}
> > +
> >  bool btd_adapter_has_exp_feature(struct btd_adapter *adapter, uint32_t feature)
> >  {
> >         size_t i;
> > diff --git a/src/adapter.h b/src/adapter.h
> > index 78eb069ae..6a9a626bc 100644
> > --- a/src/adapter.h
> > +++ b/src/adapter.h
> > @@ -256,6 +256,12 @@ void btd_adapter_for_each_device(struct btd_adapter *adapter,
> > 
> >  bool btd_le_connect_before_pairing(void);
> > 
> > +enum adapter_features {
> > +       ADAPTER_FEAT_CIS_CENTRAL        = 1 << 0,
> > +};
> > +
> > +bool btd_adapter_has_feature(struct btd_adapter *adapter, uint32_t feature);
> > +
> >  enum experimental_features {
> >         EXP_FEAT_DEBUG                  = 1 << 0,
> >         EXP_FEAT_LE_SIMULT_ROLES        = 1 << 1,
> > diff --git a/tools/btmgmt.c b/tools/btmgmt.c
> > index 29f86091f..de614ced1 100644
> > --- a/tools/btmgmt.c
> > +++ b/tools/btmgmt.c
> > @@ -353,6 +353,7 @@ static const char *settings_str[] = {
> >                                 "static-addr",
> >                                 "phy-configuration",
> >                                 "wide-band-speech",
> > +                               "cis-central",
> >  };
> > 
> >  static const char *settings2str(uint32_t settings)
> > diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
> > index 743f6f59dff8..dc284c5f5cbb 100644
> > --- a/include/net/bluetooth/mgmt.h
> > +++ b/include/net/bluetooth/mgmt.h
> > @@ -109,6 +109,7 @@ struct mgmt_rp_read_index_list {
> >  #define MGMT_SETTING_STATIC_ADDRESS    0x00008000
> >  #define MGMT_SETTING_PHY_CONFIGURATION 0x00010000
> >  #define MGMT_SETTING_WIDEBAND_SPEECH   0x00020000
> > +#define MGMT_SETTING_CIS_CENTRAL       0x00040000
> > 
> >  #define MGMT_OP_READ_INFO              0x0004
> >  #define MGMT_READ_INFO_SIZE            0
> > diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
> > index 0dd30a3beb77..d802faf60f26 100644
> > --- a/net/bluetooth/mgmt.c
> > +++ b/net/bluetooth/mgmt.c
> > @@ -859,6 +859,9 @@ static u32 get_supported_settings(struct hci_dev *hdev)
> >             hdev->set_bdaddr)
> >                 settings |= MGMT_SETTING_CONFIGURATION;
> > 
> > +       if (cis_central_capable(hdev))
> > +               settings |= MGMT_SETTING_CIS_CENTRAL;
> > +
> >         settings |= MGMT_SETTING_PHY_CONFIGURATION;
> > 
> >         return settings;
> > @@ -932,6 +935,9 @@ static u32 get_current_settings(struct hci_dev *hdev)
> >         if (hci_dev_test_flag(hdev, HCI_WIDEBAND_SPEECH_ENABLED))
> >                 settings |= MGMT_SETTING_WIDEBAND_SPEECH;
> > 
> > +       if (cis_central_capable(hdev) && iso_enabled())
> > +               settings |= MGMT_SETTING_CIS_CENTRAL;
> 
> I'd drop iso_enabled() from above, the features bits shall indicate
> the controller capability only, right now ISO packets can only be
> transferred via ISO sockets but this may change in the future if
> vendors decide they need a more specialized transport for audio.
> 
> >         return settings;
> >  }
> > 
> > --
> > 2.39.1
> > 
> 
> 

-- 
Pauli Virtanen

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

* [PATCH BlueZ 1/8] doc: add MGMT setting for CIS features, remove Quality Report
@ 2023-01-30 18:37 ` Pauli Virtanen
  2023-01-30 18:37   ` [PATCH BlueZ 2/8] lib: Add defines for MGMT setting bits for CIS feature support Pauli Virtanen
                     ` (9 more replies)
  0 siblings, 10 replies; 43+ messages in thread
From: Pauli Virtanen @ 2023-01-30 18:37 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Pauli Virtanen

Add definitions for new MGMT Controller Information settings bits,
indicating adapter Connected Isochronous Stream - Central/Peripheral
feature support.

The Set Quality Report command was removed in
commit 0454e2d09570 ("mgmt: Add support for Mesh in the kernel"),
but the settings bit was not removed. It's also not implemented on
kernel side, so remove it now.
---

Notes:
    Was the quality report setting bit reserved on purpose?
    
    From the commit log it looks like it was forgotten to remove from the
    docs, but this is not clear.

 doc/mgmt-api.txt | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/doc/mgmt-api.txt b/doc/mgmt-api.txt
index 90d612ed8..58395dc90 100644
--- a/doc/mgmt-api.txt
+++ b/doc/mgmt-api.txt
@@ -332,7 +332,8 @@ Read Controller Information Command
 		15	Static Address
 		16	PHY Configuration
 		17	Wideband Speech
-		18	Quality Report
+		18	Connected Isochronous Stream - Central
+		19	Connected Isochronous Stream - Peripheral
 
 	This command generates a Command Complete event on success or
 	a Command Status event on failure.
@@ -2925,7 +2926,8 @@ Read Extended Controller Information Command
 		15	Static Address
 		16	PHY Configuration
 		17	Wideband Speech
-		18	Quality Report
+		18	Connected Isochronous Stream - Central
+		19	Connected Isochronous Stream - Peripheral
 
 	The EIR_Data field contains information about class of device,
 	local name and other values. Not all of them might be present. For
-- 
2.39.1


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

* [PATCH BlueZ 2/8] lib: Add defines for MGMT setting bits for CIS feature support
  2023-01-30 18:37 ` [PATCH BlueZ 1/8] doc: add MGMT setting for CIS features, remove Quality Report Pauli Virtanen
@ 2023-01-30 18:37   ` Pauli Virtanen
  2023-02-07  1:13     ` Luiz Augusto von Dentz
  2023-01-30 18:37   ` [PATCH BlueZ 3/8] monitor: add names " Pauli Virtanen
                     ` (8 subsequent siblings)
  9 siblings, 1 reply; 43+ messages in thread
From: Pauli Virtanen @ 2023-01-30 18:37 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Pauli Virtanen

---
 lib/mgmt.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/mgmt.h b/lib/mgmt.h
index 796190cd9..efbdfb4b1 100644
--- a/lib/mgmt.h
+++ b/lib/mgmt.h
@@ -96,6 +96,8 @@ struct mgmt_rp_read_index_list {
 #define MGMT_SETTING_STATIC_ADDRESS	0x00008000
 #define MGMT_SETTING_PHY_CONFIGURATION	0x00010000
 #define MGMT_SETTING_WIDEBAND_SPEECH	0x00020000
+#define MGMT_SETTING_CIS_CENTRAL	0x00040000
+#define MGMT_SETTING_CIS_PERIPHERAL	0x00080000
 
 #define MGMT_OP_READ_INFO		0x0004
 struct mgmt_rp_read_info {
-- 
2.39.1


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

* [PATCH BlueZ 3/8] monitor: add names for MGMT setting bits for CIS feature support
  2023-01-30 18:37 ` [PATCH BlueZ 1/8] doc: add MGMT setting for CIS features, remove Quality Report Pauli Virtanen
  2023-01-30 18:37   ` [PATCH BlueZ 2/8] lib: Add defines for MGMT setting bits for CIS feature support Pauli Virtanen
@ 2023-01-30 18:37   ` Pauli Virtanen
  2023-02-07  1:12     ` Luiz Augusto von Dentz
  2023-01-30 18:37   ` [PATCH BlueZ 4/8] tools/btmgmt: " Pauli Virtanen
                     ` (7 subsequent siblings)
  9 siblings, 1 reply; 43+ messages in thread
From: Pauli Virtanen @ 2023-01-30 18:37 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Pauli Virtanen

---
 monitor/packet.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/monitor/packet.c b/monitor/packet.c
index 44f1941bd..d9e8abf41 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -12649,6 +12649,8 @@ static const struct bitfield_data mgmt_settings_table[] = {
 	{ 15, "Static Address"		},
 	{ 16, "PHY Configuration"	},
 	{ 17, "Wideband Speech"		},
+	{ 18, "CIS Central"		},
+	{ 19, "CIS Peripheral"		},
 	{ }
 };
 
-- 
2.39.1


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

* [PATCH BlueZ 4/8] tools/btmgmt: add names for MGMT setting bits for CIS feature support
  2023-01-30 18:37 ` [PATCH BlueZ 1/8] doc: add MGMT setting for CIS features, remove Quality Report Pauli Virtanen
  2023-01-30 18:37   ` [PATCH BlueZ 2/8] lib: Add defines for MGMT setting bits for CIS feature support Pauli Virtanen
  2023-01-30 18:37   ` [PATCH BlueZ 3/8] monitor: add names " Pauli Virtanen
@ 2023-01-30 18:37   ` Pauli Virtanen
  2023-02-07  1:14     ` Luiz Augusto von Dentz
  2023-01-30 18:37   ` [PATCH BlueZ 5/8] adapter: add functions indicating adapter CIS capability Pauli Virtanen
                     ` (6 subsequent siblings)
  9 siblings, 1 reply; 43+ messages in thread
From: Pauli Virtanen @ 2023-01-30 18:37 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Pauli Virtanen

---
 tools/btmgmt.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/btmgmt.c b/tools/btmgmt.c
index 29f86091f..323c26712 100644
--- a/tools/btmgmt.c
+++ b/tools/btmgmt.c
@@ -353,6 +353,8 @@ static const char *settings_str[] = {
 				"static-addr",
 				"phy-configuration",
 				"wide-band-speech",
+				"cis-central",
+				"cis-peripheral",
 };
 
 static const char *settings2str(uint32_t settings)
-- 
2.39.1


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

* [PATCH BlueZ 5/8] adapter: add functions indicating adapter CIS capability
  2023-01-30 18:37 ` [PATCH BlueZ 1/8] doc: add MGMT setting for CIS features, remove Quality Report Pauli Virtanen
                     ` (2 preceding siblings ...)
  2023-01-30 18:37   ` [PATCH BlueZ 4/8] tools/btmgmt: " Pauli Virtanen
@ 2023-01-30 18:37   ` Pauli Virtanen
  2023-02-07  1:10     ` Luiz Augusto von Dentz
  2023-01-30 18:37   ` [PATCH BlueZ 6/8] media: Check adapter CIS support to add BAP in SupportedUUIDs Pauli Virtanen
                     ` (5 subsequent siblings)
  9 siblings, 1 reply; 43+ messages in thread
From: Pauli Virtanen @ 2023-01-30 18:37 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Pauli Virtanen

---
 src/adapter.c | 16 ++++++++++++++++
 src/adapter.h |  3 +++
 2 files changed, 19 insertions(+)

diff --git a/src/adapter.c b/src/adapter.c
index aadad4016..4f06bce53 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -9033,6 +9033,22 @@ bool btd_adapter_ssp_enabled(struct btd_adapter *adapter)
 	return false;
 }
 
+bool btd_adapter_cis_central_capable(struct btd_adapter *adapter)
+{
+	if (adapter->current_settings & MGMT_SETTING_CIS_CENTRAL)
+		return true;
+
+	return false;
+}
+
+bool btd_adapter_cis_peripheral_capable(struct btd_adapter *adapter)
+{
+	if (adapter->current_settings & MGMT_SETTING_CIS_PERIPHERAL)
+		return true;
+
+	return false;
+}
+
 void btd_adapter_set_oob_handler(struct btd_adapter *adapter,
 						struct oob_handler *handler)
 {
diff --git a/src/adapter.h b/src/adapter.h
index 78eb069ae..3fcee30bc 100644
--- a/src/adapter.h
+++ b/src/adapter.h
@@ -226,6 +226,9 @@ void btd_adapter_gatt_server_stop(struct btd_adapter *adapter);
 
 bool btd_adapter_ssp_enabled(struct btd_adapter *adapter);
 
+bool btd_adapter_cis_central_capable(struct btd_adapter *adapter);
+bool btd_adapter_cis_peripheral_capable(struct btd_adapter *adapter);
+
 int adapter_connect_list_add(struct btd_adapter *adapter,
 					struct btd_device *device);
 void adapter_connect_list_remove(struct btd_adapter *adapter,
-- 
2.39.1


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

* [PATCH BlueZ 6/8] media: Check adapter CIS support to add BAP in SupportedUUIDs
  2023-01-30 18:37 ` [PATCH BlueZ 1/8] doc: add MGMT setting for CIS features, remove Quality Report Pauli Virtanen
                     ` (3 preceding siblings ...)
  2023-01-30 18:37   ` [PATCH BlueZ 5/8] adapter: add functions indicating adapter CIS capability Pauli Virtanen
@ 2023-01-30 18:37   ` Pauli Virtanen
  2023-01-30 18:37   ` [PATCH BlueZ 7/8] shared/bap: handle central-only case Pauli Virtanen
                     ` (4 subsequent siblings)
  9 siblings, 0 replies; 43+ messages in thread
From: Pauli Virtanen @ 2023-01-30 18:37 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Pauli Virtanen

Don't indicate BAP support in SupportedUUIDs, if adapter supports
neither CIS Central nor Peripheral.
---
 profiles/audio/media.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/profiles/audio/media.c b/profiles/audio/media.c
index fbb350889..d68085514 100644
--- a/profiles/audio/media.c
+++ b/profiles/audio/media.c
@@ -1259,6 +1259,10 @@ static bool experimental_endpoint_supported(struct btd_adapter *adapter)
 	if (!btd_adapter_has_exp_feature(adapter, EXP_FEAT_ISO_SOCKET))
 		return false;
 
+	if (!btd_adapter_cis_central_capable(adapter) &&
+	    !btd_adapter_cis_peripheral_capable(adapter))
+		return false;
+
 	return g_dbus_get_flags() & G_DBUS_FLAG_ENABLE_EXPERIMENTAL;
 }
 
-- 
2.39.1


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

* [PATCH BlueZ 7/8] shared/bap: handle central-only case
  2023-01-30 18:37 ` [PATCH BlueZ 1/8] doc: add MGMT setting for CIS features, remove Quality Report Pauli Virtanen
                     ` (4 preceding siblings ...)
  2023-01-30 18:37   ` [PATCH BlueZ 6/8] media: Check adapter CIS support to add BAP in SupportedUUIDs Pauli Virtanen
@ 2023-01-30 18:37   ` Pauli Virtanen
  2023-01-30 19:39     ` Luiz Augusto von Dentz
  2023-01-30 18:37   ` [PATCH BlueZ 8/8] bap: handle adapters that are not CIS Central / Peripheral capable Pauli Virtanen
                     ` (3 subsequent siblings)
  9 siblings, 1 reply; 43+ messages in thread
From: Pauli Virtanen @ 2023-01-30 18:37 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Pauli Virtanen

Support central-only case, where no local endpoints are created, and
nothing is registered in the local GATT database.

In this case, we keep track of the local PACs ("sinks" and "sources"),
but there are no PACS and ASCS registrations or endpoints.
---
 src/shared/bap.c | 58 ++++++++++++++++++++++++++----------------------
 src/shared/bap.h |  9 +++++---
 unit/test-bap.c  |  4 +++-
 3 files changed, 40 insertions(+), 31 deletions(-)

diff --git a/src/shared/bap.c b/src/shared/bap.c
index 22f2e6714..24113bb34 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -110,11 +110,13 @@ struct bt_ascs {
 
 struct bt_bap_db {
 	struct gatt_db *db;
-	struct bt_pacs *pacs;
-	struct bt_ascs *ascs;
 	struct queue *sinks;
 	struct queue *sources;
+
+	/* The following are NULL if central-only (no GATT) */
 	struct queue *endpoints;
+	struct bt_pacs *pacs;
+	struct bt_ascs *ascs;
 };
 
 struct bt_bap_req {
@@ -565,6 +567,7 @@ static void bap_disconnected(int err, void *user_data)
 static struct bt_bap *bap_get_session(struct bt_att *att, struct gatt_db *db)
 {
 	const struct queue_entry *entry;
+	struct bt_bap_db *ldb;
 	struct bt_bap *bap;
 
 	for (entry = queue_get_entries(sessions); entry; entry = entry->next) {
@@ -574,7 +577,8 @@ static struct bt_bap *bap_get_session(struct bt_att *att, struct gatt_db *db)
 			return bap;
 	}
 
-	bap = bt_bap_new(db, NULL);
+	ldb = bt_bap_get_local_db(db, true);
+	bap = bt_bap_new(ldb, NULL);
 	bap->att = att;
 
 	bt_bap_attach(bap, NULL);
@@ -620,7 +624,7 @@ static struct bt_bap_endpoint *bap_get_endpoint(struct bt_bap_db *db,
 {
 	struct bt_bap_endpoint *ep;
 
-	if (!db || !attr)
+	if (!db || !attr || !db->endpoints)
 		return NULL;
 
 	ep = queue_find(db->endpoints, bap_endpoint_match, attr);
@@ -652,7 +656,7 @@ static struct bt_bap_endpoint *bap_get_endpoint_id(struct bt_bap *bap,
 	struct gatt_db_attribute *attr = NULL;
 	size_t i;
 
-	if (!bap || !db)
+	if (!bap || !db || !db->endpoints)
 		return NULL;
 
 	ep = queue_find(db->endpoints, bap_endpoint_match_id, UINT_TO_PTR(id));
@@ -2170,7 +2174,7 @@ static struct bt_ascs *ascs_new(struct gatt_db *db)
 	return ascs;
 }
 
-static struct bt_bap_db *bap_db_new(struct gatt_db *db)
+static struct bt_bap_db *bap_db_new(struct gatt_db *db, bool peripheral)
 {
 	struct bt_bap_db *bdb;
 
@@ -2181,23 +2185,26 @@ static struct bt_bap_db *bap_db_new(struct gatt_db *db)
 	bdb->db = gatt_db_ref(db);
 	bdb->sinks = queue_new();
 	bdb->sources = queue_new();
-	bdb->endpoints = queue_new();
 
 	if (!bap_db)
 		bap_db = queue_new();
 
-	bdb->pacs = pacs_new(db);
-	bdb->pacs->bdb = bdb;
+	if (peripheral) {
+		bdb->endpoints = queue_new();
 
-	bdb->ascs = ascs_new(db);
-	bdb->ascs->bdb = bdb;
+		bdb->pacs = pacs_new(db);
+		bdb->pacs->bdb = bdb;
+
+		bdb->ascs = ascs_new(db);
+		bdb->ascs->bdb = bdb;
+	}
 
 	queue_push_tail(bap_db, bdb);
 
 	return bdb;
 }
 
-static struct bt_bap_db *bap_get_db(struct gatt_db *db)
+struct bt_bap_db *bt_bap_get_local_db(struct gatt_db *db, bool peripheral)
 {
 	struct bt_bap_db *bdb;
 
@@ -2205,7 +2212,7 @@ static struct bt_bap_db *bap_get_db(struct gatt_db *db)
 	if (bdb)
 		return bdb;
 
-	return bap_db_new(db);
+	return bap_db_new(db, peripheral);
 }
 
 static struct bt_pacs *bap_get_pacs(struct bt_bap *bap)
@@ -2328,6 +2335,9 @@ static void bap_add_sink(struct bt_bap_pac *pac)
 
 	queue_push_tail(pac->bdb->sinks, pac);
 
+	if (!pac->bdb->endpoints)
+		return;
+
 	memset(value, 0, sizeof(value));
 
 	iov.iov_base = value;
@@ -2346,6 +2356,9 @@ static void bap_add_source(struct bt_bap_pac *pac)
 
 	queue_push_tail(pac->bdb->sources, pac);
 
+	if (!pac->bdb->endpoints)
+		return;
+
 	memset(value, 0, sizeof(value));
 
 	iov.iov_base = value;
@@ -2373,21 +2386,16 @@ static void notify_session_pac_added(void *data, void *user_data)
 	queue_foreach(bap->pac_cbs, notify_pac_added, user_data);
 }
 
-struct bt_bap_pac *bt_bap_add_vendor_pac(struct gatt_db *db,
+struct bt_bap_pac *bt_bap_add_vendor_pac(struct bt_bap_db *bdb,
 					const char *name, uint8_t type,
 					uint8_t id, uint16_t cid, uint16_t vid,
 					struct bt_bap_pac_qos *qos,
 					struct iovec *data,
 					struct iovec *metadata)
 {
-	struct bt_bap_db *bdb;
 	struct bt_bap_pac *pac;
 	struct bt_bap_codec codec;
 
-	if (!db)
-		return NULL;
-
-	bdb = bap_get_db(db);
 	if (!bdb)
 		return NULL;
 
@@ -2417,13 +2425,13 @@ struct bt_bap_pac *bt_bap_add_vendor_pac(struct gatt_db *db,
 	return pac;
 }
 
-struct bt_bap_pac *bt_bap_add_pac(struct gatt_db *db, const char *name,
+struct bt_bap_pac *bt_bap_add_pac(struct bt_bap_db *bdb, const char *name,
 					uint8_t type, uint8_t id,
 					struct bt_bap_pac_qos *qos,
 					struct iovec *data,
 					struct iovec *metadata)
 {
-	return bt_bap_add_vendor_pac(db, name, type, id, 0x0000, 0x0000, qos,
+	return bt_bap_add_vendor_pac(bdb, name, type, id, 0x0000, 0x0000, qos,
 							data, metadata);
 }
 
@@ -2635,7 +2643,7 @@ static void bap_attached(void *data, void *user_data)
 	cb->attached(bap, cb->user_data);
 }
 
-struct bt_bap *bt_bap_new(struct gatt_db *ldb, struct gatt_db *rdb)
+struct bt_bap *bt_bap_new(struct bt_bap_db *ldb, struct gatt_db *rdb)
 {
 	struct bt_bap *bap;
 	struct bt_bap_db *bdb;
@@ -2643,12 +2651,8 @@ struct bt_bap *bt_bap_new(struct gatt_db *ldb, struct gatt_db *rdb)
 	if (!ldb)
 		return NULL;
 
-	bdb = bap_get_db(ldb);
-	if (!bdb)
-		return NULL;
-
 	bap = new0(struct bt_bap, 1);
-	bap->ldb = bdb;
+	bap->ldb = ldb;
 	bap->reqs = queue_new();
 	bap->pending = queue_new();
 	bap->notify = queue_new();
diff --git a/src/shared/bap.h b/src/shared/bap.h
index 47a15636c..a4e8549a5 100644
--- a/src/shared/bap.h
+++ b/src/shared/bap.h
@@ -34,6 +34,7 @@
 #define BT_BAP_CONFIG_PHY_CODEC		0x03
 
 struct bt_bap;
+struct bt_bap_db;
 struct bt_bap_pac;
 struct bt_bap_stream;
 
@@ -98,14 +99,14 @@ struct bt_bap_pac_qos {
 	uint32_t ppd_max;
 };
 
-struct bt_bap_pac *bt_bap_add_vendor_pac(struct gatt_db *db,
+struct bt_bap_pac *bt_bap_add_vendor_pac(struct bt_bap_db *bdb,
 					const char *name, uint8_t type,
 					uint8_t id, uint16_t cid, uint16_t vid,
 					struct bt_bap_pac_qos *qos,
 					struct iovec *data,
 					struct iovec *metadata);
 
-struct bt_bap_pac *bt_bap_add_pac(struct gatt_db *db, const char *name,
+struct bt_bap_pac *bt_bap_add_pac(struct bt_bap_db *bdb, const char *name,
 					uint8_t type, uint8_t id,
 					struct bt_bap_pac_qos *qos,
 					struct iovec *data,
@@ -135,7 +136,9 @@ unsigned int bt_bap_register(bt_bap_func_t added, bt_bap_func_t removed,
 							void *user_data);
 bool bt_bap_unregister(unsigned int id);
 
-struct bt_bap *bt_bap_new(struct gatt_db *ldb, struct gatt_db *rdb);
+struct bt_bap_db *bt_bap_get_local_db(struct gatt_db *db, bool peripheral);
+
+struct bt_bap *bt_bap_new(struct bt_bap_db *ldb, struct gatt_db *rdb);
 
 bool bt_bap_set_user_data(struct bt_bap *bap, void *user_data);
 
diff --git a/unit/test-bap.c b/unit/test-bap.c
index afeefac84..b677f5197 100644
--- a/unit/test-bap.c
+++ b/unit/test-bap.c
@@ -311,6 +311,7 @@ static void test_client(const void *user_data)
 {
 	struct test_data *data = (void *)user_data;
 	struct io *io;
+	struct bt_bap_db *ldb;
 	struct gatt_db *db;
 
 	io = tester_setup_io(data->iov, data->iovcnt);
@@ -321,7 +322,8 @@ static void test_client(const void *user_data)
 	db = gatt_db_new();
 	g_assert(db);
 
-	data->bap = bt_bap_new(db, bt_gatt_client_get_db(data->client));
+	ldb = bt_bap_get_local_db(db, true);
+	data->bap = bt_bap_new(ldb, bt_gatt_client_get_db(data->client));
 	g_assert(data->bap);
 
 	bt_bap_set_debug(data->bap, print_debug, "bt_bap:", NULL);
-- 
2.39.1


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

* [PATCH BlueZ 8/8] bap: handle adapters that are not CIS Central / Peripheral capable
  2023-01-30 18:37 ` [PATCH BlueZ 1/8] doc: add MGMT setting for CIS features, remove Quality Report Pauli Virtanen
                     ` (5 preceding siblings ...)
  2023-01-30 18:37   ` [PATCH BlueZ 7/8] shared/bap: handle central-only case Pauli Virtanen
@ 2023-01-30 18:37   ` Pauli Virtanen
  2023-02-07  1:27     ` Luiz Augusto von Dentz
  2023-01-30 20:13   ` [BlueZ,1/8] doc: add MGMT setting for CIS features, remove Quality Report bluez.test.bot
                     ` (2 subsequent siblings)
  9 siblings, 1 reply; 43+ messages in thread
From: Pauli Virtanen @ 2023-01-30 18:37 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Pauli Virtanen

When BT adapter is not CIS Peripheral capable, use the shared/bap code
in its central-only mode, and don't register anything in the local GATT
database.

When BT adapter is not CIS Central capable, ignore the remote device
GATT database, so that we work purely in peripheral mode.

If BT adapter supports neither feature, don't do anything with BAP.
---
 profiles/audio/bap.c   | 18 ++++++++++++++++--
 profiles/audio/media.c | 11 ++++++-----
 2 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
index e5ffb7230..28c0d139a 100644
--- a/profiles/audio/bap.c
+++ b/profiles/audio/bap.c
@@ -1254,6 +1254,8 @@ static int bap_probe(struct btd_service *service)
 	struct btd_adapter *adapter = device_get_adapter(device);
 	struct btd_gatt_database *database = btd_adapter_get_database(adapter);
 	struct bap_data *data = btd_service_get_user_data(service);
+	struct bt_bap_db *ldb;
+	struct gatt_db *device_db;
 	char addr[18];
 
 	ba2str(device_get_address(device), addr);
@@ -1264,17 +1266,29 @@ static int bap_probe(struct btd_service *service)
 		return -ENOTSUP;
 	}
 
+	if (!btd_adapter_cis_central_capable(adapter) &&
+	    !btd_adapter_cis_peripheral_capable(adapter)) {
+		DBG("BAP requires CIS features, unsupported by adapter");
+		return -ENOTSUP;
+	}
+
 	/* Ignore, if we were probed for this device already */
 	if (data) {
 		error("Profile probed twice for the same device!");
 		return -EINVAL;
 	}
 
+	if (btd_adapter_cis_central_capable(adapter))
+		device_db = btd_device_get_gatt_db(device);
+	else
+		device_db = NULL;
+
 	data = bap_data_new(device);
 	data->service = service;
 
-	data->bap = bt_bap_new(btd_gatt_database_get_db(database),
-					btd_device_get_gatt_db(device));
+	ldb = bt_bap_get_local_db(btd_gatt_database_get_db(database),
+				btd_adapter_cis_peripheral_capable(adapter));
+	data->bap = bt_bap_new(ldb, device_db);
 	if (!data->bap) {
 		error("Unable to create BAP instance");
 		free(data);
diff --git a/profiles/audio/media.c b/profiles/audio/media.c
index d68085514..6f83b03b5 100644
--- a/profiles/audio/media.c
+++ b/profiles/audio/media.c
@@ -1105,8 +1105,9 @@ static void bap_debug(const char *str, void *user_data)
 static bool endpoint_init_pac(struct media_endpoint *endpoint, uint8_t type,
 								int *err)
 {
+	struct btd_adapter *adapter = endpoint->adapter->btd_adapter;
 	struct btd_gatt_database *database;
-	struct gatt_db *db;
+	struct bt_bap_db *ldb;
 	struct iovec data;
 	char *name;
 
@@ -1116,7 +1117,7 @@ static bool endpoint_init_pac(struct media_endpoint *endpoint, uint8_t type,
 		return false;
 	}
 
-	database = btd_adapter_get_database(endpoint->adapter->btd_adapter);
+	database = btd_adapter_get_database(adapter);
 	if (!database) {
 		error("Adapter database not found");
 		return false;
@@ -1128,8 +1129,6 @@ static bool endpoint_init_pac(struct media_endpoint *endpoint, uint8_t type,
 		return false;
 	}
 
-	db = btd_gatt_database_get_db(database);
-
 	data.iov_base = endpoint->capabilities;
 	data.iov_len = endpoint->size;
 
@@ -1141,7 +1140,9 @@ static bool endpoint_init_pac(struct media_endpoint *endpoint, uint8_t type,
 		return false;
 	}
 
-	endpoint->pac = bt_bap_add_pac(db, name, type, endpoint->codec,
+	ldb = bt_bap_get_local_db(btd_gatt_database_get_db(database),
+				btd_adapter_cis_peripheral_capable(adapter));
+	endpoint->pac = bt_bap_add_pac(ldb, name, type, endpoint->codec,
 					&endpoint->qos, &data, NULL);
 	if (!endpoint->pac) {
 		error("Unable to create PAC");
-- 
2.39.1


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

* Re: [PATCH BlueZ 7/8] shared/bap: handle central-only case
  2023-01-30 18:37   ` [PATCH BlueZ 7/8] shared/bap: handle central-only case Pauli Virtanen
@ 2023-01-30 19:39     ` Luiz Augusto von Dentz
  2023-01-30 20:04       ` Pauli Virtanen
  0 siblings, 1 reply; 43+ messages in thread
From: Luiz Augusto von Dentz @ 2023-01-30 19:39 UTC (permalink / raw)
  To: Pauli Virtanen; +Cc: linux-bluetooth

Hi Pauli,

On Mon, Jan 30, 2023 at 11:06 AM Pauli Virtanen <pav@iki.fi> wrote:
>
> Support central-only case, where no local endpoints are created, and
> nothing is registered in the local GATT database.
>
> In this case, we keep track of the local PACs ("sinks" and "sources"),
> but there are no PACS and ASCS registrations or endpoints.

I'm not really following how that would work without local endpoints
since the endpoints are the interface which is used to setup the
stream with the likes of pipewire/pulseaudio we can't really remove
them, what Id would suggest doing is to have a flag indicating if the
instance is client only or not, that way bt_bap can identify if it
needs to register services or not.

> ---
>  src/shared/bap.c | 58 ++++++++++++++++++++++++++----------------------
>  src/shared/bap.h |  9 +++++---
>  unit/test-bap.c  |  4 +++-
>  3 files changed, 40 insertions(+), 31 deletions(-)
>
> diff --git a/src/shared/bap.c b/src/shared/bap.c
> index 22f2e6714..24113bb34 100644
> --- a/src/shared/bap.c
> +++ b/src/shared/bap.c
> @@ -110,11 +110,13 @@ struct bt_ascs {
>
>  struct bt_bap_db {
>         struct gatt_db *db;
> -       struct bt_pacs *pacs;
> -       struct bt_ascs *ascs;
>         struct queue *sinks;
>         struct queue *sources;
> +
> +       /* The following are NULL if central-only (no GATT) */
>         struct queue *endpoints;
> +       struct bt_pacs *pacs;
> +       struct bt_ascs *ascs;
>  };
>
>  struct bt_bap_req {
> @@ -565,6 +567,7 @@ static void bap_disconnected(int err, void *user_data)
>  static struct bt_bap *bap_get_session(struct bt_att *att, struct gatt_db *db)
>  {
>         const struct queue_entry *entry;
> +       struct bt_bap_db *ldb;
>         struct bt_bap *bap;
>
>         for (entry = queue_get_entries(sessions); entry; entry = entry->next) {
> @@ -574,7 +577,8 @@ static struct bt_bap *bap_get_session(struct bt_att *att, struct gatt_db *db)
>                         return bap;
>         }
>
> -       bap = bt_bap_new(db, NULL);
> +       ldb = bt_bap_get_local_db(db, true);
> +       bap = bt_bap_new(ldb, NULL);
>         bap->att = att;
>
>         bt_bap_attach(bap, NULL);
> @@ -620,7 +624,7 @@ static struct bt_bap_endpoint *bap_get_endpoint(struct bt_bap_db *db,
>  {
>         struct bt_bap_endpoint *ep;
>
> -       if (!db || !attr)
> +       if (!db || !attr || !db->endpoints)
>                 return NULL;
>
>         ep = queue_find(db->endpoints, bap_endpoint_match, attr);
> @@ -652,7 +656,7 @@ static struct bt_bap_endpoint *bap_get_endpoint_id(struct bt_bap *bap,
>         struct gatt_db_attribute *attr = NULL;
>         size_t i;
>
> -       if (!bap || !db)
> +       if (!bap || !db || !db->endpoints)
>                 return NULL;
>
>         ep = queue_find(db->endpoints, bap_endpoint_match_id, UINT_TO_PTR(id));
> @@ -2170,7 +2174,7 @@ static struct bt_ascs *ascs_new(struct gatt_db *db)
>         return ascs;
>  }
>
> -static struct bt_bap_db *bap_db_new(struct gatt_db *db)
> +static struct bt_bap_db *bap_db_new(struct gatt_db *db, bool peripheral)
>  {
>         struct bt_bap_db *bdb;
>
> @@ -2181,23 +2185,26 @@ static struct bt_bap_db *bap_db_new(struct gatt_db *db)
>         bdb->db = gatt_db_ref(db);
>         bdb->sinks = queue_new();
>         bdb->sources = queue_new();
> -       bdb->endpoints = queue_new();
>
>         if (!bap_db)
>                 bap_db = queue_new();
>
> -       bdb->pacs = pacs_new(db);
> -       bdb->pacs->bdb = bdb;
> +       if (peripheral) {
> +               bdb->endpoints = queue_new();
>
> -       bdb->ascs = ascs_new(db);
> -       bdb->ascs->bdb = bdb;
> +               bdb->pacs = pacs_new(db);
> +               bdb->pacs->bdb = bdb;
> +
> +               bdb->ascs = ascs_new(db);
> +               bdb->ascs->bdb = bdb;
> +       }
>
>         queue_push_tail(bap_db, bdb);
>
>         return bdb;
>  }
>
> -static struct bt_bap_db *bap_get_db(struct gatt_db *db)
> +struct bt_bap_db *bt_bap_get_local_db(struct gatt_db *db, bool peripheral)
>  {
>         struct bt_bap_db *bdb;
>
> @@ -2205,7 +2212,7 @@ static struct bt_bap_db *bap_get_db(struct gatt_db *db)
>         if (bdb)
>                 return bdb;
>
> -       return bap_db_new(db);
> +       return bap_db_new(db, peripheral);
>  }
>
>  static struct bt_pacs *bap_get_pacs(struct bt_bap *bap)
> @@ -2328,6 +2335,9 @@ static void bap_add_sink(struct bt_bap_pac *pac)
>
>         queue_push_tail(pac->bdb->sinks, pac);
>
> +       if (!pac->bdb->endpoints)
> +               return;
> +
>         memset(value, 0, sizeof(value));
>
>         iov.iov_base = value;
> @@ -2346,6 +2356,9 @@ static void bap_add_source(struct bt_bap_pac *pac)
>
>         queue_push_tail(pac->bdb->sources, pac);
>
> +       if (!pac->bdb->endpoints)
> +               return;
> +
>         memset(value, 0, sizeof(value));
>
>         iov.iov_base = value;
> @@ -2373,21 +2386,16 @@ static void notify_session_pac_added(void *data, void *user_data)
>         queue_foreach(bap->pac_cbs, notify_pac_added, user_data);
>  }
>
> -struct bt_bap_pac *bt_bap_add_vendor_pac(struct gatt_db *db,
> +struct bt_bap_pac *bt_bap_add_vendor_pac(struct bt_bap_db *bdb,
>                                         const char *name, uint8_t type,
>                                         uint8_t id, uint16_t cid, uint16_t vid,
>                                         struct bt_bap_pac_qos *qos,
>                                         struct iovec *data,
>                                         struct iovec *metadata)
>  {
> -       struct bt_bap_db *bdb;
>         struct bt_bap_pac *pac;
>         struct bt_bap_codec codec;
>
> -       if (!db)
> -               return NULL;
> -
> -       bdb = bap_get_db(db);
>         if (!bdb)
>                 return NULL;
>
> @@ -2417,13 +2425,13 @@ struct bt_bap_pac *bt_bap_add_vendor_pac(struct gatt_db *db,
>         return pac;
>  }
>
> -struct bt_bap_pac *bt_bap_add_pac(struct gatt_db *db, const char *name,
> +struct bt_bap_pac *bt_bap_add_pac(struct bt_bap_db *bdb, const char *name,
>                                         uint8_t type, uint8_t id,
>                                         struct bt_bap_pac_qos *qos,
>                                         struct iovec *data,
>                                         struct iovec *metadata)
>  {
> -       return bt_bap_add_vendor_pac(db, name, type, id, 0x0000, 0x0000, qos,
> +       return bt_bap_add_vendor_pac(bdb, name, type, id, 0x0000, 0x0000, qos,
>                                                         data, metadata);
>  }
>
> @@ -2635,7 +2643,7 @@ static void bap_attached(void *data, void *user_data)
>         cb->attached(bap, cb->user_data);
>  }
>
> -struct bt_bap *bt_bap_new(struct gatt_db *ldb, struct gatt_db *rdb)
> +struct bt_bap *bt_bap_new(struct bt_bap_db *ldb, struct gatt_db *rdb)
>  {
>         struct bt_bap *bap;
>         struct bt_bap_db *bdb;
> @@ -2643,12 +2651,8 @@ struct bt_bap *bt_bap_new(struct gatt_db *ldb, struct gatt_db *rdb)
>         if (!ldb)
>                 return NULL;
>
> -       bdb = bap_get_db(ldb);
> -       if (!bdb)
> -               return NULL;
> -
>         bap = new0(struct bt_bap, 1);
> -       bap->ldb = bdb;
> +       bap->ldb = ldb;
>         bap->reqs = queue_new();
>         bap->pending = queue_new();
>         bap->notify = queue_new();
> diff --git a/src/shared/bap.h b/src/shared/bap.h
> index 47a15636c..a4e8549a5 100644
> --- a/src/shared/bap.h
> +++ b/src/shared/bap.h
> @@ -34,6 +34,7 @@
>  #define BT_BAP_CONFIG_PHY_CODEC                0x03
>
>  struct bt_bap;
> +struct bt_bap_db;
>  struct bt_bap_pac;
>  struct bt_bap_stream;
>
> @@ -98,14 +99,14 @@ struct bt_bap_pac_qos {
>         uint32_t ppd_max;
>  };
>
> -struct bt_bap_pac *bt_bap_add_vendor_pac(struct gatt_db *db,
> +struct bt_bap_pac *bt_bap_add_vendor_pac(struct bt_bap_db *bdb,
>                                         const char *name, uint8_t type,
>                                         uint8_t id, uint16_t cid, uint16_t vid,
>                                         struct bt_bap_pac_qos *qos,
>                                         struct iovec *data,
>                                         struct iovec *metadata);
>
> -struct bt_bap_pac *bt_bap_add_pac(struct gatt_db *db, const char *name,
> +struct bt_bap_pac *bt_bap_add_pac(struct bt_bap_db *bdb, const char *name,
>                                         uint8_t type, uint8_t id,
>                                         struct bt_bap_pac_qos *qos,
>                                         struct iovec *data,
> @@ -135,7 +136,9 @@ unsigned int bt_bap_register(bt_bap_func_t added, bt_bap_func_t removed,
>                                                         void *user_data);
>  bool bt_bap_unregister(unsigned int id);
>
> -struct bt_bap *bt_bap_new(struct gatt_db *ldb, struct gatt_db *rdb);
> +struct bt_bap_db *bt_bap_get_local_db(struct gatt_db *db, bool peripheral);
> +
> +struct bt_bap *bt_bap_new(struct bt_bap_db *ldb, struct gatt_db *rdb);
>
>  bool bt_bap_set_user_data(struct bt_bap *bap, void *user_data);
>
> diff --git a/unit/test-bap.c b/unit/test-bap.c
> index afeefac84..b677f5197 100644
> --- a/unit/test-bap.c
> +++ b/unit/test-bap.c
> @@ -311,6 +311,7 @@ static void test_client(const void *user_data)
>  {
>         struct test_data *data = (void *)user_data;
>         struct io *io;
> +       struct bt_bap_db *ldb;
>         struct gatt_db *db;
>
>         io = tester_setup_io(data->iov, data->iovcnt);
> @@ -321,7 +322,8 @@ static void test_client(const void *user_data)
>         db = gatt_db_new();
>         g_assert(db);
>
> -       data->bap = bt_bap_new(db, bt_gatt_client_get_db(data->client));
> +       ldb = bt_bap_get_local_db(db, true);
> +       data->bap = bt_bap_new(ldb, bt_gatt_client_get_db(data->client));
>         g_assert(data->bap);
>
>         bt_bap_set_debug(data->bap, print_debug, "bt_bap:", NULL);
> --
> 2.39.1
>


-- 
Luiz Augusto von Dentz

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

* Re: [PATCH BlueZ 7/8] shared/bap: handle central-only case
  2023-01-30 19:39     ` Luiz Augusto von Dentz
@ 2023-01-30 20:04       ` Pauli Virtanen
  2023-02-07  1:19         ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 43+ messages in thread
From: Pauli Virtanen @ 2023-01-30 20:04 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

Hi Luiz,

ma, 2023-01-30 kello 11:39 -0800, Luiz Augusto von Dentz kirjoitti:
> On Mon, Jan 30, 2023 at 11:06 AM Pauli Virtanen <pav@iki.fi> wrote:
> > 
> > Support central-only case, where no local endpoints are created, and
> > nothing is registered in the local GATT database.
> > 
> > In this case, we keep track of the local PACs ("sinks" and "sources"),
> > but there are no PACS and ASCS registrations or endpoints.
> 
> I'm not really following how that would work without local endpoints
> since the endpoints are the interface which is used to setup the
> stream with the likes of pipewire/pulseaudio we can't really remove
> them, what Id would suggest doing is to have a flag indicating if the
> instance is client only or not, that way bt_bap can identify if it
> needs to register services or not.

What I tried to say here is that in the central-only (or client in
other words) mode, no ASEs or PACs are registered in the local GATT DB.
The local endpoints do still exist in the Media1 API. In shared/bap.c
they are always associated with the PACs (not ASEs), so the client-only
mode does not need ASEs. So what is done is to my understanding what
you write above --- maybe I am missing something?

I've tested playback on this patchset for pipewire -> pipewire between
two machines, with the CIS Central flag forced to false on one end, and
CIS Peripheral false on the other end. Also playback to non-BlueZ
device works with CIS Peripheral flag disabled.

> 
> > ---
> >  src/shared/bap.c | 58 ++++++++++++++++++++++++++----------------------
> >  src/shared/bap.h |  9 +++++---
> >  unit/test-bap.c  |  4 +++-
> >  3 files changed, 40 insertions(+), 31 deletions(-)
> > 
> > diff --git a/src/shared/bap.c b/src/shared/bap.c
> > index 22f2e6714..24113bb34 100644
> > --- a/src/shared/bap.c
> > +++ b/src/shared/bap.c
> > @@ -110,11 +110,13 @@ struct bt_ascs {
> > 
> >  struct bt_bap_db {
> >         struct gatt_db *db;
> > -       struct bt_pacs *pacs;
> > -       struct bt_ascs *ascs;
> >         struct queue *sinks;
> >         struct queue *sources;
> > +
> > +       /* The following are NULL if central-only (no GATT) */
> >         struct queue *endpoints;
> > +       struct bt_pacs *pacs;
> > +       struct bt_ascs *ascs;
> >  };
> > 
> >  struct bt_bap_req {
> > @@ -565,6 +567,7 @@ static void bap_disconnected(int err, void *user_data)
> >  static struct bt_bap *bap_get_session(struct bt_att *att, struct gatt_db *db)
> >  {
> >         const struct queue_entry *entry;
> > +       struct bt_bap_db *ldb;
> >         struct bt_bap *bap;
> > 
> >         for (entry = queue_get_entries(sessions); entry; entry = entry->next) {
> > @@ -574,7 +577,8 @@ static struct bt_bap *bap_get_session(struct bt_att *att, struct gatt_db *db)
> >                         return bap;
> >         }
> > 
> > -       bap = bt_bap_new(db, NULL);
> > +       ldb = bt_bap_get_local_db(db, true);
> > +       bap = bt_bap_new(ldb, NULL);
> >         bap->att = att;
> > 
> >         bt_bap_attach(bap, NULL);
> > @@ -620,7 +624,7 @@ static struct bt_bap_endpoint *bap_get_endpoint(struct bt_bap_db *db,
> >  {
> >         struct bt_bap_endpoint *ep;
> > 
> > -       if (!db || !attr)
> > +       if (!db || !attr || !db->endpoints)
> >                 return NULL;
> > 
> >         ep = queue_find(db->endpoints, bap_endpoint_match, attr);
> > @@ -652,7 +656,7 @@ static struct bt_bap_endpoint *bap_get_endpoint_id(struct bt_bap *bap,
> >         struct gatt_db_attribute *attr = NULL;
> >         size_t i;
> > 
> > -       if (!bap || !db)
> > +       if (!bap || !db || !db->endpoints)
> >                 return NULL;
> > 
> >         ep = queue_find(db->endpoints, bap_endpoint_match_id, UINT_TO_PTR(id));
> > @@ -2170,7 +2174,7 @@ static struct bt_ascs *ascs_new(struct gatt_db *db)
> >         return ascs;
> >  }
> > 
> > -static struct bt_bap_db *bap_db_new(struct gatt_db *db)
> > +static struct bt_bap_db *bap_db_new(struct gatt_db *db, bool peripheral)
> >  {
> >         struct bt_bap_db *bdb;
> > 
> > @@ -2181,23 +2185,26 @@ static struct bt_bap_db *bap_db_new(struct gatt_db *db)
> >         bdb->db = gatt_db_ref(db);
> >         bdb->sinks = queue_new();
> >         bdb->sources = queue_new();
> > -       bdb->endpoints = queue_new();
> > 
> >         if (!bap_db)
> >                 bap_db = queue_new();
> > 
> > -       bdb->pacs = pacs_new(db);
> > -       bdb->pacs->bdb = bdb;
> > +       if (peripheral) {
> > +               bdb->endpoints = queue_new();
> > 
> > -       bdb->ascs = ascs_new(db);
> > -       bdb->ascs->bdb = bdb;
> > +               bdb->pacs = pacs_new(db);
> > +               bdb->pacs->bdb = bdb;
> > +
> > +               bdb->ascs = ascs_new(db);
> > +               bdb->ascs->bdb = bdb;
> > +       }
> > 
> >         queue_push_tail(bap_db, bdb);
> > 
> >         return bdb;
> >  }
> > 
> > -static struct bt_bap_db *bap_get_db(struct gatt_db *db)
> > +struct bt_bap_db *bt_bap_get_local_db(struct gatt_db *db, bool peripheral)
> >  {
> >         struct bt_bap_db *bdb;
> > 
> > @@ -2205,7 +2212,7 @@ static struct bt_bap_db *bap_get_db(struct gatt_db *db)
> >         if (bdb)
> >                 return bdb;
> > 
> > -       return bap_db_new(db);
> > +       return bap_db_new(db, peripheral);
> >  }
> > 
> >  static struct bt_pacs *bap_get_pacs(struct bt_bap *bap)
> > @@ -2328,6 +2335,9 @@ static void bap_add_sink(struct bt_bap_pac *pac)
> > 
> >         queue_push_tail(pac->bdb->sinks, pac);
> > 
> > +       if (!pac->bdb->endpoints)
> > +               return;
> > +
> >         memset(value, 0, sizeof(value));
> > 
> >         iov.iov_base = value;
> > @@ -2346,6 +2356,9 @@ static void bap_add_source(struct bt_bap_pac *pac)
> > 
> >         queue_push_tail(pac->bdb->sources, pac);
> > 
> > +       if (!pac->bdb->endpoints)
> > +               return;
> > +
> >         memset(value, 0, sizeof(value));
> > 
> >         iov.iov_base = value;
> > @@ -2373,21 +2386,16 @@ static void notify_session_pac_added(void *data, void *user_data)
> >         queue_foreach(bap->pac_cbs, notify_pac_added, user_data);
> >  }
> > 
> > -struct bt_bap_pac *bt_bap_add_vendor_pac(struct gatt_db *db,
> > +struct bt_bap_pac *bt_bap_add_vendor_pac(struct bt_bap_db *bdb,
> >                                         const char *name, uint8_t type,
> >                                         uint8_t id, uint16_t cid, uint16_t vid,
> >                                         struct bt_bap_pac_qos *qos,
> >                                         struct iovec *data,
> >                                         struct iovec *metadata)
> >  {
> > -       struct bt_bap_db *bdb;
> >         struct bt_bap_pac *pac;
> >         struct bt_bap_codec codec;
> > 
> > -       if (!db)
> > -               return NULL;
> > -
> > -       bdb = bap_get_db(db);
> >         if (!bdb)
> >                 return NULL;
> > 
> > @@ -2417,13 +2425,13 @@ struct bt_bap_pac *bt_bap_add_vendor_pac(struct gatt_db *db,
> >         return pac;
> >  }
> > 
> > -struct bt_bap_pac *bt_bap_add_pac(struct gatt_db *db, const char *name,
> > +struct bt_bap_pac *bt_bap_add_pac(struct bt_bap_db *bdb, const char *name,
> >                                         uint8_t type, uint8_t id,
> >                                         struct bt_bap_pac_qos *qos,
> >                                         struct iovec *data,
> >                                         struct iovec *metadata)
> >  {
> > -       return bt_bap_add_vendor_pac(db, name, type, id, 0x0000, 0x0000, qos,
> > +       return bt_bap_add_vendor_pac(bdb, name, type, id, 0x0000, 0x0000, qos,
> >                                                         data, metadata);
> >  }
> > 
> > @@ -2635,7 +2643,7 @@ static void bap_attached(void *data, void *user_data)
> >         cb->attached(bap, cb->user_data);
> >  }
> > 
> > -struct bt_bap *bt_bap_new(struct gatt_db *ldb, struct gatt_db *rdb)
> > +struct bt_bap *bt_bap_new(struct bt_bap_db *ldb, struct gatt_db *rdb)
> >  {
> >         struct bt_bap *bap;
> >         struct bt_bap_db *bdb;
> > @@ -2643,12 +2651,8 @@ struct bt_bap *bt_bap_new(struct gatt_db *ldb, struct gatt_db *rdb)
> >         if (!ldb)
> >                 return NULL;
> > 
> > -       bdb = bap_get_db(ldb);
> > -       if (!bdb)
> > -               return NULL;
> > -
> >         bap = new0(struct bt_bap, 1);
> > -       bap->ldb = bdb;
> > +       bap->ldb = ldb;
> >         bap->reqs = queue_new();
> >         bap->pending = queue_new();
> >         bap->notify = queue_new();
> > diff --git a/src/shared/bap.h b/src/shared/bap.h
> > index 47a15636c..a4e8549a5 100644
> > --- a/src/shared/bap.h
> > +++ b/src/shared/bap.h
> > @@ -34,6 +34,7 @@
> >  #define BT_BAP_CONFIG_PHY_CODEC                0x03
> > 
> >  struct bt_bap;
> > +struct bt_bap_db;
> >  struct bt_bap_pac;
> >  struct bt_bap_stream;
> > 
> > @@ -98,14 +99,14 @@ struct bt_bap_pac_qos {
> >         uint32_t ppd_max;
> >  };
> > 
> > -struct bt_bap_pac *bt_bap_add_vendor_pac(struct gatt_db *db,
> > +struct bt_bap_pac *bt_bap_add_vendor_pac(struct bt_bap_db *bdb,
> >                                         const char *name, uint8_t type,
> >                                         uint8_t id, uint16_t cid, uint16_t vid,
> >                                         struct bt_bap_pac_qos *qos,
> >                                         struct iovec *data,
> >                                         struct iovec *metadata);
> > 
> > -struct bt_bap_pac *bt_bap_add_pac(struct gatt_db *db, const char *name,
> > +struct bt_bap_pac *bt_bap_add_pac(struct bt_bap_db *bdb, const char *name,
> >                                         uint8_t type, uint8_t id,
> >                                         struct bt_bap_pac_qos *qos,
> >                                         struct iovec *data,
> > @@ -135,7 +136,9 @@ unsigned int bt_bap_register(bt_bap_func_t added, bt_bap_func_t removed,
> >                                                         void *user_data);
> >  bool bt_bap_unregister(unsigned int id);
> > 
> > -struct bt_bap *bt_bap_new(struct gatt_db *ldb, struct gatt_db *rdb);
> > +struct bt_bap_db *bt_bap_get_local_db(struct gatt_db *db, bool peripheral);
> > +
> > +struct bt_bap *bt_bap_new(struct bt_bap_db *ldb, struct gatt_db *rdb);
> > 
> >  bool bt_bap_set_user_data(struct bt_bap *bap, void *user_data);
> > 
> > diff --git a/unit/test-bap.c b/unit/test-bap.c
> > index afeefac84..b677f5197 100644
> > --- a/unit/test-bap.c
> > +++ b/unit/test-bap.c
> > @@ -311,6 +311,7 @@ static void test_client(const void *user_data)
> >  {
> >         struct test_data *data = (void *)user_data;
> >         struct io *io;
> > +       struct bt_bap_db *ldb;
> >         struct gatt_db *db;
> > 
> >         io = tester_setup_io(data->iov, data->iovcnt);
> > @@ -321,7 +322,8 @@ static void test_client(const void *user_data)
> >         db = gatt_db_new();
> >         g_assert(db);
> > 
> > -       data->bap = bt_bap_new(db, bt_gatt_client_get_db(data->client));
> > +       ldb = bt_bap_get_local_db(db, true);
> > +       data->bap = bt_bap_new(ldb, bt_gatt_client_get_db(data->client));
> >         g_assert(data->bap);
> > 
> >         bt_bap_set_debug(data->bap, print_debug, "bt_bap:", NULL);
> > --
> > 2.39.1
> > 
> 
> 

-- 
Pauli Virtanen

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

* RE: [BlueZ,1/8] doc: add MGMT setting for CIS features, remove Quality Report
  2023-01-30 18:37 ` [PATCH BlueZ 1/8] doc: add MGMT setting for CIS features, remove Quality Report Pauli Virtanen
                     ` (6 preceding siblings ...)
  2023-01-30 18:37   ` [PATCH BlueZ 8/8] bap: handle adapters that are not CIS Central / Peripheral capable Pauli Virtanen
@ 2023-01-30 20:13   ` bluez.test.bot
  2023-02-07  1:08   ` [PATCH BlueZ 1/8] " Luiz Augusto von Dentz
  2023-02-13 22:20   ` patchwork-bot+bluetooth
  9 siblings, 0 replies; 43+ messages in thread
From: bluez.test.bot @ 2023-01-30 20:13 UTC (permalink / raw)
  To: linux-bluetooth, pav

[-- Attachment #1: Type: text/plain, Size: 3443 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=717083

---Test result---

Test Summary:
CheckPatch                    FAIL      2.20 seconds
GitLint                       FAIL      1.53 seconds
BuildEll                      PASS      27.04 seconds
BluezMake                     PASS      745.55 seconds
MakeCheck                     PASS      11.00 seconds
MakeDistcheck                 PASS      146.65 seconds
CheckValgrind                 PASS      238.51 seconds
CheckSmatch                   WARNING   317.34 seconds
bluezmakeextell               PASS      95.56 seconds
IncrementalBuild              PASS      3050.31 seconds
ScanBuild                     PASS      938.84 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[BlueZ,1/8] doc: add MGMT setting for CIS features, remove Quality Report
WARNING:UNKNOWN_COMMIT_ID: Unknown commit id '0454e2d09570', maybe rebased or not pulled?
#99: 
commit 0454e2d09570 ("mgmt: Add support for Mesh in the kernel"),

/github/workspace/src/src/13121669.patch total: 0 errors, 1 warnings, 18 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/src/13121669.patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.


##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[BlueZ,1/8] doc: add MGMT setting for CIS features, remove Quality Report

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
15: B2 Line has trailing whitespace: "    "
[BlueZ,4/8] tools/btmgmt: add names for MGMT setting bits for CIS feature support

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
1: T1 Title exceeds max length (81>80): "[BlueZ,4/8] tools/btmgmt: add names for MGMT setting bits for CIS feature support"
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
monitor/packet.c: note: in included file:monitor/display.h:82:26: warning: Variable length array is used.monitor/packet.c:1799:26: warning: Variable length array is used.monitor/packet.c: note: in included file:monitor/bt.h:3551:52: warning: array of flexible structuresmonitor/bt.h:3539:40: warning: array of flexible structures


---
Regards,
Linux Bluetooth


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

* [PATCH BlueZ] media: set default value for BAP endpoint Vendor field
@ 2023-02-01 18:41 ` Pauli Virtanen
  2023-02-01 19:10   ` Luiz Augusto von Dentz
                     ` (2 more replies)
  0 siblings, 3 replies; 43+ messages in thread
From: Pauli Virtanen @ 2023-02-01 18:41 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Pauli Virtanen

The "Vendor" field is optional, and should have an initialized valid
default value.
---
 profiles/audio/media.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/profiles/audio/media.c b/profiles/audio/media.c
index d96367454..a62755f69 100644
--- a/profiles/audio/media.c
+++ b/profiles/audio/media.c
@@ -2551,7 +2551,7 @@ static void app_register_endpoint(void *data, void *user_data)
 	const char *uuid;
 	gboolean delay_reporting = FALSE;
 	uint8_t codec;
-	struct vendor vendor;
+	struct vendor vendor = { 0 };
 	struct bt_bap_pac_qos qos;
 	uint8_t *capabilities = NULL;
 	int size = 0;
-- 
2.39.1


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

* Re: [PATCH BlueZ] media: set default value for BAP endpoint Vendor field
  2023-02-01 18:41 ` [PATCH BlueZ] media: set default value for BAP endpoint Vendor field Pauli Virtanen
@ 2023-02-01 19:10   ` Luiz Augusto von Dentz
  2023-02-01 19:51   ` [PATCH BlueZ v2] " Pauli Virtanen
  2023-02-01 20:05   ` [BlueZ] " bluez.test.bot
  2 siblings, 0 replies; 43+ messages in thread
From: Luiz Augusto von Dentz @ 2023-02-01 19:10 UTC (permalink / raw)
  To: Pauli Virtanen; +Cc: linux-bluetooth

Hi Pauli,

On Wed, Feb 1, 2023 at 10:57 AM Pauli Virtanen <pav@iki.fi> wrote:
>
> The "Vendor" field is optional, and should have an initialized valid
> default value.

It is probably a good idea to include logs where the problem is detected.

> ---
>  profiles/audio/media.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/profiles/audio/media.c b/profiles/audio/media.c
> index d96367454..a62755f69 100644
> --- a/profiles/audio/media.c
> +++ b/profiles/audio/media.c
> @@ -2551,7 +2551,7 @@ static void app_register_endpoint(void *data, void *user_data)
>         const char *uuid;
>         gboolean delay_reporting = FALSE;
>         uint8_t codec;
> -       struct vendor vendor;
> +       struct vendor vendor = { 0 };

I guess {}; or { 0,0 }; are clearer here since there are 2 fields in
the struct, although it is probably safer to go with memset(&vendor,
0, sizeof(vendor)).

>         struct bt_bap_pac_qos qos;
>         uint8_t *capabilities = NULL;
>         int size = 0;
> --
> 2.39.1
>


-- 
Luiz Augusto von Dentz

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

* [PATCH BlueZ v2] media: set default value for BAP endpoint Vendor field
  2023-02-01 18:41 ` [PATCH BlueZ] media: set default value for BAP endpoint Vendor field Pauli Virtanen
  2023-02-01 19:10   ` Luiz Augusto von Dentz
@ 2023-02-01 19:51   ` Pauli Virtanen
  2023-02-01 21:14     ` [BlueZ,v2] " bluez.test.bot
  2023-02-01 21:50     ` [PATCH BlueZ v2] " patchwork-bot+bluetooth
  2023-02-01 20:05   ` [BlueZ] " bluez.test.bot
  2 siblings, 2 replies; 43+ messages in thread
From: Pauli Virtanen @ 2023-02-01 19:51 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Pauli Virtanen

The "Vendor" field is optional, and should have an initialized valid
default value.

It has the default values in register_endpoint, but not in
app_register_endpoint, so make the latter match the former.
---

Notes:
    v2: Let's not use C99 initializers.
    
    The uninitialized values cause Pipewire media endpoint registrations to
    fail, and this makes it work again. Its BAP media endpoints do not have
    the Vendor field, given that they use LC3, so the struct in
    app_register_endpoint ends up containing random garbage.  The resulting
    invalid codec/cid/vid value combination is rejected by
    bt_bap_add_vendor_pac.

 profiles/audio/media.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/profiles/audio/media.c b/profiles/audio/media.c
index d96367454..8a2afd04c 100644
--- a/profiles/audio/media.c
+++ b/profiles/audio/media.c
@@ -2583,6 +2583,8 @@ static void app_register_endpoint(void *data, void *user_data)
 
 	dbus_message_iter_get_basic(&iter, &codec);
 
+	memset(&vendor, 0, sizeof(vendor));
+
 	if (g_dbus_proxy_get_property(proxy, "Vendor", &iter)) {
 		if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_UINT32)
 			goto fail;
-- 
2.39.1


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

* RE: [BlueZ] media: set default value for BAP endpoint Vendor field
  2023-02-01 18:41 ` [PATCH BlueZ] media: set default value for BAP endpoint Vendor field Pauli Virtanen
  2023-02-01 19:10   ` Luiz Augusto von Dentz
  2023-02-01 19:51   ` [PATCH BlueZ v2] " Pauli Virtanen
@ 2023-02-01 20:05   ` bluez.test.bot
  2 siblings, 0 replies; 43+ messages in thread
From: bluez.test.bot @ 2023-02-01 20:05 UTC (permalink / raw)
  To: linux-bluetooth, pav

[-- Attachment #1: Type: text/plain, Size: 945 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=717858

---Test result---

Test Summary:
CheckPatch                    PASS      0.50 seconds
GitLint                       PASS      0.25 seconds
BuildEll                      PASS      26.98 seconds
BluezMake                     PASS      749.00 seconds
MakeCheck                     PASS      11.59 seconds
MakeDistcheck                 PASS      147.49 seconds
CheckValgrind                 PASS      238.95 seconds
CheckSmatch                   PASS      317.56 seconds
bluezmakeextell               PASS      95.51 seconds
IncrementalBuild              PASS      610.03 seconds
ScanBuild                     PASS      966.48 seconds



---
Regards,
Linux Bluetooth


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

* RE: [BlueZ,v2] media: set default value for BAP endpoint Vendor field
  2023-02-01 19:51   ` [PATCH BlueZ v2] " Pauli Virtanen
@ 2023-02-01 21:14     ` bluez.test.bot
  2023-02-01 21:50     ` [PATCH BlueZ v2] " patchwork-bot+bluetooth
  1 sibling, 0 replies; 43+ messages in thread
From: bluez.test.bot @ 2023-02-01 21:14 UTC (permalink / raw)
  To: linux-bluetooth, pav

[-- Attachment #1: Type: text/plain, Size: 1503 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=717874

---Test result---

Test Summary:
CheckPatch                    PASS      1.01 seconds
GitLint                       FAIL      0.67 seconds
BuildEll                      PASS      28.44 seconds
BluezMake                     PASS      860.68 seconds
MakeCheck                     PASS      11.86 seconds
MakeDistcheck                 PASS      148.18 seconds
CheckValgrind                 PASS      244.17 seconds
CheckSmatch                   PASS      325.68 seconds
bluezmakeextell               PASS      97.45 seconds
IncrementalBuild              PASS      703.79 seconds
ScanBuild                     PASS      1001.52 seconds

Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[BlueZ,v2] media: set default value for BAP endpoint Vendor field

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
12: B2 Line has trailing whitespace: "    "


---
Regards,
Linux Bluetooth


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

* Re: [PATCH BlueZ v2] media: set default value for BAP endpoint Vendor field
  2023-02-01 19:51   ` [PATCH BlueZ v2] " Pauli Virtanen
  2023-02-01 21:14     ` [BlueZ,v2] " bluez.test.bot
@ 2023-02-01 21:50     ` patchwork-bot+bluetooth
  1 sibling, 0 replies; 43+ messages in thread
From: patchwork-bot+bluetooth @ 2023-02-01 21:50 UTC (permalink / raw)
  To: Pauli Virtanen; +Cc: linux-bluetooth

Hello:

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

On Wed,  1 Feb 2023 19:51:47 +0000 you wrote:
> The "Vendor" field is optional, and should have an initialized valid
> default value.
> 
> It has the default values in register_endpoint, but not in
> app_register_endpoint, so make the latter match the former.
> ---
> 
> [...]

Here is the summary with links:
  - [BlueZ,v2] media: set default value for BAP endpoint Vendor field
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=67395a3b357d

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] 43+ messages in thread

* Re: [PATCH BlueZ 1/8] doc: add MGMT setting for CIS features, remove Quality Report
  2023-01-30 18:37 ` [PATCH BlueZ 1/8] doc: add MGMT setting for CIS features, remove Quality Report Pauli Virtanen
                     ` (7 preceding siblings ...)
  2023-01-30 20:13   ` [BlueZ,1/8] doc: add MGMT setting for CIS features, remove Quality Report bluez.test.bot
@ 2023-02-07  1:08   ` Luiz Augusto von Dentz
  2023-02-10 20:07     ` Luiz Augusto von Dentz
  2023-02-13 22:20   ` patchwork-bot+bluetooth
  9 siblings, 1 reply; 43+ messages in thread
From: Luiz Augusto von Dentz @ 2023-02-07  1:08 UTC (permalink / raw)
  To: Pauli Virtanen; +Cc: linux-bluetooth

Hi Pauli,

On Mon, Jan 30, 2023 at 10:43 AM Pauli Virtanen <pav@iki.fi> wrote:
>
> Add definitions for new MGMT Controller Information settings bits,
> indicating adapter Connected Isochronous Stream - Central/Peripheral
> feature support.
>
> The Set Quality Report command was removed in
> commit 0454e2d09570 ("mgmt: Add support for Mesh in the kernel"),
> but the settings bit was not removed. It's also not implemented on
> kernel side, so remove it now.

Let's split this into 2 patches, one removing Quality Report, since it
was never implemented, and then another including the new flags.

> ---
>
> Notes:
>     Was the quality report setting bit reserved on purpose?
>
>     From the commit log it looks like it was forgotten to remove from the
>     docs, but this is not clear.
>
>  doc/mgmt-api.txt | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/doc/mgmt-api.txt b/doc/mgmt-api.txt
> index 90d612ed8..58395dc90 100644
> --- a/doc/mgmt-api.txt
> +++ b/doc/mgmt-api.txt
> @@ -332,7 +332,8 @@ Read Controller Information Command
>                 15      Static Address
>                 16      PHY Configuration
>                 17      Wideband Speech
> -               18      Quality Report
> +               18      Connected Isochronous Stream - Central
> +               19      Connected Isochronous Stream - Peripheral
>
>         This command generates a Command Complete event on success or
>         a Command Status event on failure.
> @@ -2925,7 +2926,8 @@ Read Extended Controller Information Command
>                 15      Static Address
>                 16      PHY Configuration
>                 17      Wideband Speech
> -               18      Quality Report
> +               18      Connected Isochronous Stream - Central
> +               19      Connected Isochronous Stream - Peripheral
>
>         The EIR_Data field contains information about class of device,
>         local name and other values. Not all of them might be present. For
> --
> 2.39.1
>


-- 
Luiz Augusto von Dentz

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

* Re: [PATCH BlueZ 5/8] adapter: add functions indicating adapter CIS capability
  2023-01-30 18:37   ` [PATCH BlueZ 5/8] adapter: add functions indicating adapter CIS capability Pauli Virtanen
@ 2023-02-07  1:10     ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 43+ messages in thread
From: Luiz Augusto von Dentz @ 2023-02-07  1:10 UTC (permalink / raw)
  To: Pauli Virtanen; +Cc: linux-bluetooth

Hi Pauli,

On Mon, Jan 30, 2023 at 10:58 AM Pauli Virtanen <pav@iki.fi> wrote:
>
> ---
>  src/adapter.c | 16 ++++++++++++++++
>  src/adapter.h |  3 +++
>  2 files changed, 19 insertions(+)
>
> diff --git a/src/adapter.c b/src/adapter.c
> index aadad4016..4f06bce53 100644
> --- a/src/adapter.c
> +++ b/src/adapter.c
> @@ -9033,6 +9033,22 @@ bool btd_adapter_ssp_enabled(struct btd_adapter *adapter)
>         return false;
>  }
>
> +bool btd_adapter_cis_central_capable(struct btd_adapter *adapter)
> +{
> +       if (adapter->current_settings & MGMT_SETTING_CIS_CENTRAL)
> +               return true;
> +
> +       return false;
> +}
> +
> +bool btd_adapter_cis_peripheral_capable(struct btd_adapter *adapter)
> +{
> +       if (adapter->current_settings & MGMT_SETTING_CIS_PERIPHERAL)
> +               return true;
> +
> +       return false;
> +}
> +
>  void btd_adapter_set_oob_handler(struct btd_adapter *adapter,
>                                                 struct oob_handler *handler)
>  {
> diff --git a/src/adapter.h b/src/adapter.h
> index 78eb069ae..3fcee30bc 100644
> --- a/src/adapter.h
> +++ b/src/adapter.h
> @@ -226,6 +226,9 @@ void btd_adapter_gatt_server_stop(struct btd_adapter *adapter);
>
>  bool btd_adapter_ssp_enabled(struct btd_adapter *adapter);
>
> +bool btd_adapter_cis_central_capable(struct btd_adapter *adapter);
> +bool btd_adapter_cis_peripheral_capable(struct btd_adapter *adapter);

Lets just have btd_adapter_capable(struct btd_adapter *adapter, int
flags) to make it simple to check multiple flags if needed.

>  int adapter_connect_list_add(struct btd_adapter *adapter,
>                                         struct btd_device *device);
>  void adapter_connect_list_remove(struct btd_adapter *adapter,
> --
> 2.39.1
>


-- 
Luiz Augusto von Dentz

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

* Re: [PATCH BlueZ 3/8] monitor: add names for MGMT setting bits for CIS feature support
  2023-01-30 18:37   ` [PATCH BlueZ 3/8] monitor: add names " Pauli Virtanen
@ 2023-02-07  1:12     ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 43+ messages in thread
From: Luiz Augusto von Dentz @ 2023-02-07  1:12 UTC (permalink / raw)
  To: Pauli Virtanen; +Cc: linux-bluetooth

Hi Pauli,

On Mon, Jan 30, 2023 at 10:48 AM Pauli Virtanen <pav@iki.fi> wrote:

Let's have the btmon output in the description to make it easier to
visualize how this changes affect it.

> ---
>  monitor/packet.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/monitor/packet.c b/monitor/packet.c
> index 44f1941bd..d9e8abf41 100644
> --- a/monitor/packet.c
> +++ b/monitor/packet.c
> @@ -12649,6 +12649,8 @@ static const struct bitfield_data mgmt_settings_table[] = {
>         { 15, "Static Address"          },
>         { 16, "PHY Configuration"       },
>         { 17, "Wideband Speech"         },
> +       { 18, "CIS Central"             },
> +       { 19, "CIS Peripheral"          },
>         { }
>  };
>
> --
> 2.39.1
>


-- 
Luiz Augusto von Dentz

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

* Re: [PATCH BlueZ 2/8] lib: Add defines for MGMT setting bits for CIS feature support
  2023-01-30 18:37   ` [PATCH BlueZ 2/8] lib: Add defines for MGMT setting bits for CIS feature support Pauli Virtanen
@ 2023-02-07  1:13     ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 43+ messages in thread
From: Luiz Augusto von Dentz @ 2023-02-07  1:13 UTC (permalink / raw)
  To: Pauli Virtanen; +Cc: linux-bluetooth

Hi Pauli,

On Mon, Jan 30, 2023 at 10:56 AM Pauli Virtanen <pav@iki.fi> wrote:
>
> ---
>  lib/mgmt.h | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/lib/mgmt.h b/lib/mgmt.h
> index 796190cd9..efbdfb4b1 100644
> --- a/lib/mgmt.h
> +++ b/lib/mgmt.h
> @@ -96,6 +96,8 @@ struct mgmt_rp_read_index_list {
>  #define MGMT_SETTING_STATIC_ADDRESS    0x00008000
>  #define MGMT_SETTING_PHY_CONFIGURATION 0x00010000
>  #define MGMT_SETTING_WIDEBAND_SPEECH   0x00020000
> +#define MGMT_SETTING_CIS_CENTRAL       0x00040000
> +#define MGMT_SETTING_CIS_PERIPHERAL    0x00080000

Perhaps now it would be a good time to convert these to use BIT macro.

>  #define MGMT_OP_READ_INFO              0x0004
>  struct mgmt_rp_read_info {
> --
> 2.39.1
>


-- 
Luiz Augusto von Dentz

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

* Re: [PATCH BlueZ 4/8] tools/btmgmt: add names for MGMT setting bits for CIS feature support
  2023-01-30 18:37   ` [PATCH BlueZ 4/8] tools/btmgmt: " Pauli Virtanen
@ 2023-02-07  1:14     ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 43+ messages in thread
From: Luiz Augusto von Dentz @ 2023-02-07  1:14 UTC (permalink / raw)
  To: Pauli Virtanen; +Cc: linux-bluetooth

Hi Pauli,

On Mon, Jan 30, 2023 at 10:50 AM Pauli Virtanen <pav@iki.fi> wrote:

Add the btmgmt output as a description showing the result of these changes.

> ---
>  tools/btmgmt.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/tools/btmgmt.c b/tools/btmgmt.c
> index 29f86091f..323c26712 100644
> --- a/tools/btmgmt.c
> +++ b/tools/btmgmt.c
> @@ -353,6 +353,8 @@ static const char *settings_str[] = {
>                                 "static-addr",
>                                 "phy-configuration",
>                                 "wide-band-speech",
> +                               "cis-central",
> +                               "cis-peripheral",
>  };
>
>  static const char *settings2str(uint32_t settings)
> --
> 2.39.1
>


-- 
Luiz Augusto von Dentz

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

* Re: [PATCH BlueZ 7/8] shared/bap: handle central-only case
  2023-01-30 20:04       ` Pauli Virtanen
@ 2023-02-07  1:19         ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 43+ messages in thread
From: Luiz Augusto von Dentz @ 2023-02-07  1:19 UTC (permalink / raw)
  To: Pauli Virtanen; +Cc: linux-bluetooth

Hi Pauli,

On Mon, Jan 30, 2023 at 12:04 PM Pauli Virtanen <pav@iki.fi> wrote:
>
> Hi Luiz,
>
> ma, 2023-01-30 kello 11:39 -0800, Luiz Augusto von Dentz kirjoitti:
> > On Mon, Jan 30, 2023 at 11:06 AM Pauli Virtanen <pav@iki.fi> wrote:
> > >
> > > Support central-only case, where no local endpoints are created, and
> > > nothing is registered in the local GATT database.
> > >
> > > In this case, we keep track of the local PACs ("sinks" and "sources"),
> > > but there are no PACS and ASCS registrations or endpoints.
> >
> > I'm not really following how that would work without local endpoints
> > since the endpoints are the interface which is used to setup the
> > stream with the likes of pipewire/pulseaudio we can't really remove
> > them, what Id would suggest doing is to have a flag indicating if the
> > instance is client only or not, that way bt_bap can identify if it
> > needs to register services or not.
>
> What I tried to say here is that in the central-only (or client in
> other words) mode, no ASEs or PACs are registered in the local GATT DB.
> The local endpoints do still exist in the Media1 API. In shared/bap.c
> they are always associated with the PACs (not ASEs), so the client-only
> mode does not need ASEs. So what is done is to my understanding what
> you write above --- maybe I am missing something?

Make sense.

> I've tested playback on this patchset for pipewire -> pipewire between
> two machines, with the CIS Central flag forced to false on one end, and
> CIS Peripheral false on the other end. Also playback to non-BlueZ
> device works with CIS Peripheral flag disabled.

Alright, make sure it also works with the likes of bluetoothctl -e as
well, since that is likely how the CI will be testing this in the
future.

> >
> > > ---
> > >  src/shared/bap.c | 58 ++++++++++++++++++++++++++----------------------
> > >  src/shared/bap.h |  9 +++++---
> > >  unit/test-bap.c  |  4 +++-
> > >  3 files changed, 40 insertions(+), 31 deletions(-)
> > >
> > > diff --git a/src/shared/bap.c b/src/shared/bap.c
> > > index 22f2e6714..24113bb34 100644
> > > --- a/src/shared/bap.c
> > > +++ b/src/shared/bap.c
> > > @@ -110,11 +110,13 @@ struct bt_ascs {
> > >
> > >  struct bt_bap_db {
> > >         struct gatt_db *db;
> > > -       struct bt_pacs *pacs;
> > > -       struct bt_ascs *ascs;
> > >         struct queue *sinks;
> > >         struct queue *sources;
> > > +
> > > +       /* The following are NULL if central-only (no GATT) */
> > >         struct queue *endpoints;
> > > +       struct bt_pacs *pacs;
> > > +       struct bt_ascs *ascs;
> > >  };
> > >
> > >  struct bt_bap_req {
> > > @@ -565,6 +567,7 @@ static void bap_disconnected(int err, void *user_data)
> > >  static struct bt_bap *bap_get_session(struct bt_att *att, struct gatt_db *db)
> > >  {
> > >         const struct queue_entry *entry;
> > > +       struct bt_bap_db *ldb;
> > >         struct bt_bap *bap;
> > >
> > >         for (entry = queue_get_entries(sessions); entry; entry = entry->next) {
> > > @@ -574,7 +577,8 @@ static struct bt_bap *bap_get_session(struct bt_att *att, struct gatt_db *db)
> > >                         return bap;
> > >         }
> > >
> > > -       bap = bt_bap_new(db, NULL);
> > > +       ldb = bt_bap_get_local_db(db, true);
> > > +       bap = bt_bap_new(ldb, NULL);
> > >         bap->att = att;
> > >
> > >         bt_bap_attach(bap, NULL);
> > > @@ -620,7 +624,7 @@ static struct bt_bap_endpoint *bap_get_endpoint(struct bt_bap_db *db,
> > >  {
> > >         struct bt_bap_endpoint *ep;
> > >
> > > -       if (!db || !attr)
> > > +       if (!db || !attr || !db->endpoints)
> > >                 return NULL;
> > >
> > >         ep = queue_find(db->endpoints, bap_endpoint_match, attr);
> > > @@ -652,7 +656,7 @@ static struct bt_bap_endpoint *bap_get_endpoint_id(struct bt_bap *bap,
> > >         struct gatt_db_attribute *attr = NULL;
> > >         size_t i;
> > >
> > > -       if (!bap || !db)
> > > +       if (!bap || !db || !db->endpoints)
> > >                 return NULL;
> > >
> > >         ep = queue_find(db->endpoints, bap_endpoint_match_id, UINT_TO_PTR(id));
> > > @@ -2170,7 +2174,7 @@ static struct bt_ascs *ascs_new(struct gatt_db *db)
> > >         return ascs;
> > >  }
> > >
> > > -static struct bt_bap_db *bap_db_new(struct gatt_db *db)
> > > +static struct bt_bap_db *bap_db_new(struct gatt_db *db, bool peripheral)
> > >  {
> > >         struct bt_bap_db *bdb;
> > >
> > > @@ -2181,23 +2185,26 @@ static struct bt_bap_db *bap_db_new(struct gatt_db *db)
> > >         bdb->db = gatt_db_ref(db);
> > >         bdb->sinks = queue_new();
> > >         bdb->sources = queue_new();
> > > -       bdb->endpoints = queue_new();
> > >
> > >         if (!bap_db)
> > >                 bap_db = queue_new();
> > >
> > > -       bdb->pacs = pacs_new(db);
> > > -       bdb->pacs->bdb = bdb;
> > > +       if (peripheral) {
> > > +               bdb->endpoints = queue_new();
> > >
> > > -       bdb->ascs = ascs_new(db);
> > > -       bdb->ascs->bdb = bdb;
> > > +               bdb->pacs = pacs_new(db);
> > > +               bdb->pacs->bdb = bdb;
> > > +
> > > +               bdb->ascs = ascs_new(db);
> > > +               bdb->ascs->bdb = bdb;
> > > +       }
> > >
> > >         queue_push_tail(bap_db, bdb);
> > >
> > >         return bdb;
> > >  }
> > >
> > > -static struct bt_bap_db *bap_get_db(struct gatt_db *db)
> > > +struct bt_bap_db *bt_bap_get_local_db(struct gatt_db *db, bool peripheral)
> > >  {
> > >         struct bt_bap_db *bdb;
> > >
> > > @@ -2205,7 +2212,7 @@ static struct bt_bap_db *bap_get_db(struct gatt_db *db)
> > >         if (bdb)
> > >                 return bdb;
> > >
> > > -       return bap_db_new(db);
> > > +       return bap_db_new(db, peripheral);
> > >  }
> > >
> > >  static struct bt_pacs *bap_get_pacs(struct bt_bap *bap)
> > > @@ -2328,6 +2335,9 @@ static void bap_add_sink(struct bt_bap_pac *pac)
> > >
> > >         queue_push_tail(pac->bdb->sinks, pac);
> > >
> > > +       if (!pac->bdb->endpoints)
> > > +               return;
> > > +
> > >         memset(value, 0, sizeof(value));
> > >
> > >         iov.iov_base = value;
> > > @@ -2346,6 +2356,9 @@ static void bap_add_source(struct bt_bap_pac *pac)
> > >
> > >         queue_push_tail(pac->bdb->sources, pac);
> > >
> > > +       if (!pac->bdb->endpoints)
> > > +               return;
> > > +
> > >         memset(value, 0, sizeof(value));
> > >
> > >         iov.iov_base = value;
> > > @@ -2373,21 +2386,16 @@ static void notify_session_pac_added(void *data, void *user_data)
> > >         queue_foreach(bap->pac_cbs, notify_pac_added, user_data);
> > >  }
> > >
> > > -struct bt_bap_pac *bt_bap_add_vendor_pac(struct gatt_db *db,
> > > +struct bt_bap_pac *bt_bap_add_vendor_pac(struct bt_bap_db *bdb,
> > >                                         const char *name, uint8_t type,
> > >                                         uint8_t id, uint16_t cid, uint16_t vid,
> > >                                         struct bt_bap_pac_qos *qos,
> > >                                         struct iovec *data,
> > >                                         struct iovec *metadata)
> > >  {
> > > -       struct bt_bap_db *bdb;
> > >         struct bt_bap_pac *pac;
> > >         struct bt_bap_codec codec;
> > >
> > > -       if (!db)
> > > -               return NULL;
> > > -
> > > -       bdb = bap_get_db(db);
> > >         if (!bdb)
> > >                 return NULL;
> > >
> > > @@ -2417,13 +2425,13 @@ struct bt_bap_pac *bt_bap_add_vendor_pac(struct gatt_db *db,
> > >         return pac;
> > >  }
> > >
> > > -struct bt_bap_pac *bt_bap_add_pac(struct gatt_db *db, const char *name,
> > > +struct bt_bap_pac *bt_bap_add_pac(struct bt_bap_db *bdb, const char *name,
> > >                                         uint8_t type, uint8_t id,
> > >                                         struct bt_bap_pac_qos *qos,
> > >                                         struct iovec *data,
> > >                                         struct iovec *metadata)
> > >  {
> > > -       return bt_bap_add_vendor_pac(db, name, type, id, 0x0000, 0x0000, qos,
> > > +       return bt_bap_add_vendor_pac(bdb, name, type, id, 0x0000, 0x0000, qos,
> > >                                                         data, metadata);
> > >  }
> > >
> > > @@ -2635,7 +2643,7 @@ static void bap_attached(void *data, void *user_data)
> > >         cb->attached(bap, cb->user_data);
> > >  }
> > >
> > > -struct bt_bap *bt_bap_new(struct gatt_db *ldb, struct gatt_db *rdb)
> > > +struct bt_bap *bt_bap_new(struct bt_bap_db *ldb, struct gatt_db *rdb)
> > >  {
> > >         struct bt_bap *bap;
> > >         struct bt_bap_db *bdb;
> > > @@ -2643,12 +2651,8 @@ struct bt_bap *bt_bap_new(struct gatt_db *ldb, struct gatt_db *rdb)
> > >         if (!ldb)
> > >                 return NULL;
> > >
> > > -       bdb = bap_get_db(ldb);
> > > -       if (!bdb)
> > > -               return NULL;
> > > -
> > >         bap = new0(struct bt_bap, 1);
> > > -       bap->ldb = bdb;
> > > +       bap->ldb = ldb;
> > >         bap->reqs = queue_new();
> > >         bap->pending = queue_new();
> > >         bap->notify = queue_new();
> > > diff --git a/src/shared/bap.h b/src/shared/bap.h
> > > index 47a15636c..a4e8549a5 100644
> > > --- a/src/shared/bap.h
> > > +++ b/src/shared/bap.h
> > > @@ -34,6 +34,7 @@
> > >  #define BT_BAP_CONFIG_PHY_CODEC                0x03
> > >
> > >  struct bt_bap;
> > > +struct bt_bap_db;
> > >  struct bt_bap_pac;
> > >  struct bt_bap_stream;
> > >
> > > @@ -98,14 +99,14 @@ struct bt_bap_pac_qos {
> > >         uint32_t ppd_max;
> > >  };
> > >
> > > -struct bt_bap_pac *bt_bap_add_vendor_pac(struct gatt_db *db,
> > > +struct bt_bap_pac *bt_bap_add_vendor_pac(struct bt_bap_db *bdb,
> > >                                         const char *name, uint8_t type,
> > >                                         uint8_t id, uint16_t cid, uint16_t vid,
> > >                                         struct bt_bap_pac_qos *qos,
> > >                                         struct iovec *data,
> > >                                         struct iovec *metadata);
> > >
> > > -struct bt_bap_pac *bt_bap_add_pac(struct gatt_db *db, const char *name,
> > > +struct bt_bap_pac *bt_bap_add_pac(struct bt_bap_db *bdb, const char *name,
> > >                                         uint8_t type, uint8_t id,
> > >                                         struct bt_bap_pac_qos *qos,
> > >                                         struct iovec *data,
> > > @@ -135,7 +136,9 @@ unsigned int bt_bap_register(bt_bap_func_t added, bt_bap_func_t removed,
> > >                                                         void *user_data);
> > >  bool bt_bap_unregister(unsigned int id);
> > >
> > > -struct bt_bap *bt_bap_new(struct gatt_db *ldb, struct gatt_db *rdb);
> > > +struct bt_bap_db *bt_bap_get_local_db(struct gatt_db *db, bool peripheral);
> > > +
> > > +struct bt_bap *bt_bap_new(struct bt_bap_db *ldb, struct gatt_db *rdb);
> > >
> > >  bool bt_bap_set_user_data(struct bt_bap *bap, void *user_data);
> > >
> > > diff --git a/unit/test-bap.c b/unit/test-bap.c
> > > index afeefac84..b677f5197 100644
> > > --- a/unit/test-bap.c
> > > +++ b/unit/test-bap.c
> > > @@ -311,6 +311,7 @@ static void test_client(const void *user_data)
> > >  {
> > >         struct test_data *data = (void *)user_data;
> > >         struct io *io;
> > > +       struct bt_bap_db *ldb;
> > >         struct gatt_db *db;
> > >
> > >         io = tester_setup_io(data->iov, data->iovcnt);
> > > @@ -321,7 +322,8 @@ static void test_client(const void *user_data)
> > >         db = gatt_db_new();
> > >         g_assert(db);
> > >
> > > -       data->bap = bt_bap_new(db, bt_gatt_client_get_db(data->client));
> > > +       ldb = bt_bap_get_local_db(db, true);
> > > +       data->bap = bt_bap_new(ldb, bt_gatt_client_get_db(data->client));
> > >         g_assert(data->bap);
> > >
> > >         bt_bap_set_debug(data->bap, print_debug, "bt_bap:", NULL);
> > > --
> > > 2.39.1
> > >
> >
> >
>
> --
> Pauli Virtanen



-- 
Luiz Augusto von Dentz

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

* Re: [PATCH BlueZ 8/8] bap: handle adapters that are not CIS Central / Peripheral capable
  2023-01-30 18:37   ` [PATCH BlueZ 8/8] bap: handle adapters that are not CIS Central / Peripheral capable Pauli Virtanen
@ 2023-02-07  1:27     ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 43+ messages in thread
From: Luiz Augusto von Dentz @ 2023-02-07  1:27 UTC (permalink / raw)
  To: Pauli Virtanen; +Cc: linux-bluetooth

Hi Pauli,

On Mon, Jan 30, 2023 at 11:06 AM Pauli Virtanen <pav@iki.fi> wrote:
>
> When BT adapter is not CIS Peripheral capable, use the shared/bap code
> in its central-only mode, and don't register anything in the local GATT
> database.
>
> When BT adapter is not CIS Central capable, ignore the remote device
> GATT database, so that we work purely in peripheral mode.
>
> If BT adapter supports neither feature, don't do anything with BAP.
> ---
>  profiles/audio/bap.c   | 18 ++++++++++++++++--
>  profiles/audio/media.c | 11 ++++++-----
>  2 files changed, 22 insertions(+), 7 deletions(-)
>
> diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
> index e5ffb7230..28c0d139a 100644
> --- a/profiles/audio/bap.c
> +++ b/profiles/audio/bap.c
> @@ -1254,6 +1254,8 @@ static int bap_probe(struct btd_service *service)
>         struct btd_adapter *adapter = device_get_adapter(device);
>         struct btd_gatt_database *database = btd_adapter_get_database(adapter);
>         struct bap_data *data = btd_service_get_user_data(service);
> +       struct bt_bap_db *ldb;
> +       struct gatt_db *device_db;
>         char addr[18];
>
>         ba2str(device_get_address(device), addr);
> @@ -1264,17 +1266,29 @@ static int bap_probe(struct btd_service *service)
>                 return -ENOTSUP;
>         }
>
> +       if (!btd_adapter_cis_central_capable(adapter) &&
> +           !btd_adapter_cis_peripheral_capable(adapter)) {
> +               DBG("BAP requires CIS features, unsupported by adapter");
> +               return -ENOTSUP;
> +       }
> +
>         /* Ignore, if we were probed for this device already */
>         if (data) {
>                 error("Profile probed twice for the same device!");
>                 return -EINVAL;
>         }
>
> +       if (btd_adapter_cis_central_capable(adapter))
> +               device_db = btd_device_get_gatt_db(device);
> +       else
> +               device_db = NULL;
> +
>         data = bap_data_new(device);
>         data->service = service;
>
> -       data->bap = bt_bap_new(btd_gatt_database_get_db(database),
> -                                       btd_device_get_gatt_db(device));
> +       ldb = bt_bap_get_local_db(btd_gatt_database_get_db(database),
> +                               btd_adapter_cis_peripheral_capable(adapter));

Don't really like the idea of having an API to access the bt_bap_db,
can we just pass NULL to ldb as before? We can work out internally in
bap.c to handle this properly.

> +       data->bap = bt_bap_new(ldb, device_db);
>         if (!data->bap) {
>                 error("Unable to create BAP instance");
>                 free(data);
> diff --git a/profiles/audio/media.c b/profiles/audio/media.c
> index d68085514..6f83b03b5 100644
> --- a/profiles/audio/media.c
> +++ b/profiles/audio/media.c
> @@ -1105,8 +1105,9 @@ static void bap_debug(const char *str, void *user_data)
>  static bool endpoint_init_pac(struct media_endpoint *endpoint, uint8_t type,
>                                                                 int *err)
>  {
> +       struct btd_adapter *adapter = endpoint->adapter->btd_adapter;
>         struct btd_gatt_database *database;
> -       struct gatt_db *db;
> +       struct bt_bap_db *ldb;
>         struct iovec data;
>         char *name;
>
> @@ -1116,7 +1117,7 @@ static bool endpoint_init_pac(struct media_endpoint *endpoint, uint8_t type,
>                 return false;
>         }
>
> -       database = btd_adapter_get_database(endpoint->adapter->btd_adapter);
> +       database = btd_adapter_get_database(adapter);
>         if (!database) {
>                 error("Adapter database not found");
>                 return false;
> @@ -1128,8 +1129,6 @@ static bool endpoint_init_pac(struct media_endpoint *endpoint, uint8_t type,
>                 return false;
>         }
>
> -       db = btd_gatt_database_get_db(database);
> -
>         data.iov_base = endpoint->capabilities;
>         data.iov_len = endpoint->size;
>
> @@ -1141,7 +1140,9 @@ static bool endpoint_init_pac(struct media_endpoint *endpoint, uint8_t type,
>                 return false;
>         }
>
> -       endpoint->pac = bt_bap_add_pac(db, name, type, endpoint->codec,
> +       ldb = bt_bap_get_local_db(btd_gatt_database_get_db(database),
> +                               btd_adapter_cis_peripheral_capable(adapter));
> +       endpoint->pac = bt_bap_add_pac(ldb, name, type, endpoint->codec,
>                                         &endpoint->qos, &data, NULL);
>         if (!endpoint->pac) {
>                 error("Unable to create PAC");
> --
> 2.39.1
>


-- 
Luiz Augusto von Dentz

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

* Re: [PATCH BlueZ 1/8] doc: add MGMT setting for CIS features, remove Quality Report
  2023-02-07  1:08   ` [PATCH BlueZ 1/8] " Luiz Augusto von Dentz
@ 2023-02-10 20:07     ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 43+ messages in thread
From: Luiz Augusto von Dentz @ 2023-02-10 20:07 UTC (permalink / raw)
  To: Pauli Virtanen; +Cc: linux-bluetooth

Hi Pauli,

On Mon, Feb 6, 2023 at 5:08 PM Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
>
> Hi Pauli,
>
> On Mon, Jan 30, 2023 at 10:43 AM Pauli Virtanen <pav@iki.fi> wrote:
> >
> > Add definitions for new MGMT Controller Information settings bits,
> > indicating adapter Connected Isochronous Stream - Central/Peripheral
> > feature support.
> >
> > The Set Quality Report command was removed in
> > commit 0454e2d09570 ("mgmt: Add support for Mesh in the kernel"),
> > but the settings bit was not removed. It's also not implemented on
> > kernel side, so remove it now.
>
> Let's split this into 2 patches, one removing Quality Report, since it
> was never implemented, and then another including the new flags.

Are you still planning on updating this set?

> > ---
> >
> > Notes:
> >     Was the quality report setting bit reserved on purpose?
> >
> >     From the commit log it looks like it was forgotten to remove from the
> >     docs, but this is not clear.
> >
> >  doc/mgmt-api.txt | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/doc/mgmt-api.txt b/doc/mgmt-api.txt
> > index 90d612ed8..58395dc90 100644
> > --- a/doc/mgmt-api.txt
> > +++ b/doc/mgmt-api.txt
> > @@ -332,7 +332,8 @@ Read Controller Information Command
> >                 15      Static Address
> >                 16      PHY Configuration
> >                 17      Wideband Speech
> > -               18      Quality Report
> > +               18      Connected Isochronous Stream - Central
> > +               19      Connected Isochronous Stream - Peripheral
> >
> >         This command generates a Command Complete event on success or
> >         a Command Status event on failure.
> > @@ -2925,7 +2926,8 @@ Read Extended Controller Information Command
> >                 15      Static Address
> >                 16      PHY Configuration
> >                 17      Wideband Speech
> > -               18      Quality Report
> > +               18      Connected Isochronous Stream - Central
> > +               19      Connected Isochronous Stream - Peripheral
> >
> >         The EIR_Data field contains information about class of device,
> >         local name and other values. Not all of them might be present. For
> > --
> > 2.39.1
> >
>
>
> --
> Luiz Augusto von Dentz



-- 
Luiz Augusto von Dentz

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

* [PATCH BlueZ v2 1/9] doc: remove unimplemented Quality Report from MGMT settings
@ 2023-02-11 10:53 ` Pauli Virtanen
  2023-02-11 10:53   ` [PATCH BlueZ v2 2/9] doc: add MGMT setting for CIS features Pauli Virtanen
                     ` (9 more replies)
  0 siblings, 10 replies; 43+ messages in thread
From: Pauli Virtanen @ 2023-02-11 10:53 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Pauli Virtanen

The Set Quality Report command was removed in
commit 0454e2d09570 ("mgmt: Add support for Mesh in the kernel"),
but the settings bit was not removed. It's also not implemented on
kernel side, so remove it now.
---

Notes:
    v2: split to two commits

 doc/mgmt-api.txt | 2 --
 1 file changed, 2 deletions(-)

diff --git a/doc/mgmt-api.txt b/doc/mgmt-api.txt
index 90d612ed8..0e0b4fdf0 100644
--- a/doc/mgmt-api.txt
+++ b/doc/mgmt-api.txt
@@ -332,7 +332,6 @@ Read Controller Information Command
 		15	Static Address
 		16	PHY Configuration
 		17	Wideband Speech
-		18	Quality Report
 
 	This command generates a Command Complete event on success or
 	a Command Status event on failure.
@@ -2925,7 +2924,6 @@ Read Extended Controller Information Command
 		15	Static Address
 		16	PHY Configuration
 		17	Wideband Speech
-		18	Quality Report
 
 	The EIR_Data field contains information about class of device,
 	local name and other values. Not all of them might be present. For
-- 
2.39.1


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

* [PATCH BlueZ v2 2/9] doc: add MGMT setting for CIS features
  2023-02-11 10:53 ` [PATCH BlueZ v2 1/9] doc: remove unimplemented Quality Report from MGMT settings Pauli Virtanen
@ 2023-02-11 10:53   ` Pauli Virtanen
  2023-02-11 10:53   ` [PATCH BlueZ v2 3/9] lib: Add defines for MGMT setting bits for CIS feature support Pauli Virtanen
                     ` (8 subsequent siblings)
  9 siblings, 0 replies; 43+ messages in thread
From: Pauli Virtanen @ 2023-02-11 10:53 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Pauli Virtanen

Add definitions for new MGMT Controller Information settings bits,
indicating adapter Connected Isochronous Stream - Central/Peripheral
feature support.
---

Notes:
    v2: split to two commits

 doc/mgmt-api.txt | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/doc/mgmt-api.txt b/doc/mgmt-api.txt
index 0e0b4fdf0..58395dc90 100644
--- a/doc/mgmt-api.txt
+++ b/doc/mgmt-api.txt
@@ -332,6 +332,8 @@ Read Controller Information Command
 		15	Static Address
 		16	PHY Configuration
 		17	Wideband Speech
+		18	Connected Isochronous Stream - Central
+		19	Connected Isochronous Stream - Peripheral
 
 	This command generates a Command Complete event on success or
 	a Command Status event on failure.
@@ -2924,6 +2926,8 @@ Read Extended Controller Information Command
 		15	Static Address
 		16	PHY Configuration
 		17	Wideband Speech
+		18	Connected Isochronous Stream - Central
+		19	Connected Isochronous Stream - Peripheral
 
 	The EIR_Data field contains information about class of device,
 	local name and other values. Not all of them might be present. For
-- 
2.39.1


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

* [PATCH BlueZ v2 3/9] lib: Add defines for MGMT setting bits for CIS feature support
  2023-02-11 10:53 ` [PATCH BlueZ v2 1/9] doc: remove unimplemented Quality Report from MGMT settings Pauli Virtanen
  2023-02-11 10:53   ` [PATCH BlueZ v2 2/9] doc: add MGMT setting for CIS features Pauli Virtanen
@ 2023-02-11 10:53   ` Pauli Virtanen
  2023-02-11 10:53   ` [PATCH BlueZ v2 4/9] monitor: add MGMT setting bit names " Pauli Virtanen
                     ` (7 subsequent siblings)
  9 siblings, 0 replies; 43+ messages in thread
From: Pauli Virtanen @ 2023-02-11 10:53 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Pauli Virtanen

---

Notes:
    v2: no changes
    
    The kernel mgmt.h doesn't use BIT(n) macro here, so I didn't change that
    now to keep these defines identical.

 lib/mgmt.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/mgmt.h b/lib/mgmt.h
index 796190cd9..efbdfb4b1 100644
--- a/lib/mgmt.h
+++ b/lib/mgmt.h
@@ -96,6 +96,8 @@ struct mgmt_rp_read_index_list {
 #define MGMT_SETTING_STATIC_ADDRESS	0x00008000
 #define MGMT_SETTING_PHY_CONFIGURATION	0x00010000
 #define MGMT_SETTING_WIDEBAND_SPEECH	0x00020000
+#define MGMT_SETTING_CIS_CENTRAL	0x00040000
+#define MGMT_SETTING_CIS_PERIPHERAL	0x00080000
 
 #define MGMT_OP_READ_INFO		0x0004
 struct mgmt_rp_read_info {
-- 
2.39.1


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

* [PATCH BlueZ v2 4/9] monitor: add MGMT setting bit names for CIS feature support
  2023-02-11 10:53 ` [PATCH BlueZ v2 1/9] doc: remove unimplemented Quality Report from MGMT settings Pauli Virtanen
  2023-02-11 10:53   ` [PATCH BlueZ v2 2/9] doc: add MGMT setting for CIS features Pauli Virtanen
  2023-02-11 10:53   ` [PATCH BlueZ v2 3/9] lib: Add defines for MGMT setting bits for CIS feature support Pauli Virtanen
@ 2023-02-11 10:53   ` Pauli Virtanen
  2023-02-11 10:53   ` [PATCH BlueZ v2 5/9] tools/btmgmt: " Pauli Virtanen
                     ` (6 subsequent siblings)
  9 siblings, 0 replies; 43+ messages in thread
From: Pauli Virtanen @ 2023-02-11 10:53 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Pauli Virtanen

Add names for CIS Central/Peripheral MGMT bits:

@ MGMT Event: Command Complete (0x0001) plen 283  {0x0002} [hci0] 3.745117
      Read Controller Information (0x0004) plen 280
        Status: Success (0x00)
        Address: XX:XX:XX:XX:XX:XX (Intel Corporate)
        Version: Bluetooth 5.3 (0x0c)
        Manufacturer: Intel Corp. (2)
        Supported settings: 0x000ffeff
          Powered
          Connectable
          Fast Connectable
          Discoverable
          Bondable
          Link Security
          Secure Simple Pairing
          BR/EDR
          Low Energy
          Advertising
          Secure Connections
          Debug Keys
          Privacy
          Controller Configuration
          Static Address
          PHY Configuration
          Wideband Speech
          CIS Central
          CIS Peripheral
        Current settings: 0x000c0ad1
          Powered
          Bondable
          Secure Simple Pairing
          BR/EDR
          Low Energy
          Secure Connections
          CIS Central
          CIS Peripheral
        Class: 0x7c0104
          Major class: Computer (desktop, notebook, PDA, organizers)
          Minor class: Desktop workstation
          Rendering (Printing, Speaker)
          Capturing (Scanner, Microphone)
          Object Transfer (v-Inbox, v-Folder)
          Audio (Speaker, Microphone, Headset)
          Telephony (Cordless telephony, Modem, Headset)
        Name: xxx
        Short name:
---

Notes:
    v2: add example output

 monitor/packet.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/monitor/packet.c b/monitor/packet.c
index 44f1941bd..d9e8abf41 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -12649,6 +12649,8 @@ static const struct bitfield_data mgmt_settings_table[] = {
 	{ 15, "Static Address"		},
 	{ 16, "PHY Configuration"	},
 	{ 17, "Wideband Speech"		},
+	{ 18, "CIS Central"		},
+	{ 19, "CIS Peripheral"		},
 	{ }
 };
 
-- 
2.39.1


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

* [PATCH BlueZ v2 5/9] tools/btmgmt: add MGMT setting bit names for CIS feature support
  2023-02-11 10:53 ` [PATCH BlueZ v2 1/9] doc: remove unimplemented Quality Report from MGMT settings Pauli Virtanen
                     ` (2 preceding siblings ...)
  2023-02-11 10:53   ` [PATCH BlueZ v2 4/9] monitor: add MGMT setting bit names " Pauli Virtanen
@ 2023-02-11 10:53   ` Pauli Virtanen
  2023-02-11 10:53   ` [PATCH BlueZ v2 6/9] adapter: add function for checking adapter features, add CIS features Pauli Virtanen
                     ` (5 subsequent siblings)
  9 siblings, 0 replies; 43+ messages in thread
From: Pauli Virtanen @ 2023-02-11 10:53 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Pauli Virtanen

Add names for CIS Central/Peripheral MGMT setting bits:

[mgmt]# info
Index list with 1 item
hci0:	Primary controller
	addr XX:XX:XX:XX:XX:XX version 12 manufacturer 2 class 0x7c0104
	supported settings: powered connectable fast-connectable discoverable bondable link-security ssp br/edr le advertising secure-conn debug-keys privacy configuration static-addr phy-configuration wide-band-speech cis-central cis-peripheral
	current settings: powered bondable ssp br/edr le secure-conn cis-central cis-peripheral
	name xxx
	short name
hci0:	Configuration options
	supported options: public-address
	missing options:
---

Notes:
    v2: add example command output

 tools/btmgmt.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/btmgmt.c b/tools/btmgmt.c
index 29f86091f..323c26712 100644
--- a/tools/btmgmt.c
+++ b/tools/btmgmt.c
@@ -353,6 +353,8 @@ static const char *settings_str[] = {
 				"static-addr",
 				"phy-configuration",
 				"wide-band-speech",
+				"cis-central",
+				"cis-peripheral",
 };
 
 static const char *settings2str(uint32_t settings)
-- 
2.39.1


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

* [PATCH BlueZ v2 6/9] adapter: add function for checking adapter features, add CIS features
  2023-02-11 10:53 ` [PATCH BlueZ v2 1/9] doc: remove unimplemented Quality Report from MGMT settings Pauli Virtanen
                     ` (3 preceding siblings ...)
  2023-02-11 10:53   ` [PATCH BlueZ v2 5/9] tools/btmgmt: " Pauli Virtanen
@ 2023-02-11 10:53   ` Pauli Virtanen
  2023-02-11 10:53   ` [PATCH BlueZ v2 7/9] media: Check adapter CIS support to add BAP in SupportedUUIDs Pauli Virtanen
                     ` (4 subsequent siblings)
  9 siblings, 0 replies; 43+ messages in thread
From: Pauli Virtanen @ 2023-02-11 10:53 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Pauli Virtanen

Add function for checking adapter features, similar to
btd_has_kernel_features. Currently supports the CIS feature bits.
---

Notes:
    v2: use feature flags, not separate functions

 src/adapter.c | 13 +++++++++++++
 src/adapter.h |  7 +++++++
 2 files changed, 20 insertions(+)

diff --git a/src/adapter.c b/src/adapter.c
index aadad4016..4ccacdb8b 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -10712,6 +10712,19 @@ bool btd_le_connect_before_pairing(void)
 	return false;
 }
 
+bool btd_adapter_has_features(struct btd_adapter *adapter, uint32_t features)
+{
+	uint32_t flags = 0;
+
+	if (adapter->current_settings & MGMT_SETTING_CIS_CENTRAL)
+		flags |= ADAPTER_CIS_CENTRAL;
+
+	if (adapter->current_settings & MGMT_SETTING_CIS_PERIPHERAL)
+		flags |= ADAPTER_CIS_PERIPHERAL;
+
+	return (flags & features) ? true : false;
+}
+
 bool btd_has_kernel_features(uint32_t features)
 {
 	return (kernel_features & features) ? true : false;
diff --git a/src/adapter.h b/src/adapter.h
index 78eb069ae..96a8668d5 100644
--- a/src/adapter.h
+++ b/src/adapter.h
@@ -256,6 +256,13 @@ void btd_adapter_for_each_device(struct btd_adapter *adapter,
 
 bool btd_le_connect_before_pairing(void);
 
+enum adapter_features {
+	ADAPTER_CIS_CENTRAL		= 1 << 0,
+	ADAPTER_CIS_PERIPHERAL		= 1 << 1,
+};
+
+bool btd_adapter_has_features(struct btd_adapter *adapter, uint32_t features);
+
 enum experimental_features {
 	EXP_FEAT_DEBUG			= 1 << 0,
 	EXP_FEAT_LE_SIMULT_ROLES	= 1 << 1,
-- 
2.39.1


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

* [PATCH BlueZ v2 7/9] media: Check adapter CIS support to add BAP in SupportedUUIDs
  2023-02-11 10:53 ` [PATCH BlueZ v2 1/9] doc: remove unimplemented Quality Report from MGMT settings Pauli Virtanen
                     ` (4 preceding siblings ...)
  2023-02-11 10:53   ` [PATCH BlueZ v2 6/9] adapter: add function for checking adapter features, add CIS features Pauli Virtanen
@ 2023-02-11 10:53   ` Pauli Virtanen
  2023-02-11 10:53   ` [PATCH BlueZ v2 8/9] shared/bap: support client-only case Pauli Virtanen
                     ` (3 subsequent siblings)
  9 siblings, 0 replies; 43+ messages in thread
From: Pauli Virtanen @ 2023-02-11 10:53 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Pauli Virtanen

Don't indicate BAP support in SupportedUUIDs, if adapter supports
neither CIS Central nor Peripheral.
---

Notes:
    v2: use btd_adapter_has_features

 profiles/audio/media.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/profiles/audio/media.c b/profiles/audio/media.c
index 505c4b3a6..0e0c40dc7 100644
--- a/profiles/audio/media.c
+++ b/profiles/audio/media.c
@@ -1279,6 +1279,10 @@ static bool experimental_endpoint_supported(struct btd_adapter *adapter)
 	if (!btd_adapter_has_exp_feature(adapter, EXP_FEAT_ISO_SOCKET))
 		return false;
 
+	if (!btd_adapter_has_features(adapter, ADAPTER_CIS_CENTRAL) &&
+	    !btd_adapter_has_features(adapter, ADAPTER_CIS_PERIPHERAL))
+		return false;
+
 	return g_dbus_get_flags() & G_DBUS_FLAG_ENABLE_EXPERIMENTAL;
 }
 
-- 
2.39.1


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

* [PATCH BlueZ v2 8/9] shared/bap: support client-only case
  2023-02-11 10:53 ` [PATCH BlueZ v2 1/9] doc: remove unimplemented Quality Report from MGMT settings Pauli Virtanen
                     ` (5 preceding siblings ...)
  2023-02-11 10:53   ` [PATCH BlueZ v2 7/9] media: Check adapter CIS support to add BAP in SupportedUUIDs Pauli Virtanen
@ 2023-02-11 10:53   ` Pauli Virtanen
  2023-02-11 10:53   ` [PATCH BlueZ v2 9/9] bap: handle adapters that are not CIS Central / Peripheral capable Pauli Virtanen
                     ` (2 subsequent siblings)
  9 siblings, 0 replies; 43+ messages in thread
From: Pauli Virtanen @ 2023-02-11 10:53 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Pauli Virtanen

When client-only, skip registering ASCS and PACS in the local GATT DB.

The data structures used to track the local ASE & PAC registrations and
ASE state are then also not needed, and are set to NULL in this case.

In this case, local "endpoints" exist only in the form of locally added
bt_bap_pac PAC data. These usually are in 1-to-1 correspondence with the
Media1 API endpoints registered by media applications.
---

Notes:
    v2:
    * Use named boolean flag for client-only in bt_bap_db instead of just
      NULL field values, maybe makes the intent a bit clearer.
    * Add bt_bap_set_client_only for setting the client-only flag on
      databases, instead of exposing bt_bap_db.
    
    The client-only state cannot be indicated to bt_bap_new by passing in
    ldb==NULL, because the local PACs are in the ldb and we need to know
    which adapter the bt_bap is for.
    
    So instead use a separate function that sets the flag. It cannot make
    already peripheral-enabled DB client-only (currently), but this is not
    needed now, and maybe not in the future either.

 src/shared/bap.c | 42 +++++++++++++++++++++++++++++++++---------
 src/shared/bap.h |  2 ++
 2 files changed, 35 insertions(+), 9 deletions(-)

diff --git a/src/shared/bap.c b/src/shared/bap.c
index 22f2e6714..e85815d8d 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -109,6 +109,7 @@ struct bt_ascs {
 };
 
 struct bt_bap_db {
+	bool client_only;
 	struct gatt_db *db;
 	struct bt_pacs *pacs;
 	struct bt_ascs *ascs;
@@ -620,7 +621,7 @@ static struct bt_bap_endpoint *bap_get_endpoint(struct bt_bap_db *db,
 {
 	struct bt_bap_endpoint *ep;
 
-	if (!db || !attr)
+	if (!db || !attr || db->client_only)
 		return NULL;
 
 	ep = queue_find(db->endpoints, bap_endpoint_match, attr);
@@ -652,7 +653,7 @@ static struct bt_bap_endpoint *bap_get_endpoint_id(struct bt_bap *bap,
 	struct gatt_db_attribute *attr = NULL;
 	size_t i;
 
-	if (!bap || !db)
+	if (!bap || !db || db->client_only)
 		return NULL;
 
 	ep = queue_find(db->endpoints, bap_endpoint_match_id, UINT_TO_PTR(id));
@@ -2170,7 +2171,7 @@ static struct bt_ascs *ascs_new(struct gatt_db *db)
 	return ascs;
 }
 
-static struct bt_bap_db *bap_db_new(struct gatt_db *db)
+static struct bt_bap_db *bap_db_new(struct gatt_db *db, bool client_only)
 {
 	struct bt_bap_db *bdb;
 
@@ -2178,19 +2179,23 @@ static struct bt_bap_db *bap_db_new(struct gatt_db *db)
 		return NULL;
 
 	bdb = new0(struct bt_bap_db, 1);
+	bdb->client_only = client_only;
 	bdb->db = gatt_db_ref(db);
 	bdb->sinks = queue_new();
 	bdb->sources = queue_new();
-	bdb->endpoints = queue_new();
 
 	if (!bap_db)
 		bap_db = queue_new();
 
-	bdb->pacs = pacs_new(db);
-	bdb->pacs->bdb = bdb;
+	if (!client_only) {
+		bdb->endpoints = queue_new();
+
+		bdb->pacs = pacs_new(db);
+		bdb->pacs->bdb = bdb;
 
-	bdb->ascs = ascs_new(db);
-	bdb->ascs->bdb = bdb;
+		bdb->ascs = ascs_new(db);
+		bdb->ascs->bdb = bdb;
+	}
 
 	queue_push_tail(bap_db, bdb);
 
@@ -2205,7 +2210,20 @@ static struct bt_bap_db *bap_get_db(struct gatt_db *db)
 	if (bdb)
 		return bdb;
 
-	return bap_db_new(db);
+	return bap_db_new(db, false);
+}
+
+int bt_bap_set_client_only(struct gatt_db *db)
+{
+	struct bt_bap_db *bdb;
+
+	bdb = queue_find(bap_db, bap_db_match, db);
+	if (bdb)
+		return bdb->client_only ? 0 : -EINVAL;
+
+	bap_db_new(db, true);
+
+	return 0;
 }
 
 static struct bt_pacs *bap_get_pacs(struct bt_bap *bap)
@@ -2328,6 +2346,9 @@ static void bap_add_sink(struct bt_bap_pac *pac)
 
 	queue_push_tail(pac->bdb->sinks, pac);
 
+	if (pac->bdb->client_only)
+		return;
+
 	memset(value, 0, sizeof(value));
 
 	iov.iov_base = value;
@@ -2346,6 +2367,9 @@ static void bap_add_source(struct bt_bap_pac *pac)
 
 	queue_push_tail(pac->bdb->sources, pac);
 
+	if (pac->bdb->client_only)
+		return;
+
 	memset(value, 0, sizeof(value));
 
 	iov.iov_base = value;
diff --git a/src/shared/bap.h b/src/shared/bap.h
index 47a15636c..90d373e35 100644
--- a/src/shared/bap.h
+++ b/src/shared/bap.h
@@ -111,6 +111,8 @@ struct bt_bap_pac *bt_bap_add_pac(struct gatt_db *db, const char *name,
 					struct iovec *data,
 					struct iovec *metadata);
 
+int bt_bap_set_client_only(struct gatt_db *db);
+
 struct bt_bap_pac_ops {
 	int (*select)(struct bt_bap_pac *lpac, struct bt_bap_pac *rpac,
 			struct bt_bap_pac_qos *qos,
-- 
2.39.1


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

* [PATCH BlueZ v2 9/9] bap: handle adapters that are not CIS Central / Peripheral capable
  2023-02-11 10:53 ` [PATCH BlueZ v2 1/9] doc: remove unimplemented Quality Report from MGMT settings Pauli Virtanen
                     ` (6 preceding siblings ...)
  2023-02-11 10:53   ` [PATCH BlueZ v2 8/9] shared/bap: support client-only case Pauli Virtanen
@ 2023-02-11 10:53   ` Pauli Virtanen
  2023-02-11 13:45   ` [BlueZ,v2,1/9] doc: remove unimplemented Quality Report from MGMT settings bluez.test.bot
  2023-02-13 22:20   ` [PATCH BlueZ v2 1/9] " patchwork-bot+bluetooth
  9 siblings, 0 replies; 43+ messages in thread
From: Pauli Virtanen @ 2023-02-11 10:53 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Pauli Virtanen

When BT adapter is not CIS Peripheral capable, set client-only for the
local db, so that ASCS/PACS are not registered.

When BT adapter is not CIS Central capable, ignore the remote device
GATT database, and don't start client sessions.
---

Notes:
    v2:
    * Use bt_bap_set_client_only and btd_adapter_has_features to do the
      stuff.
    * Don't attach client in bap_accept, if adapter doesn't support
      CIS Central.
    
      We still mark the service as connected.  If we want to mark the
      service unavailable in this case, we could return error in
      device_probe. Server connections are handled in bap_attached/detached
      and work also in this case, this should work based on looking at the
      code, and it works in testing.
    
    The patch series was manually tested with two machines running it, with
    Central flag forced to false on one end, and Peripheral flag to false on
    the other, and testing Pipewire being able to play + record audio over
    the BAP link.
    
    Playback + recording on non-BlueZ remote device was also tested with
    Peripheral flag disabled.
    
    bluetoothctl:
    
    Server (CIS Central bit disabled):
    
        [bluetooth]# endpoint.register 00002bc9-0000-1000-8000-00805f9b34fb 0x06
        [/local/endpoint/ep0] Auto Accept (yes/no): yes
        [/local/endpoint/ep0] CIG (auto/value): a
        [/local/endpoint/ep0] CIS (auto/value): a
        Capabilities:
          03 01 ff 00 02 02 03 02 03 03 05 04 1e 00 f0 00  ................
        Endpoint /local/endpoint/ep0 registered
        [bluetooth]# endpoint.register 00002bcb-0000-1000-8000-00805f9b34fb 0x06
        [/local/endpoint/ep1] Auto Accept (yes/no): yes
        [/local/endpoint/ep1] CIG (auto/value): a
        [/local/endpoint/ep1] CIS (auto/value): a
        Capabilities:
          03 01 ff 00 02 02 03 02 03 03 05 04 1e 00 f0 00  ................
        Endpoint /local/endpoint/ep1 registered
        [bluetooth]# show
        Controller XX:XX:XX:XX:XX:XX (public)
    	Name: xxx
    	Alias: xxx
    	Class: 0x00000000
    	Powered: yes
    	PowerState: on
    	Discoverable: no
    	DiscoverableTimeout: 0x000000b4
    	Pairable: no
    	UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
    	UUID: Generic Access Profile    (00001800-0000-1000-8000-00805f9b34fb)
    	UUID: Volume Control            (00001844-0000-1000-8000-00805f9b34fb)
    	UUID: Device Information        (0000180a-0000-1000-8000-00805f9b34fb)
    	UUID: Audio Stream Control      (0000184e-0000-1000-8000-00805f9b34fb)
    	UUID: Published Audio Capabil.. (00001850-0000-1000-8000-00805f9b34fb)
    	Modalias: usb:v1D6Bp0246d0542
    	Discovering: no
    	Roles: central
    	Roles: peripheral
    	ExperimentalFeatures: BlueZ Experimental LL p.. (15c0a148-c273-11ea-b3de-0242ac130004)
    	ExperimentalFeatures: BlueZ Experimental Blue.. (330859bc-7506-492d-9370-9a6f0614037f)
    	ExperimentalFeatures: BlueZ Experimental ISO... (6fbaf188-05e0-496a-9885-d6ddfdb4e03e)
    
    Client (CIS Peripheral bit disabled):
    
        [bluetooth]# endpoint.register 00002bc9-0000-1000-8000-00805f9b34fb 0x06
        [/local/endpoint/ep0] Auto Accept (yes/no): yes
        [/local/endpoint/ep0] CIG (auto/value): a
        [/local/endpoint/ep0] CIS (auto/value): a
        Capabilities:
          03 01 ff 00 02 02 03 02 03 03 05 04 1e 00 f0 00  ................
        Endpoint /local/endpoint/ep0 registered
        [bluetooth]# endpoint.register 00002bcb-0000-1000-8000-00805f9b34fb 0x06
        [/local/endpoint/ep1] Auto Accept (yes/no): yes
        [/local/endpoint/ep1] CIG (auto/value): a
        [/local/endpoint/ep1] CIS (auto/value): a
        Capabilities:
          03 01 ff 00 02 02 03 02 03 03 05 04 1e 00 f0 00  ................
        Endpoint /local/endpoint/ep1 registered
        [bluetooth]# show
        Controller YY:YY:YY:YY:YY:YY (public)
            Name: yyy
            Alias: yyy
            Class: 0x00000000
            Powered: yes
            PowerState: on
            Discoverable: no
            DiscoverableTimeout: 0x000000b4
            Pairable: no
            UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
            UUID: Generic Access Profile    (00001800-0000-1000-8000-00805f9b34fb)
            UUID: Volume Control            (00001844-0000-1000-8000-00805f9b34fb)
            UUID: Device Information        (0000180a-0000-1000-8000-00805f9b34fb)
            Modalias: usb:v1D6Bp0246d0542
            Discovering: no
            Roles: central
            Roles: peripheral
            ExperimentalFeatures: BlueZ Experimental ISO... (6fbaf188-05e0-496a-9885-d6ddfdb4e03e)
    
    The client is client-only, and has no ASCS/PACS.
    
        [bluetooth]# connect XX:XX:XX:XX:XX:XX
        ...
        [server]# transport.list
        Transport /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX/pac_source0/fd12
        Transport /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX/pac_sink0/fd13
        [server]# endpoint.list
        Endpoint /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX/pac_source0
        Endpoint /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX/pac_sink0
        [server]# endpoint.list local
        /local/endpoint/ep0
        /local/endpoint/ep1
        [server]# transport.acquire /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX/pac_source0/fd12
        Acquire successful: fd 7 MTU 40:40
        [CHG] Transport /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX/pac_sink0/fd13 State: active
        [CHG] Transport /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX/pac_source0/fd12 State: active
    
    Server:
    
        Auto Acquiring...
        [CHG] Transport /org/bluez/hci0/dev_YY_YY_YY_YY_YY_YY/fd6 State: pending
        Acquire successful: fd 7 MTU 40:40
        [CHG] Transport /org/bluez/hci0/dev_YY_YY_YY_YY_YY_YY/fd7 State: active
        [CHG] Transport /org/bluez/hci0/dev_YY_YY_YY_YY_YY_YY/fd6 State: active
        [client]# endpoint.list
        [client]# endpoint.list local
        /local/endpoint/ep0
        /local/endpoint/ep1
    
    The server is peripheral-only and has only local endpoints.

 profiles/audio/bap.c   | 26 ++++++++++++++++++++++++--
 profiles/audio/media.c |  6 +++++-
 2 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
index b8c75f195..426aa89aa 100644
--- a/profiles/audio/bap.c
+++ b/profiles/audio/bap.c
@@ -1259,6 +1259,7 @@ static int bap_probe(struct btd_service *service)
 	struct btd_adapter *adapter = device_get_adapter(device);
 	struct btd_gatt_database *database = btd_adapter_get_database(adapter);
 	struct bap_data *data = btd_service_get_user_data(service);
+	struct gatt_db *adapter_db, *device_db;
 	char addr[18];
 
 	ba2str(device_get_address(device), addr);
@@ -1269,17 +1270,32 @@ static int bap_probe(struct btd_service *service)
 		return -ENOTSUP;
 	}
 
+	if (!btd_adapter_has_features(adapter, ADAPTER_CIS_CENTRAL) &&
+	    !btd_adapter_has_features(adapter, ADAPTER_CIS_PERIPHERAL)) {
+		DBG("BAP requires CIS features, unsupported by adapter");
+		return -ENOTSUP;
+	}
+
 	/* Ignore, if we were probed for this device already */
 	if (data) {
 		error("Profile probed twice for the same device!");
 		return -EINVAL;
 	}
 
+	adapter_db = btd_gatt_database_get_db(database);
+
+	if (!btd_adapter_has_features(adapter, ADAPTER_CIS_PERIPHERAL))
+		bt_bap_set_client_only(adapter_db);
+
+	if (btd_adapter_has_features(adapter, ADAPTER_CIS_CENTRAL))
+		device_db = btd_device_get_gatt_db(device);
+	else
+		device_db = NULL;
+
 	data = bap_data_new(device);
 	data->service = service;
 
-	data->bap = bt_bap_new(btd_gatt_database_get_db(database),
-					btd_device_get_gatt_db(device));
+	data->bap = bt_bap_new(adapter_db, device_db);
 	if (!data->bap) {
 		error("Unable to create BAP instance");
 		free(data);
@@ -1303,6 +1319,7 @@ static int bap_probe(struct btd_service *service)
 static int bap_accept(struct btd_service *service)
 {
 	struct btd_device *device = btd_service_get_device(service);
+	struct btd_adapter *adapter = device_get_adapter(device);
 	struct bt_gatt_client *client = btd_device_get_gatt_client(device);
 	struct bap_data *data = btd_service_get_user_data(service);
 	char addr[18];
@@ -1315,6 +1332,11 @@ static int bap_accept(struct btd_service *service)
 		return -EINVAL;
 	}
 
+	if (!btd_adapter_has_features(adapter, ADAPTER_CIS_CENTRAL)) {
+		btd_service_connecting_complete(service, 0);
+		return 0;
+	}
+
 	if (!bt_bap_attach(data->bap, client)) {
 		error("BAP unable to attach");
 		return -EINVAL;
diff --git a/profiles/audio/media.c b/profiles/audio/media.c
index 0e0c40dc7..d9e133007 100644
--- a/profiles/audio/media.c
+++ b/profiles/audio/media.c
@@ -1110,6 +1110,7 @@ static void bap_debug(const char *str, void *user_data)
 static bool endpoint_init_pac(struct media_endpoint *endpoint, uint8_t type,
 								int *err)
 {
+	struct btd_adapter *adapter = endpoint->adapter->btd_adapter;
 	struct btd_gatt_database *database;
 	struct gatt_db *db;
 	struct iovec data;
@@ -1122,7 +1123,7 @@ static bool endpoint_init_pac(struct media_endpoint *endpoint, uint8_t type,
 		return false;
 	}
 
-	database = btd_adapter_get_database(endpoint->adapter->btd_adapter);
+	database = btd_adapter_get_database(adapter);
 	if (!database) {
 		error("Adapter database not found");
 		return false;
@@ -1158,6 +1159,9 @@ static bool endpoint_init_pac(struct media_endpoint *endpoint, uint8_t type,
 		metadata->iov_len = endpoint->metadata_size;
 	}
 
+	if (!btd_adapter_has_features(adapter, ADAPTER_CIS_PERIPHERAL))
+		bt_bap_set_client_only(db);
+
 	endpoint->pac = bt_bap_add_vendor_pac(db, name, type, endpoint->codec,
 				endpoint->cid, endpoint->vid, &endpoint->qos,
 				&data, metadata);
-- 
2.39.1


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

* RE: [BlueZ,v2,1/9] doc: remove unimplemented Quality Report from MGMT settings
  2023-02-11 10:53 ` [PATCH BlueZ v2 1/9] doc: remove unimplemented Quality Report from MGMT settings Pauli Virtanen
                     ` (7 preceding siblings ...)
  2023-02-11 10:53   ` [PATCH BlueZ v2 9/9] bap: handle adapters that are not CIS Central / Peripheral capable Pauli Virtanen
@ 2023-02-11 13:45   ` bluez.test.bot
  2023-02-13 22:20   ` [PATCH BlueZ v2 1/9] " patchwork-bot+bluetooth
  9 siblings, 0 replies; 43+ messages in thread
From: bluez.test.bot @ 2023-02-11 13:45 UTC (permalink / raw)
  To: linux-bluetooth, pav

[-- Attachment #1: Type: text/plain, Size: 11423 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=720945

---Test result---

Test Summary:
CheckPatch                    FAIL      4.60 seconds
GitLint                       FAIL      3.23 seconds
BuildEll                      PASS      26.90 seconds
BluezMake                     PASS      865.81 seconds
MakeCheck                     PASS      11.33 seconds
MakeDistcheck                 PASS      148.69 seconds
CheckValgrind                 PASS      244.11 seconds
CheckSmatch                   WARNING   328.31 seconds
bluezmakeextell               PASS      97.56 seconds
IncrementalBuild              PASS      6443.84 seconds
ScanBuild                     PASS      996.32 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[BlueZ,v2,1/9] doc: remove unimplemented Quality Report from MGMT settings
WARNING:UNKNOWN_COMMIT_ID: Unknown commit id '0454e2d09570', maybe rebased or not pulled?
#48: 
commit 0454e2d09570 ("mgmt: Add support for Mesh in the kernel"),

/github/workspace/src/src/13136997.patch total: 0 errors, 1 warnings, 14 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/src/13136997.patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.


[BlueZ,v2,5/9] tools/btmgmt: add MGMT setting bit names for CIS feature support
WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line)
#56: 
	supported settings: powered connectable fast-connectable discoverable bondable link-security ssp br/edr le advertising secure-conn debug-keys privacy configuration static-addr phy-configuration wide-band-speech cis-central cis-peripheral

/github/workspace/src/src/13137000.patch total: 0 errors, 1 warnings, 8 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/src/13137000.patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.


##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[BlueZ,v2,3/9] lib: Add defines for MGMT setting bits for CIS feature support

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
7: B2 Line has trailing whitespace: "    "
[BlueZ,v2,5/9] tools/btmgmt: add MGMT setting bit names for CIS feature support

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
7: B3 Line contains hard tab characters (\t): "hci0:	Primary controller"
8: B3 Line contains hard tab characters (\t): "	addr XX:XX:XX:XX:XX:XX version 12 manufacturer 2 class 0x7c0104"
9: B1 Line exceeds max length (238>80): "	supported settings: powered connectable fast-connectable discoverable bondable link-security ssp br/edr le advertising secure-conn debug-keys privacy configuration static-addr phy-configuration wide-band-speech cis-central cis-peripheral"
9: B3 Line contains hard tab characters (\t): "	supported settings: powered connectable fast-connectable discoverable bondable link-security ssp br/edr le advertising secure-conn debug-keys privacy configuration static-addr phy-configuration wide-band-speech cis-central cis-peripheral"
10: B1 Line exceeds max length (88>80): "	current settings: powered bondable ssp br/edr le secure-conn cis-central cis-peripheral"
10: B3 Line contains hard tab characters (\t): "	current settings: powered bondable ssp br/edr le secure-conn cis-central cis-peripheral"
11: B3 Line contains hard tab characters (\t): "	name xxx"
12: B3 Line contains hard tab characters (\t): "	short name"
13: B3 Line contains hard tab characters (\t): "hci0:	Configuration options"
14: B3 Line contains hard tab characters (\t): "	supported options: public-address"
15: B3 Line contains hard tab characters (\t): "	missing options:"
[BlueZ,v2,6/9] adapter: add function for checking adapter features, add CIS features

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
1: T1 Title exceeds max length (84>80): "[BlueZ,v2,6/9] adapter: add function for checking adapter features, add CIS features"
[BlueZ,v2,8/9] shared/bap: support client-only case

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
19: B2 Line has trailing whitespace: "    "
23: B2 Line has trailing whitespace: "    "
[BlueZ,v2,9/9] bap: handle adapters that are not CIS Central / Peripheral capable

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
1: T1 Title exceeds max length (81>80): "[BlueZ,v2,9/9] bap: handle adapters that are not CIS Central / Peripheral capable"
16: B2 Line has trailing whitespace: "    "
22: B2 Line has trailing whitespace: "    "
27: B2 Line has trailing whitespace: "    "
30: B2 Line has trailing whitespace: "    "
32: B2 Line has trailing whitespace: "    "
34: B2 Line has trailing whitespace: "    "
51: B3 Line contains hard tab characters (\t): "    	Name: xxx"
52: B3 Line contains hard tab characters (\t): "    	Alias: xxx"
53: B3 Line contains hard tab characters (\t): "    	Class: 0x00000000"
54: B3 Line contains hard tab characters (\t): "    	Powered: yes"
55: B3 Line contains hard tab characters (\t): "    	PowerState: on"
56: B3 Line contains hard tab characters (\t): "    	Discoverable: no"
57: B3 Line contains hard tab characters (\t): "    	DiscoverableTimeout: 0x000000b4"
58: B3 Line contains hard tab characters (\t): "    	Pairable: no"
59: B3 Line contains hard tab characters (\t): "    	UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)"
60: B3 Line contains hard tab characters (\t): "    	UUID: Generic Access Profile    (00001800-0000-1000-8000-00805f9b34fb)"
61: B3 Line contains hard tab characters (\t): "    	UUID: Volume Control            (00001844-0000-1000-8000-00805f9b34fb)"
62: B3 Line contains hard tab characters (\t): "    	UUID: Device Information        (0000180a-0000-1000-8000-00805f9b34fb)"
63: B3 Line contains hard tab characters (\t): "    	UUID: Audio Stream Control      (0000184e-0000-1000-8000-00805f9b34fb)"
64: B3 Line contains hard tab characters (\t): "    	UUID: Published Audio Capabil.. (00001850-0000-1000-8000-00805f9b34fb)"
65: B3 Line contains hard tab characters (\t): "    	Modalias: usb:v1D6Bp0246d0542"
66: B3 Line contains hard tab characters (\t): "    	Discovering: no"
67: B3 Line contains hard tab characters (\t): "    	Roles: central"
68: B3 Line contains hard tab characters (\t): "    	Roles: peripheral"
69: B1 Line exceeds max length (91>80): "    	ExperimentalFeatures: BlueZ Experimental LL p.. (15c0a148-c273-11ea-b3de-0242ac130004)"
69: B3 Line contains hard tab characters (\t): "    	ExperimentalFeatures: BlueZ Experimental LL p.. (15c0a148-c273-11ea-b3de-0242ac130004)"
70: B1 Line exceeds max length (91>80): "    	ExperimentalFeatures: BlueZ Experimental Blue.. (330859bc-7506-492d-9370-9a6f0614037f)"
70: B3 Line contains hard tab characters (\t): "    	ExperimentalFeatures: BlueZ Experimental Blue.. (330859bc-7506-492d-9370-9a6f0614037f)"
71: B1 Line exceeds max length (91>80): "    	ExperimentalFeatures: BlueZ Experimental ISO... (6fbaf188-05e0-496a-9885-d6ddfdb4e03e)"
71: B3 Line contains hard tab characters (\t): "    	ExperimentalFeatures: BlueZ Experimental ISO... (6fbaf188-05e0-496a-9885-d6ddfdb4e03e)"
72: B2 Line has trailing whitespace: "    "
74: B2 Line has trailing whitespace: "    "
99: B1 Line exceeds max length (82>80): "            UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)"
100: B1 Line exceeds max length (82>80): "            UUID: Generic Access Profile    (00001800-0000-1000-8000-00805f9b34fb)"
101: B1 Line exceeds max length (82>80): "            UUID: Volume Control            (00001844-0000-1000-8000-00805f9b34fb)"
102: B1 Line exceeds max length (82>80): "            UUID: Device Information        (0000180a-0000-1000-8000-00805f9b34fb)"
107: B1 Line exceeds max length (98>80): "            ExperimentalFeatures: BlueZ Experimental ISO... (6fbaf188-05e0-496a-9885-d6ddfdb4e03e)"
108: B2 Line has trailing whitespace: "    "
110: B2 Line has trailing whitespace: "    "
122: B1 Line exceeds max length (90>80): "        [server]# transport.acquire /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX/pac_source0/fd12"
124: B1 Line exceeds max length (90>80): "        [CHG] Transport /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX/pac_sink0/fd13 State: active"
125: B1 Line exceeds max length (92>80): "        [CHG] Transport /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX/pac_source0/fd12 State: active"
126: B2 Line has trailing whitespace: "    "
128: B2 Line has trailing whitespace: "    "
138: B2 Line has trailing whitespace: "    "
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
monitor/packet.c: note: in included file:monitor/display.h:82:26: warning: Variable length array is used.monitor/packet.c:1799:26: warning: Variable length array is used.monitor/packet.c: note: in included file:monitor/bt.h:3551:52: warning: array of flexible structuresmonitor/bt.h:3539:40: warning: array of flexible structures


---
Regards,
Linux Bluetooth


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

* Re: [PATCH BlueZ v2 1/9] doc: remove unimplemented Quality Report from MGMT settings
  2023-02-11 10:53 ` [PATCH BlueZ v2 1/9] doc: remove unimplemented Quality Report from MGMT settings Pauli Virtanen
                     ` (8 preceding siblings ...)
  2023-02-11 13:45   ` [BlueZ,v2,1/9] doc: remove unimplemented Quality Report from MGMT settings bluez.test.bot
@ 2023-02-13 22:20   ` patchwork-bot+bluetooth
  2023-02-13 22:30     ` Luiz Augusto von Dentz
  9 siblings, 1 reply; 43+ messages in thread
From: patchwork-bot+bluetooth @ 2023-02-13 22:20 UTC (permalink / raw)
  To: Pauli Virtanen; +Cc: linux-bluetooth

Hello:

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

On Sat, 11 Feb 2023 10:53:45 +0000 you wrote:
> The Set Quality Report command was removed in
> commit 0454e2d09570 ("mgmt: Add support for Mesh in the kernel"),
> but the settings bit was not removed. It's also not implemented on
> kernel side, so remove it now.
> ---
> 
> Notes:
>     v2: split to two commits
> 
> [...]

Here is the summary with links:
  - [BlueZ,v2,1/9] doc: remove unimplemented Quality Report from MGMT settings
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=3e2e3aa73904
  - [BlueZ,v2,2/9] doc: add MGMT setting for CIS features
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=97ad0ecbfdd4
  - [BlueZ,v2,3/9] lib: Add defines for MGMT setting bits for CIS feature support
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=c35d32b19989
  - [BlueZ,v2,4/9] monitor: add MGMT setting bit names for CIS feature support
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=0f2f7a8fe270
  - [BlueZ,v2,5/9] tools/btmgmt: add MGMT setting bit names for CIS feature support
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=6f131929b832
  - [BlueZ,v2,6/9] adapter: add function for checking adapter features, add CIS features
    (no matching commit)
  - [BlueZ,v2,7/9] media: Check adapter CIS support to add BAP in SupportedUUIDs
    (no matching commit)
  - [BlueZ,v2,8/9] shared/bap: support client-only case
    (no matching commit)
  - [BlueZ,v2,9/9] bap: handle adapters that are not CIS Central / Peripheral capable
    (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] 43+ messages in thread

* Re: [PATCH BlueZ 1/8] doc: add MGMT setting for CIS features, remove Quality Report
  2023-01-30 18:37 ` [PATCH BlueZ 1/8] doc: add MGMT setting for CIS features, remove Quality Report Pauli Virtanen
                     ` (8 preceding siblings ...)
  2023-02-07  1:08   ` [PATCH BlueZ 1/8] " Luiz Augusto von Dentz
@ 2023-02-13 22:20   ` patchwork-bot+bluetooth
  9 siblings, 0 replies; 43+ messages in thread
From: patchwork-bot+bluetooth @ 2023-02-13 22:20 UTC (permalink / raw)
  To: Pauli Virtanen; +Cc: linux-bluetooth

Hello:

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

On Mon, 30 Jan 2023 20:37:32 +0200 you wrote:
> Add definitions for new MGMT Controller Information settings bits,
> indicating adapter Connected Isochronous Stream - Central/Peripheral
> feature support.
> 
> The Set Quality Report command was removed in
> commit 0454e2d09570 ("mgmt: Add support for Mesh in the kernel"),
> but the settings bit was not removed. It's also not implemented on
> kernel side, so remove it now.
> 
> [...]

Here is the summary with links:
  - [BlueZ,1/8] doc: add MGMT setting for CIS features, remove Quality Report
    (no matching commit)
  - [BlueZ,2/8] lib: Add defines for MGMT setting bits for CIS feature support
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=c35d32b19989
  - [BlueZ,3/8] monitor: add names for MGMT setting bits for CIS feature support
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=0f2f7a8fe270
  - [BlueZ,4/8] tools/btmgmt: add names for MGMT setting bits for CIS feature support
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=6f131929b832
  - [BlueZ,5/8] adapter: add functions indicating adapter CIS capability
    (no matching commit)
  - [BlueZ,6/8] media: Check adapter CIS support to add BAP in SupportedUUIDs
    (no matching commit)
  - [BlueZ,7/8] shared/bap: handle central-only case
    (no matching commit)
  - [BlueZ,8/8] bap: handle adapters that are not CIS Central / Peripheral capable
    (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] 43+ messages in thread

* Re: [PATCH BlueZ v2 1/9] doc: remove unimplemented Quality Report from MGMT settings
  2023-02-13 22:20   ` [PATCH BlueZ v2 1/9] " patchwork-bot+bluetooth
@ 2023-02-13 22:30     ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 43+ messages in thread
From: Luiz Augusto von Dentz @ 2023-02-13 22:30 UTC (permalink / raw)
  To: patchwork-bot+bluetooth; +Cc: Pauli Virtanen, linux-bluetooth

Hi Pauli,

On Mon, Feb 13, 2023 at 2:21 PM <patchwork-bot+bluetooth@kernel.org> wrote:
>
> Hello:
>
> This series was applied to bluetooth/bluez.git (master)
> by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
>
> On Sat, 11 Feb 2023 10:53:45 +0000 you wrote:
> > The Set Quality Report command was removed in
> > commit 0454e2d09570 ("mgmt: Add support for Mesh in the kernel"),
> > but the settings bit was not removed. It's also not implemented on
> > kernel side, so remove it now.
> > ---
> >
> > Notes:
> >     v2: split to two commits
> >
> > [...]
>
> Here is the summary with links:
>   - [BlueZ,v2,1/9] doc: remove unimplemented Quality Report from MGMT settings
>     https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=3e2e3aa73904
>   - [BlueZ,v2,2/9] doc: add MGMT setting for CIS features
>     https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=97ad0ecbfdd4
>   - [BlueZ,v2,3/9] lib: Add defines for MGMT setting bits for CIS feature support
>     https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=c35d32b19989
>   - [BlueZ,v2,4/9] monitor: add MGMT setting bit names for CIS feature support
>     https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=0f2f7a8fe270
>   - [BlueZ,v2,5/9] tools/btmgmt: add MGMT setting bit names for CIS feature support
>     https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=6f131929b832
>   - [BlueZ,v2,6/9] adapter: add function for checking adapter features, add CIS features
>     (no matching commit)
>   - [BlueZ,v2,7/9] media: Check adapter CIS support to add BAP in SupportedUUIDs
>     (no matching commit)
>   - [BlueZ,v2,8/9] shared/bap: support client-only case
>     (no matching commit)
>   - [BlueZ,v2,9/9] bap: handle adapters that are not CIS Central / Peripheral capable
>     (no matching commit)
>
> You are awesome, thank you!

Note that I did change some of the commits, for instance I went with
btd_adapter_has_settings so we can use the MGMT defines directly,
instead of creating a new enum.

-- 
Luiz Augusto von Dentz

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

end of thread, other threads:[~2023-02-13 22:31 UTC | newest]

Thread overview: 43+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-27 20:52 [RFC, BlueZ] bap: check adapter support before enabling BAP Pauli Virtanen
2023-01-27 21:12 ` [RFC,BlueZ] " bluez.test.bot
2023-01-28  0:28 ` [RFC, BlueZ] " Luiz Augusto von Dentz
2023-01-28  0:29   ` Luiz Augusto von Dentz
2023-01-28  9:26   ` Pauli Virtanen
2023-01-30 18:37 ` [PATCH BlueZ 1/8] doc: add MGMT setting for CIS features, remove Quality Report Pauli Virtanen
2023-01-30 18:37   ` [PATCH BlueZ 2/8] lib: Add defines for MGMT setting bits for CIS feature support Pauli Virtanen
2023-02-07  1:13     ` Luiz Augusto von Dentz
2023-01-30 18:37   ` [PATCH BlueZ 3/8] monitor: add names " Pauli Virtanen
2023-02-07  1:12     ` Luiz Augusto von Dentz
2023-01-30 18:37   ` [PATCH BlueZ 4/8] tools/btmgmt: " Pauli Virtanen
2023-02-07  1:14     ` Luiz Augusto von Dentz
2023-01-30 18:37   ` [PATCH BlueZ 5/8] adapter: add functions indicating adapter CIS capability Pauli Virtanen
2023-02-07  1:10     ` Luiz Augusto von Dentz
2023-01-30 18:37   ` [PATCH BlueZ 6/8] media: Check adapter CIS support to add BAP in SupportedUUIDs Pauli Virtanen
2023-01-30 18:37   ` [PATCH BlueZ 7/8] shared/bap: handle central-only case Pauli Virtanen
2023-01-30 19:39     ` Luiz Augusto von Dentz
2023-01-30 20:04       ` Pauli Virtanen
2023-02-07  1:19         ` Luiz Augusto von Dentz
2023-01-30 18:37   ` [PATCH BlueZ 8/8] bap: handle adapters that are not CIS Central / Peripheral capable Pauli Virtanen
2023-02-07  1:27     ` Luiz Augusto von Dentz
2023-01-30 20:13   ` [BlueZ,1/8] doc: add MGMT setting for CIS features, remove Quality Report bluez.test.bot
2023-02-07  1:08   ` [PATCH BlueZ 1/8] " Luiz Augusto von Dentz
2023-02-10 20:07     ` Luiz Augusto von Dentz
2023-02-13 22:20   ` patchwork-bot+bluetooth
2023-02-01 18:41 ` [PATCH BlueZ] media: set default value for BAP endpoint Vendor field Pauli Virtanen
2023-02-01 19:10   ` Luiz Augusto von Dentz
2023-02-01 19:51   ` [PATCH BlueZ v2] " Pauli Virtanen
2023-02-01 21:14     ` [BlueZ,v2] " bluez.test.bot
2023-02-01 21:50     ` [PATCH BlueZ v2] " patchwork-bot+bluetooth
2023-02-01 20:05   ` [BlueZ] " bluez.test.bot
2023-02-11 10:53 ` [PATCH BlueZ v2 1/9] doc: remove unimplemented Quality Report from MGMT settings Pauli Virtanen
2023-02-11 10:53   ` [PATCH BlueZ v2 2/9] doc: add MGMT setting for CIS features Pauli Virtanen
2023-02-11 10:53   ` [PATCH BlueZ v2 3/9] lib: Add defines for MGMT setting bits for CIS feature support Pauli Virtanen
2023-02-11 10:53   ` [PATCH BlueZ v2 4/9] monitor: add MGMT setting bit names " Pauli Virtanen
2023-02-11 10:53   ` [PATCH BlueZ v2 5/9] tools/btmgmt: " Pauli Virtanen
2023-02-11 10:53   ` [PATCH BlueZ v2 6/9] adapter: add function for checking adapter features, add CIS features Pauli Virtanen
2023-02-11 10:53   ` [PATCH BlueZ v2 7/9] media: Check adapter CIS support to add BAP in SupportedUUIDs Pauli Virtanen
2023-02-11 10:53   ` [PATCH BlueZ v2 8/9] shared/bap: support client-only case Pauli Virtanen
2023-02-11 10:53   ` [PATCH BlueZ v2 9/9] bap: handle adapters that are not CIS Central / Peripheral capable Pauli Virtanen
2023-02-11 13:45   ` [BlueZ,v2,1/9] doc: remove unimplemented Quality Report from MGMT settings bluez.test.bot
2023-02-13 22:20   ` [PATCH BlueZ v2 1/9] " patchwork-bot+bluetooth
2023-02-13 22:30     ` Luiz Augusto von Dentz

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.