Bluetooth: Audio: Rename set_sirk to just sirk
The S in SIRK is for set, so set_sirk was effectively "set set". Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
parent
7a2b2d73ce
commit
6b6107ccd1
23 changed files with 189 additions and 216 deletions
|
@ -49,7 +49,7 @@ struct btp_csip_discovered_ev {
|
|||
#define BTP_CSIP_SIRK_EV 0x81
|
||||
struct btp_csip_sirk_ev {
|
||||
bt_addr_le_t address;
|
||||
uint8_t sirk[BT_CSIP_SET_SIRK_SIZE];
|
||||
uint8_t sirk[BT_CSIP_SIRK_SIZE];
|
||||
} __packed;
|
||||
|
||||
#define BTP_CSIP_LOCK_EV 0x82
|
||||
|
|
|
@ -30,6 +30,6 @@ struct btp_csis_get_member_rsi_rp {
|
|||
} __packed;
|
||||
|
||||
#define BTP_CSIS_ENC_SIRK_TYPE 0x04
|
||||
struct btp_csis_set_sirk_type_cmd {
|
||||
struct btp_csis_sirk_type_cmd {
|
||||
uint8_t encrypted;
|
||||
} __packed;
|
||||
|
|
|
@ -86,11 +86,11 @@ uint8_t tester_init_cas(void)
|
|||
#if defined(CONFIG_BT_CAP_ACCEPTOR) && defined(CONFIG_BT_CAP_ACCEPTOR_SET_MEMBER)
|
||||
struct bt_csip_set_member_register_param register_params = {
|
||||
.set_size = 2,
|
||||
.set_sirk = { 0xB8, 0x03, 0xEA, 0xC6, 0xAF, 0xBB, 0x65, 0xA2,
|
||||
0x5A, 0x41, 0xF1, 0x53, 0x05, 0x68, 0x8E, 0x83 },
|
||||
.sirk = { 0xB8, 0x03, 0xEA, 0xC6, 0xAF, 0xBB, 0x65, 0xA2,
|
||||
0x5A, 0x41, 0xF1, 0x53, 0x05, 0x68, 0x8E, 0x83 },
|
||||
.lockable = true,
|
||||
.rank = 1,
|
||||
.cb = NULL
|
||||
.cb = NULL,
|
||||
};
|
||||
int err = bt_cap_acceptor_register(®ister_params, &csis_svc_inst);
|
||||
#else
|
||||
|
|
|
@ -92,7 +92,7 @@ static void csip_discover_cb(struct bt_conn *conn,
|
|||
{
|
||||
LOG_DBG("");
|
||||
|
||||
uint8_t sirk[BT_CSIP_SET_SIRK_SIZE];
|
||||
uint8_t sirk[BT_CSIP_SIRK_SIZE];
|
||||
size_t sirk_size = ARRAY_SIZE(sirk);
|
||||
uint8_t conn_index;
|
||||
|
||||
|
@ -112,7 +112,7 @@ static void csip_discover_cb(struct bt_conn *conn,
|
|||
|
||||
cur_csis_inst = &member->insts[0];
|
||||
|
||||
memcpy(sirk, cur_csis_inst->info.set_sirk, sizeof(cur_csis_inst->info.set_sirk));
|
||||
memcpy(sirk, cur_csis_inst->info.sirk, sizeof(cur_csis_inst->info.sirk));
|
||||
|
||||
btp_send_csip_sirk_ev(conn, sirk, sirk_size);
|
||||
|
||||
|
@ -126,7 +126,7 @@ static void csip_discover_cb(struct bt_conn *conn,
|
|||
btp_csip_set_members[conn_index] = member;
|
||||
|
||||
csip_inst = bt_csip_set_coordinator_lookup_instance_by_index(conn, conn_index);
|
||||
btp_send_csip_discovered_ev(conn, csip_inst->set_sirk_handle, csip_inst->set_size_handle,
|
||||
btp_send_csip_discovered_ev(conn, csip_inst->sirk_handle, csip_inst->set_size_handle,
|
||||
csip_inst->set_lock_handle, csip_inst->rank_handle, err);
|
||||
}
|
||||
|
||||
|
|
|
@ -63,14 +63,13 @@ static uint8_t csis_get_member_rsi(const void *cmd, uint16_t cmd_len,
|
|||
return BTP_STATUS_VAL(err);
|
||||
}
|
||||
|
||||
static uint8_t csis_set_sirk_type(const void *cmd, uint16_t cmd_len, void *rsp,
|
||||
uint16_t *rsp_len)
|
||||
static uint8_t csis_sirk_type(const void *cmd, uint16_t cmd_len, void *rsp, uint16_t *rsp_len)
|
||||
{
|
||||
const struct btp_csis_set_sirk_type_cmd *cp = cmd;
|
||||
const struct btp_csis_sirk_type_cmd *cp = cmd;
|
||||
|
||||
enc_sirk = cp->encrypted != 0U;
|
||||
|
||||
LOG_DBG("Set SIRK type: %s", enc_sirk ? "encrypted" : "plain text");
|
||||
LOG_DBG("SIRK type: %s", enc_sirk ? "encrypted" : "plain text");
|
||||
|
||||
return BTP_STATUS_SUCCESS;
|
||||
}
|
||||
|
@ -80,22 +79,22 @@ static const struct btp_handler csis_handlers[] = {
|
|||
.opcode = BTP_CSIS_READ_SUPPORTED_COMMANDS,
|
||||
.index = BTP_INDEX_NONE,
|
||||
.expect_len = 0,
|
||||
.func = csis_supported_commands
|
||||
.func = csis_supported_commands,
|
||||
},
|
||||
{
|
||||
.opcode = BTP_CSIS_SET_MEMBER_LOCK,
|
||||
.expect_len = sizeof(struct btp_csis_set_member_lock_cmd),
|
||||
.func = csis_set_member_lock
|
||||
.func = csis_set_member_lock,
|
||||
},
|
||||
{
|
||||
.opcode = BTP_CSIS_GET_MEMBER_RSI,
|
||||
.expect_len = sizeof(struct btp_csis_get_member_rsi_cmd),
|
||||
.func = csis_get_member_rsi
|
||||
.func = csis_get_member_rsi,
|
||||
},
|
||||
{
|
||||
.opcode = BTP_CSIS_ENC_SIRK_TYPE,
|
||||
.expect_len = sizeof(struct btp_csis_set_sirk_type_cmd),
|
||||
.func = csis_set_sirk_type,
|
||||
.expect_len = sizeof(struct btp_csis_sirk_type_cmd),
|
||||
.func = csis_sirk_type,
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -123,8 +122,8 @@ uint8_t tester_init_csis(void)
|
|||
{
|
||||
const struct bt_csip_set_member_register_param register_params = {
|
||||
.set_size = 1,
|
||||
.set_sirk = { 0xB8, 0x03, 0xEA, 0xC6, 0xAF, 0xBB, 0x65, 0xA2,
|
||||
0x5A, 0x41, 0xF1, 0x53, 0x05, 0x68, 0x8E, 0x83 },
|
||||
.sirk = { 0xB8, 0x03, 0xEA, 0xC6, 0xAF, 0xBB, 0x65, 0xA2,
|
||||
0x5A, 0x41, 0xF1, 0x53, 0x05, 0x68, 0x8E, 0x83 },
|
||||
.lockable = true,
|
||||
.rank = 1,
|
||||
.cb = &csis_cb,
|
||||
|
|
|
@ -562,8 +562,8 @@ static void init(void)
|
|||
.rank = 1,
|
||||
.lockable = true,
|
||||
/* Using the CSIP_SET_MEMBER test sample SIRK */
|
||||
.set_sirk = { 0xcd, 0xcc, 0x72, 0xdd, 0x86, 0x8c, 0xcd, 0xce,
|
||||
0x22, 0xfd, 0xa1, 0x21, 0x09, 0x7d, 0x7d, 0x45 },
|
||||
.sirk = { 0xcd, 0xcc, 0x72, 0xdd, 0x86, 0x8c, 0xcd, 0xce,
|
||||
0x22, 0xfd, 0xa1, 0x21, 0x09, 0x7d, 0x7d, 0x45 },
|
||||
};
|
||||
|
||||
int err;
|
||||
|
|
|
@ -169,7 +169,7 @@ static bool is_discovered(const bt_addr_le_t *addr)
|
|||
|
||||
static bool csip_found(struct bt_data *data, void *user_data)
|
||||
{
|
||||
if (bt_csip_set_coordinator_is_set_member(primary_inst->info.set_sirk, data)) {
|
||||
if (bt_csip_set_coordinator_is_set_member(primary_inst->info.sirk, data)) {
|
||||
const bt_addr_le_t *addr = user_data;
|
||||
char addr_str[BT_ADDR_LE_STR_LEN];
|
||||
|
||||
|
|
|
@ -18,8 +18,8 @@ struct bt_csip_set_member_register_param param = {
|
|||
.rank = 1,
|
||||
.lockable = true,
|
||||
/* Using the CSIS test sample SIRK */
|
||||
.set_sirk = { 0xcd, 0xcc, 0x72, 0xdd, 0x86, 0x8c, 0xcd, 0xce,
|
||||
0x22, 0xfd, 0xa1, 0x21, 0x09, 0x7d, 0x7d, 0x45 },
|
||||
.sirk = { 0xcd, 0xcc, 0x72, 0xdd, 0x86, 0x8c, 0xcd, 0xce,
|
||||
0x22, 0xfd, 0xa1, 0x21, 0x09, 0x7d, 0x7d, 0x45 },
|
||||
};
|
||||
|
||||
static void csip_lock_changed_cb(struct bt_conn *conn,
|
||||
|
@ -76,15 +76,15 @@ static void bt_ready(int err)
|
|||
}
|
||||
}
|
||||
|
||||
static void test_set_sirk(void)
|
||||
static void test_sirk(void)
|
||||
{
|
||||
const uint8_t new_set_sirk[] = {0xff, 0xcc, 0x72, 0xdd, 0x86, 0x8c, 0xcd, 0xce,
|
||||
0x22, 0xfd, 0xa1, 0x21, 0x09, 0x7d, 0x7d, 0x45};
|
||||
uint8_t tmp_sirk[BT_CSIP_SET_SIRK_SIZE];
|
||||
const uint8_t new_sirk[] = {0xff, 0xcc, 0x72, 0xdd, 0x86, 0x8c, 0xcd, 0xce,
|
||||
0x22, 0xfd, 0xa1, 0x21, 0x09, 0x7d, 0x7d, 0x45};
|
||||
uint8_t tmp_sirk[BT_CSIP_SIRK_SIZE];
|
||||
int err;
|
||||
|
||||
printk("Setting new SIRK\n");
|
||||
err = bt_csip_set_member_set_sirk(svc_inst, new_set_sirk);
|
||||
err = bt_csip_set_member_sirk(svc_inst, new_sirk);
|
||||
if (err != 0) {
|
||||
FAIL("Failed to set SIRK: %d\n", err);
|
||||
return;
|
||||
|
@ -97,7 +97,7 @@ static void test_set_sirk(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (memcmp(new_set_sirk, tmp_sirk, BT_CSIP_SET_SIRK_SIZE) != 0) {
|
||||
if (memcmp(new_sirk, tmp_sirk, BT_CSIP_SIRK_SIZE) != 0) {
|
||||
FAIL("The SIRK set and the SIRK set were different\n");
|
||||
return;
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ static void test_new_sirk(void)
|
|||
backchannel_sync_send_all();
|
||||
backchannel_sync_wait_all();
|
||||
|
||||
test_set_sirk();
|
||||
test_sirk();
|
||||
|
||||
WAIT_FOR_UNSET_FLAG(flag_connected);
|
||||
|
||||
|
@ -223,8 +223,8 @@ static void test_args(int argc, char *argv[])
|
|||
|
||||
argn++;
|
||||
|
||||
len = hex2bin(argv[argn], strlen(argv[argn]),
|
||||
param.set_sirk, sizeof(param.set_sirk));
|
||||
len = hex2bin(argv[argn], strlen(argv[argn]), param.sirk,
|
||||
sizeof(param.sirk));
|
||||
if (len == 0) {
|
||||
FAIL("Could not parse SIRK");
|
||||
return;
|
||||
|
|
|
@ -362,8 +362,8 @@ static void test_main(void)
|
|||
.rank = csis_rank,
|
||||
.lockable = true,
|
||||
/* Using the CSIP_SET_MEMBER test sample SIRK */
|
||||
.set_sirk = {0xcd, 0xcc, 0x72, 0xdd, 0x86, 0x8c, 0xcd, 0xce, 0x22, 0xfd,
|
||||
0xa1, 0x21, 0x09, 0x7d, 0x7d, 0x45},
|
||||
.sirk = { 0xcd, 0xcc, 0x72, 0xdd, 0x86, 0x8c, 0xcd, 0xce,
|
||||
0x22, 0xfd, 0xa1, 0x21, 0x09, 0x7d, 0x7d, 0x45 },
|
||||
};
|
||||
|
||||
err = bt_cap_acceptor_register(&csip_set_member_param, &csip_set_member);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue