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

LE Audio: Add support for dynamically setting the CSIP SIRK #67548

Merged
merged 3 commits into from
Feb 26, 2024

Conversation

Thalley
Copy link
Collaborator

@Thalley Thalley commented Jan 12, 2024

Add support for dynamically setting and notifying the SIRK in CSIP.

Fixes #52516

kruithofa
kruithofa previously approved these changes Feb 2, 2024
Copy link
Collaborator

@kruithofa kruithofa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some nitpicks regarding the output for shell commands, which may be fixed in a later PR

subsys/bluetooth/audio/shell/cap_acceptor.c Outdated Show resolved Hide resolved
subsys/bluetooth/audio/shell/cap_acceptor.c Show resolved Hide resolved
kruithofa
kruithofa previously approved these changes Feb 2, 2024
@@ -110,6 +112,13 @@ static void csip_lock_changed_cb(struct bt_csip_set_coordinator_csis_inst *inst,
printk("Inst %p %s\n", inst, locked ? "locked" : "released");
}

static void csip_sirk_changed_cb(struct bt_csip_set_coordinator_csis_inst *inst)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn´t this only checking that we receive sirk_changed once? I.e. we are setting the flag on the first notification?
Correct me if I'm wrong - but if I interpret this right, shouldnt we wait until all connections have sent the notify?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn´t this only checking that we receive sirk_changed once? I.e. we are setting the flag on the first notification?

Correct me if I'm wrong - but if I interpret this right, shouldnt we wait until all connections have sent the notify?

Arguably yes. It doesn't really change the behavior of the test as they are running the same software: If one works, they should all work. If you prefer I can modify this to expect N number of notifications.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer this yes, even if you certainly are technically correct, I think that this would make the test look more logical and easier to interpret as to what should happen.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fredrikdanebjer Mind if we do that in a follow up? I'd rather try to get this into the release now, rather than postponing it due to a test update :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Thalley that is fair enough

fredrikdanebjer
fredrikdanebjer previously approved these changes Feb 2, 2024
@Thalley Thalley dismissed stale reviews from fredrikdanebjer and kruithofa via 2c196eb February 2, 2024 16:10
@Thalley Thalley force-pushed the csis_sirk_notifiable branch from 5a8f97c to 2c196eb Compare February 2, 2024 16:10
pin-zephyr
pin-zephyr previously approved these changes Feb 2, 2024
Copy link
Collaborator

@pin-zephyr pin-zephyr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a couple of minor doc issues and an open question.

Rest looks good and nothing blocking 👍


This command can modify the currently used SIRK. To get the new RSI to advertise on air,
:code:`bt adv-data`` or :code:`bt advertise` must be called again to set the new advertising data.
If :code:`CONFIG_BT_CSIP_SET_MEMBER_NOTIFIABLE`` is enabled, this will also notify connected
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a ` too much.

Suggested change
If :code:`CONFIG_BT_CSIP_SET_MEMBER_NOTIFIABLE`` is enabled, this will also notify connected
If :code:`CONFIG_BT_CSIP_SET_MEMBER_NOTIFIABLE` is enabled, this will also notify connected

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Thalley you have not addressed comments from @pin-zephyr ?


This command can modify the currently used SIRK. To get the new RSI to advertise on air,
:code:`bt adv-data`` or :code:`bt advertise` must be called again to set the new advertising data.
If :code:`CONFIG_BT_CSIP_SET_MEMBER_NOTIFIABLE`` is enabled, this will also notify connected
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one more ` too much.

Comment on lines +303 to +309
static void sirk_changed(struct bt_csip_set_coordinator_csis_inst *inst)
{
struct bt_csip_set_coordinator_cb *listener;

SYS_SLIST_FOR_EACH_CONTAINER(&csip_set_coordinator_cbs, listener, _node) {
if (listener->sirk_changed) {
listener->sirk_changed(inst);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can inst be NULL ?

and if it can, should we check for that before looping each container ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It cannot :) And even if it can, then it would provide NULL to the callback (which isn't documented, but that's because it isn't intentionally possible).

@cvinayak cvinayak added this to the v3.6.0 milestone Feb 3, 2024
}

CHECKIF(sirk == NULL) {
LOG_DBG("NULL svc_inst");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
LOG_DBG("NULL svc_inst");
LOG_DBG("NULL sirk");

}

CHECKIF(sirk == NULL) {
LOG_DBG("NULL svc_inst");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
LOG_DBG("NULL svc_inst");
LOG_DBG("NULL sirk");

* @brief Callback when the SIRK value of a set of a connected device changes.
*
* @param inst The Coordinated Set Identification Service instance that was changed.
* The new SIKR can be accessed via the @p inst.info.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* The new SIKR can be accessed via the @p inst.info.
* The new SIRK can be accessed via the @p inst.info.

kruithofa
kruithofa previously approved these changes Feb 5, 2024
pin-zephyr
pin-zephyr previously approved these changes Feb 5, 2024
Copy link
Collaborator

@pin-zephyr pin-zephyr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM


This command can modify the currently used SIRK. To get the new RSI to advertise on air,
:code:`bt adv-data`` or :code:`bt advertise` must be called again to set the new advertising data.
If :code:`CONFIG_BT_CSIP_SET_MEMBER_NOTIFIABLE`` is enabled, this will also notify connected
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Thalley you have not addressed comments from @pin-zephyr ?

printk("Getting new SIRK\n");
err = bt_csip_set_member_get_sirk(svc_inst, tmp_sirk);
if (err != 0) {
FAIL("Failed to set SIRK: %d\n", err);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not going to stress on typos in test code... (not reviewing further...)

Suggested change
FAIL("Failed to set SIRK: %d\n", err);
FAIL("Failed to get SIRK: %d\n", err);

Add support for dynamically change the SIRK in a CSIS.

Signed-off-by: Emil Gydesen <[email protected]>
The print_sirk function that simply logs the SIRK has been removed,
as the SIRK is now directly accessible to the application via the
get_sirk function.

Signed-off-by: Emil Gydesen <[email protected]>
The CSIP commands had a typo in the prefix of the shell
functions.

Signed-off-by: Emil Gydesen <[email protected]>
@Thalley Thalley dismissed stale reviews from pin-zephyr and kruithofa via 6df4c94 February 5, 2024 12:07
@Thalley Thalley force-pushed the csis_sirk_notifiable branch from 83b2990 to 6df4c94 Compare February 5, 2024 12:07
Copy link
Collaborator

@pin-zephyr pin-zephyr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@aescolar
Copy link
Member

aescolar commented Feb 6, 2024

@Thalley Given that we are past RC1 for 3.6, should this target 3.7? (assuming so I change the milestone, but please correct it if you disagree)

@aescolar aescolar modified the milestones: v3.6.0, v3.7.0 Feb 6, 2024
@Thalley
Copy link
Collaborator Author

Thalley commented Feb 6, 2024

@Thalley Given that we are past RC1 for 3.6, should this target 3.7? (assuming so I change the milestone, but please correct it if you disagree)

3.7 is fine :)

@nashif nashif merged commit 28276ce into zephyrproject-rtos:main Feb 26, 2024
22 checks passed
@Thalley Thalley deleted the csis_sirk_notifiable branch February 26, 2024 08:20
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.

CSIP Set Member: Adding the possibility to change/update SIRK(s) and notify subscribed clients
8 participants