Skip to content

Commit 4bd0c33

Browse files
Thalleykartben
authored andcommitted
Bluetooth: CSIP: Only allow rank changes with set size changes
The rank cannot be notified and the function allowed for just updated to the rank. The CSIS spec does not mention the usecase, nor support, for changing the rank of a device. The spec only seems to allow for dynamic changes to the set size (and only during that can the rank be set). Signed-off-by: Emil Gydesen <[email protected]>
1 parent 3c66b7e commit 4bd0c33

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

include/zephyr/bluetooth/audio/csip.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,8 @@ int bt_csip_set_member_sirk(struct bt_csip_set_member_svc_inst *svc_inst,
236236
* It is important to note that a set cannot have multiple devices with the same rank in a set,
237237
* and it is up to the caller of this function to ensure that.
238238
* Similarly, it is important that the size is updated on all devices in the set at the same time.
239+
* The rank of a device cannot be modified on its own, and a new rank can only be set if the @p size
240+
* is different from the current set size.
239241
*
240242
* If @kconfig{CONFIG_BT_CSIP_SET_MEMBER_SIZE_NOTIFIABLE} is enabled, this will also send a
241243
* notification to all connected or bonded clients.
@@ -246,7 +248,7 @@ int bt_csip_set_member_sirk(struct bt_csip_set_member_svc_inst *svc_inst,
246248
*
247249
* @retval -EINVAL @p svc_inst is NULL, @p size is less than 1, @p rank is less than 1 or higher
248250
* than @p size for a lockable @p svc_inst.
249-
* @retval -EALREADY @p size and @p rank are already the provided values.
251+
* @retval -EALREADY @p size is already set.
250252
* @retval 0 Success.
251253
*/
252254
int bt_csip_set_member_set_size_and_rank(struct bt_csip_set_member_svc_inst *svc_inst, uint8_t size,

subsys/bluetooth/audio/csip_set_member.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,8 +1097,8 @@ int bt_csip_set_member_set_size_and_rank(struct bt_csip_set_member_svc_inst *svc
10971097
return -EINVAL;
10981098
}
10991099

1100-
if (svc_inst->set_size == size && svc_inst->rank == rank) {
1101-
LOG_DBG("Set size %u and rank %u is already set", size, rank);
1100+
if (svc_inst->set_size == size) {
1101+
LOG_DBG("Set size %u is already set", size);
11021102
return -EALREADY;
11031103
}
11041104

0 commit comments

Comments
 (0)