Skip to content

Commit f7bae12

Browse files
spanceackartben
authored andcommitted
bluetooth: smp: Fix build warnings for central with OOB legacy only
Currently, there are build warnings that are triggered when building for BT central and legacy OOB pairing only: CONFIG_BT_SMP_OOB_LEGACY_PAIR_ONLY=y CONFIG_BT_CENTRAL=y There was a PR that handled this issue in the past #74400. Unfortunately, this PR even though it fixed the warnings it also broke the BT peripheral and legacy OOB pairing only build: CONFIG_BT_SMP_OOB_LEGACY_PAIR_ONLY=y CONFIG_BT_PERIPHERAL=y #82552 was merged in order to fix the issue with the peripheral build configuration. Unfortunately, this PR reintroduced the warnings for BT central and legacy OOB pairing. This commit brings changes to make sure that both the BT central and peripheral builds with OOB legacy pairing are buildable and warnings free. Also in this commit, a new build test case is added for the BT central and legacy OOB pairing along the existing BT peripheral test case Signed-off-by: Sebastian Panceac <[email protected]>
1 parent 19155bd commit f7bae12

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

subsys/bluetooth/host/smp.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3654,8 +3654,8 @@ static bool le_sc_oob_data_rsp_check(struct bt_smp *smp)
36543654
return ((rsp->oob_flag & BT_SMP_OOB_DATA_MASK) == BT_SMP_OOB_PRESENT);
36553655
}
36563656

3657-
static void le_sc_oob_config_set(struct bt_smp *smp,
3658-
struct bt_conn_oob_info *info)
3657+
__maybe_unused static void le_sc_oob_config_set(struct bt_smp *smp,
3658+
struct bt_conn_oob_info *info)
36593659
{
36603660
bool req_oob_present = le_sc_oob_data_req_check(smp);
36613661
bool rsp_oob_present = le_sc_oob_data_rsp_check(smp);
@@ -4184,7 +4184,7 @@ static uint8_t smp_security_request(struct bt_smp *smp, struct net_buf *buf)
41844184
}
41854185
#endif /* CONFIG_BT_CENTRAL */
41864186

4187-
static uint8_t generate_dhkey(struct bt_smp *smp)
4187+
__maybe_unused static uint8_t generate_dhkey(struct bt_smp *smp)
41884188
{
41894189
if (IS_ENABLED(CONFIG_BT_SMP_OOB_LEGACY_PAIR_ONLY)) {
41904190
return BT_SMP_ERR_UNSPECIFIED;
@@ -4198,7 +4198,7 @@ static uint8_t generate_dhkey(struct bt_smp *smp)
41984198
return 0;
41994199
}
42004200

4201-
static uint8_t display_passkey(struct bt_smp *smp)
4201+
__maybe_unused static uint8_t display_passkey(struct bt_smp *smp)
42024202
{
42034203
struct bt_conn *conn = smp->chan.chan.conn;
42044204
const struct bt_conn_auth_cb *smp_auth_cb = latch_auth_cb(smp);

tests/bluetooth/host_config_variants/testcase.yaml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
tests:
22
# Test that the Host builds with BT_SMP_OOB_LEGACY_PAIR_ONLY enabled
3-
bluetooth.host_config_variants.config_bt_smp_oob_legacy_pair_only:
3+
# and peripheral role
4+
bluetooth.host_config_variants.config_peripheral_bt_smp_oob_legacy_pair_only:
45
extra_configs:
56
- CONFIG_BT_SMP=y
67
- CONFIG_BT_PERIPHERAL=y
@@ -14,3 +15,20 @@ tests:
1415
tags:
1516
- bluetooth
1617
build_only: true
18+
19+
# Test that the Host builds with BT_SMP_OOB_LEGACY_PAIR_ONLY enabled
20+
# and central role
21+
bluetooth.host_config_variants.config_central_bt_smp_oob_legacy_pair_only:
22+
extra_configs:
23+
- CONFIG_BT_SMP=y
24+
- CONFIG_BT_CENTRAL=y
25+
- CONFIG_BT_SMP_SC_PAIR_ONLY=n
26+
- CONFIG_BT_SMP_OOB_LEGACY_PAIR_ONLY=y
27+
platform_allow:
28+
- native_sim
29+
- native_sim/native/64
30+
integration_platforms:
31+
- native_sim
32+
tags:
33+
- bluetooth
34+
build_only: true

0 commit comments

Comments
 (0)