diff mbox series

[BlueZ,v2,1/1] adapter: Allow broadcaster to be passed up to application

Message ID 20230705085131.6643-2-claudia.rosu@nxp.com (mailing list archive)
State Superseded
Headers show
Series adapter: Allow broadcaster to be passed up to application | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/BuildEll success Build ELL PASS
tedd_an/BluezMake success Bluez Make PASS
tedd_an/MakeCheck success Bluez Make Check PASS
tedd_an/MakeDistcheck success Make Distcheck PASS
tedd_an/CheckValgrind success Check Valgrind PASS
tedd_an/CheckSmatch success CheckSparse PASS
tedd_an/bluezmakeextell success Make External ELL PASS
tedd_an/IncrementalBuild success Incremental Build PASS
tedd_an/ScanBuild success Scan Build PASS

Commit Message

Claudia Draghicescu July 5, 2023, 8:51 a.m. UTC
Allow a broadcast advertiser to be passed up to application,
if the scanner is an ISO Sync Receiver capable device.
This allows for a broadcast sink to discover broadcast sources.

---
 src/adapter.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Comments

bluez.test.bot@gmail.com July 5, 2023, 10:14 a.m. UTC | #1
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=762577

---Test result---

Test Summary:
CheckPatch                    PASS      0.43 seconds
GitLint                       PASS      0.29 seconds
BuildEll                      PASS      27.33 seconds
BluezMake                     PASS      856.49 seconds
MakeCheck                     PASS      12.37 seconds
MakeDistcheck                 PASS      153.84 seconds
CheckValgrind                 PASS      253.53 seconds
CheckSmatch                   PASS      338.11 seconds
bluezmakeextell               PASS      102.16 seconds
IncrementalBuild              PASS      697.99 seconds
ScanBuild                     PASS      1043.87 seconds



---
Regards,
Linux Bluetooth
Luiz Augusto von Dentz July 5, 2023, 5:38 p.m. UTC | #2
Hi Claudia,

On Wed, Jul 5, 2023 at 2:02 AM Claudia Draghicescu <claudia.rosu@nxp.com> wrote:
>
> Allow a broadcast advertiser to be passed up to application,
> if the scanner is an ISO Sync Receiver capable device.
> This allows for a broadcast sink to discover broadcast sources.
>
> ---
>  src/adapter.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
>
> diff --git a/src/adapter.c b/src/adapter.c
> index 2679d4302..9c971d488 100644
> --- a/src/adapter.c
> +++ b/src/adapter.c
> @@ -7031,6 +7031,16 @@ static bool is_filter_match(GSList *discovery_filter, struct eir_data *eir_data,
>         return got_match;
>  }
>
> +static bool accept_bcast_adv(struct btd_adapter *adapter,
> +                               struct eir_data *eir_data)
> +{
> +       if ((btd_adapter_has_settings(adapter, MGMT_SETTING_ISO_SYNC_RECEIVER))
> +               && !(eir_data->flags & (EIR_LIM_DISC | EIR_GEN_DISC)))
> +               return true;
> +
> +       return false;
> +}
> +
>  static void filter_duplicate_data(void *data, void *user_data)
>  {
>         struct discovery_client *client = data;
> @@ -7154,12 +7164,18 @@ void btd_adapter_device_found(struct btd_adapter *adapter,
>                         return;
>                 }
>
> +               if (accept_bcast_adv(adapter, &eir_data))
> +                       monitoring = true;
> +
>                 if (!discoverable && !monitoring && !eir_data.rsi) {
>                         eir_data_free(&eir_data);
>                         return;
>                 }

Lets match by advertising UUID since it should contain a broadcast
audio announcement to be considered a broadcaster.

>                 dev = adapter_create_device(adapter, bdaddr, bdaddr_type);
> +
> +               if (accept_bcast_adv(adapter, &eir_data))
> +                       btd_device_set_temporary(dev, false);

I wouldn't persist broadcasters like that, at least not until we
synchronize with it, that said, if it is using a random address it
probably cannot be stored anyway.

>         }
>
>         if (!dev) {
> --
> 2.34.1
>
diff mbox series

Patch

diff --git a/src/adapter.c b/src/adapter.c
index 2679d4302..9c971d488 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -7031,6 +7031,16 @@  static bool is_filter_match(GSList *discovery_filter, struct eir_data *eir_data,
 	return got_match;
 }
 
+static bool accept_bcast_adv(struct btd_adapter *adapter,
+				struct eir_data *eir_data)
+{
+	if ((btd_adapter_has_settings(adapter, MGMT_SETTING_ISO_SYNC_RECEIVER))
+		&& !(eir_data->flags & (EIR_LIM_DISC | EIR_GEN_DISC)))
+		return true;
+
+	return false;
+}
+
 static void filter_duplicate_data(void *data, void *user_data)
 {
 	struct discovery_client *client = data;
@@ -7154,12 +7164,18 @@  void btd_adapter_device_found(struct btd_adapter *adapter,
 			return;
 		}
 
+		if (accept_bcast_adv(adapter, &eir_data))
+			monitoring = true;
+
 		if (!discoverable && !monitoring && !eir_data.rsi) {
 			eir_data_free(&eir_data);
 			return;
 		}
 
 		dev = adapter_create_device(adapter, bdaddr, bdaddr_type);
+
+		if (accept_bcast_adv(adapter, &eir_data))
+			btd_device_set_temporary(dev, false);
 	}
 
 	if (!dev) {