-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Bluetooth: CSIP: Set member: Fix issue with re-registration #89089
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
Conversation
6e09f61
to
c0ceb01
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes the re‐registration issue for CSIS by removing the static counter and instead scanning the service instance array to locate available entries. It also restores the original service definition during unregistration and adds a test to verify that re‐registration works as expected.
- Removed the instance counter in bt_csip_set_member_register and replaced it with an iterative search.
- Restored the original attribute declaration during unregistration.
- Introduced a new test (test_register) to validate repeated register/unregister cycles.
Reviewed Changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
tests/bsim/bluetooth/audio/src/csip_set_member_test.c | Added test_register function to iterate through registration/unregistration scenarios. |
subsys/bluetooth/audio/csip_set_member.c | Updated bt_csip_set_member_register to remove the counter and restore service definitions in bt_csip_set_member_unregister to enable re-registration. |
Files not reviewed (1)
- tests/bsim/bluetooth/audio/test_scripts/csip_register.sh: Language not supported
Comments suppressed due to low confidence (1)
subsys/bluetooth/audio/csip_set_member.c:852
- The flag 'first_register' is never updated after the first registration, which could result in repeated callback registrations. Set 'first_register' to true after the first successful registration to prevent duplicate registrations.
if (!first_register) {
1931b39
to
5ec06c3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes the re-registration issue with CSIS by removing the outdated counter mechanism and restoring the original service definition. It also adds a new test to ensure the fix works as expected.
- Updated test to validate re-registration behavior
- Modified the service registration logic to search for a free service instance slot and restore original attributes on unregistration
Reviewed Changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.
File | Description |
---|---|
tests/bsim/bluetooth/audio/src/csip_set_member_test.c | Added the test_register function to validate correct re-registration handling |
subsys/bluetooth/audio/csip_set_member.c | Revised registration logic, fixed formatting, and restored original service attributes |
Files not reviewed (1)
- tests/bsim/bluetooth/audio/test_scripts/csip_register.sh: Language not supported
5ec06c3
to
a3d69c8
Compare
a3d69c8
to
0683f6c
Compare
.pairing_complete = auth_pairing_complete, | ||
.bond_deleted = csip_bond_deleted | ||
}; | ||
static struct bt_conn_auth_info_cb auth_callbacks = {.pairing_complete = auth_pairing_complete, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really done on purpuse? This is not how we usually format a statically defined callback structure!? Pre-changed looks more consistent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Welp, my editor done goofed and formatted the entire file. Will revert the formatting lines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haha, I was pondering whether I should make a comment on that - it did seem like a lot of formatting without mentioning it :D
The bt_csip_set_member_register kept a counter that was not decreased when bt_csip_set_member_unregister was called. This meant that we could register and unregister CSIS, but we could not re-register once it had been unregistered. This commit fixes this by removing the counter and instead rely on the service instance state, which also requires restoring the original service definition, as well as adding a test that would have failed with the previous version. Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
b736abf
to
efe484c
Compare
|
The bt_csip_set_member_register kept a counter that was not decreased when bt_csip_set_member_unregister was called. This meant that we could register and unregister CSIS, but we could not re-register once it had been unregistered.
This commit fixes this by removing the counter and instead rely on the service instance state, which also requires restoring the original service definition, as well as adding a test that would have failed with the previous version.