Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bluetooth: Audio: Fixing discovery and subscription #67629

Merged
merged 3 commits into from
Feb 2, 2024

Conversation

Thalley
Copy link
Collaborator

@Thalley Thalley commented Jan 15, 2024

The way that bt_gatt_subscribe is used by the LE Audio GATT clients were subpar. They were built on the assumption that we are not using bonding. None of the clients really support proper bonding, and thus the subscriptions should not be considered working after a disconnection.

For this BT_GATT_SUBSCRIBE_FLAG_VOLATILE has been used, until we support bonding.

The discovery functions have been modified to better support this as well, except for the broadcast assistant and media control client that have some other fundamental issue with multiple connections.

One BSIM test was disabled as that expected bonding support on the client.
Multiple BSIM tests were updated to verify that we can at least do multiple discovery calls for a single connection, but should be updated to also verify that discovery and other features work after a reconnect, but that is a TODO for now.

fixes #67434

@Thalley Thalley force-pushed the auto_ccc_discover_fix branch 5 times, most recently from 3edc1cd to fb3e299 Compare January 17, 2024 12:26
@Thalley Thalley changed the title Bluetooth: Fix missing return for bt_gatt_subscribe Bluetooth: Audio: Fixing discovery calls Jan 17, 2024
@Thalley Thalley changed the title Bluetooth: Audio: Fixing discovery calls Bluetooth: Audio: Fixing discovery and subscription Jan 17, 2024
@Thalley Thalley force-pushed the auto_ccc_discover_fix branch 8 times, most recently from 02a8197 to 8803061 Compare January 19, 2024 07:30
@Thalley Thalley marked this pull request as ready for review January 19, 2024 08:34
@Thalley Thalley requested a review from cvinayak January 24, 2024 10:43
@Thalley Thalley force-pushed the auto_ccc_discover_fix branch 2 times, most recently from 48a5d1e to 0659d04 Compare January 29, 2024 16:55
fredrikdanebjer
fredrikdanebjer previously approved these changes Feb 1, 2024
@Thalley
Copy link
Collaborator Author

Thalley commented Feb 1, 2024

Rebased so solve merge conflicts

fredrikdanebjer
fredrikdanebjer previously approved these changes Feb 1, 2024
@Thalley
Copy link
Collaborator Author

Thalley commented Feb 1, 2024

Fixed build errors in MICP and Broadcast Assistant after rebase

@Thalley Thalley force-pushed the auto_ccc_discover_fix branch from d97c605 to 9ca10dd Compare February 2, 2024 09:42
kruithofa
kruithofa previously approved these changes Feb 2, 2024
fredrikdanebjer
fredrikdanebjer previously approved these changes Feb 2, 2024
@carlescufi
Copy link
Member

@Thalley please rebase

…ribe

Several places the LE Audio clients called bt_gatt_subscribe without
checking the return value, which could cause some issues in the worst
case, and in the best case, cause some unexpected behavior.

Some implementations had a bit more updating to handle the new
behavior.

Signed-off-by: Emil Gydesen <[email protected]>
The LE Audio implementations do not really support bonding yet,
and removing subs on disconnect is the most effective (and correct)
way of ensuring that we do not subscribe more than once when we
re-discover after reconnection.

The broadcast assistant and the media control client does not
support multiple connections as of this commit, so they needed
special treatment. In the case that we do discovery on multiple
ACL connections, it is important that the existing subscriptions
are removed correctly by calling bt_gatt_unsubscribe.

In order to implement this change properly on some of the clients,
thet had no proper connection references or support
for clearing the data on disconnects, they had to be updated
as well.

The csip_notify.sh test has been disabled, as that expected a
notification in the client, but since this commit removes that
(until bonding is properly supported in the clients), then the
test will fail.

Signed-off-by: Emil Gydesen <[email protected]>
Expand the babblesim tests for LE audio to verify that all the
discovery functions can be called multiple times without error.

HAS is an exception as that has an existing separate check
that disallows discovery multiple times.

Signed-off-by: Emil Gydesen <[email protected]>
@Thalley Thalley dismissed stale reviews from fredrikdanebjer and kruithofa via bb70533 February 2, 2024 12:28
@Thalley Thalley force-pushed the auto_ccc_discover_fix branch from 9ca10dd to bb70533 Compare February 2, 2024 12:28
@Thalley
Copy link
Collaborator Author

Thalley commented Feb 2, 2024

Rebased to solve merge conflicts

@MaureenHelm MaureenHelm merged commit 954f2a0 into zephyrproject-rtos:main Feb 2, 2024
22 checks passed
@Thalley Thalley deleted the auto_ccc_discover_fix branch March 1, 2024 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Disconnection might cause the unexpected behavior on unicast client
6 participants