2024-01-25 14:29:50

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: [PATCH BlueZ v1 1/3] btdev: Fix not clearing le_pa_sync_handle on reset

From: Luiz Augusto von Dentz <[email protected]>

le_pa_sync_handle needs to be clear on reset otherwise the coce won't
be able to handle Create PA Sync commands.
---
emulator/btdev.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/emulator/btdev.c b/emulator/btdev.c
index 65ad0a40cb43..da94f29d12aa 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -562,6 +562,7 @@ static void btdev_reset(struct btdev *btdev)
btdev->le_scan_enable = 0x00;
btdev->le_adv_enable = 0x00;
btdev->le_pa_enable = 0x00;
+ btdev->le_pa_sync_handle = 0x0000;

al_clear(btdev);
rl_clear(btdev);
--
2.43.0



2024-01-25 14:29:52

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: [PATCH BlueZ v1 2/3] device: Add btd_device_set_connectable

From: Luiz Augusto von Dentz <[email protected]>

In case of devices advertising BCAA, aka. Broadcast Source, it shall be
possible to connect to them using something LE Audio Broadcast
procedures so this introduces btd_device_set_connectable so driver can
inform the core when the device is connectable even when it is
advertising using GAP broadcaster role for example.
---
src/device.c | 5 +++++
src/device.h | 1 +
2 files changed, 6 insertions(+)

diff --git a/src/device.c b/src/device.c
index 17bcfbc499aa..afd073c6c2a5 100644
--- a/src/device.c
+++ b/src/device.c
@@ -4495,6 +4495,11 @@ void device_update_last_seen(struct btd_device *device, uint8_t bdaddr_type,
set_temporary_timer(device, btd_opts.tmpto);
}

+void btd_device_set_connectable(struct btd_device *device, bool connectable)
+{
+ device_update_last_seen(device, device->bdaddr_type, connectable);
+}
+
/* It is possible that we have two device objects for the same device in
* case it has first been discovered over BR/EDR and has a private
* address when discovered over LE for the first time. In such a case we
diff --git a/src/device.h b/src/device.h
index 8bb38669d457..96f41d47971d 100644
--- a/src/device.h
+++ b/src/device.h
@@ -95,6 +95,7 @@ void device_set_paired(struct btd_device *dev, uint8_t bdaddr_type);
void device_set_unpaired(struct btd_device *dev, uint8_t bdaddr_type);
void btd_device_set_temporary(struct btd_device *device, bool temporary);
void btd_device_set_trusted(struct btd_device *device, gboolean trusted);
+void btd_device_set_connectable(struct btd_device *device, bool connectable);
void device_set_bonded(struct btd_device *device, uint8_t bdaddr_type);
void device_set_legacy(struct btd_device *device, bool legacy);
void device_set_rssi_with_delta(struct btd_device *device, int8_t rssi,
--
2.43.0


2024-01-25 14:29:55

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: [PATCH BlueZ v1 3/3] bap: Mark device as connectable if a broadcast Endpoint is found

From: Luiz Augusto von Dentz <[email protected]>

If a broadcast Endpoint is found this uses btd_device_set_connectable to
make it as connectable since the Endpoint can be used to setup a
broadcast stream which requires the device object.
---
profiles/audio/bap.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
index a4036bbbdfa8..864761dfd919 100644
--- a/profiles/audio/bap.c
+++ b/profiles/audio/bap.c
@@ -1378,6 +1378,7 @@ static bool pac_select(struct bt_bap_pac *lpac, struct bt_bap_pac *rpac,
static bool pac_found_bcast(struct bt_bap_pac *lpac, struct bt_bap_pac *rpac,
void *user_data)
{
+ struct bap_data *data = user_data;
struct bap_ep *ep;

DBG("lpac %p rpac %p", lpac, rpac);
@@ -1388,6 +1389,9 @@ static bool pac_found_bcast(struct bt_bap_pac *lpac, struct bt_bap_pac *rpac,
return true;
}

+ /* Mark the device as connetable if an Endpoint is registered */
+ btd_device_set_connectable(data->device, true);
+
return true;
}

@@ -2456,6 +2460,8 @@ static void bap_bcast_remove(struct btd_service *service)
error("BAP service not handled by profile");
return;
}
+
+ bap_data_remove(data);
}

static int bap_probe(struct btd_service *service)
--
2.43.0


2024-01-25 16:00:25

by bluez.test.bot

[permalink] [raw]
Subject: RE: [BlueZ,v1,1/3] btdev: Fix not clearing le_pa_sync_handle on reset

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

---Test result---

Test Summary:
CheckPatch PASS 0.93 seconds
GitLint PASS 0.67 seconds
BuildEll PASS 24.08 seconds
BluezMake PASS 724.48 seconds
MakeCheck PASS 11.50 seconds
MakeDistcheck PASS 160.61 seconds
CheckValgrind PASS 226.22 seconds
CheckSmatch WARNING 334.66 seconds
bluezmakeextell PASS 112.05 seconds
IncrementalBuild PASS 2072.65 seconds
ScanBuild WARNING 943.15 seconds

Details
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
emulator/btdev.c:420:29: warning: Variable length array is used.
##############################
Test: ScanBuild - WARNING
Desc: Run Scan Build
Output:
emulator/btdev.c:1084:10: warning: Although the value stored to 'conn' is used in the enclosing expression, the value is never actually read from 'conn'
while ((conn = queue_find(dev->conns, match_handle,
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
emulator/btdev.c:1335:24: warning: Access to field 'link' results in a dereference of a null pointer (loaded from variable 'conn')
pending_conn_del(dev, conn->link->dev);
^~~~~~~~~~
emulator/btdev.c:1457:13: warning: Access to field 'dev' results in a dereference of a null pointer (loaded from variable 'conn')
send_event(conn->dev, BT_HCI_EVT_AUTH_COMPLETE, &ev, sizeof(ev));
^~~~~~~~~
3 warnings generated.



---
Regards,
Linux Bluetooth

2024-01-25 19:10:39

by patchwork-bot+bluetooth

[permalink] [raw]
Subject: Re: [PATCH BlueZ v1 1/3] btdev: Fix not clearing le_pa_sync_handle on reset

Hello:

This series was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <[email protected]>:

On Thu, 25 Jan 2024 09:29:34 -0500 you wrote:
> From: Luiz Augusto von Dentz <[email protected]>
>
> le_pa_sync_handle needs to be clear on reset otherwise the coce won't
> be able to handle Create PA Sync commands.
> ---
> emulator/btdev.c | 1 +
> 1 file changed, 1 insertion(+)

Here is the summary with links:
- [BlueZ,v1,1/3] btdev: Fix not clearing le_pa_sync_handle on reset
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=460dd92431ea
- [BlueZ,v1,2/3] device: Add btd_device_set_connectable
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=7a1c6f31ed4f
- [BlueZ,v1,3/3] bap: Mark device as connectable if a broadcast Endpoint is found
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=35858e173aad

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