Skip to content

Commit 9354e06

Browse files
sjanckartben
authored andcommitted
Bluetooth: SMP: Print extra state information on timeout
This gives some extra information on what could be a reason for SMP timeout. Signed-off-by: Szymon Janc <[email protected]>
1 parent 81dc0ec commit 9354e06

File tree

1 file changed

+9
-1
lines changed
  • subsys/bluetooth/host

1 file changed

+9
-1
lines changed

subsys/bluetooth/host/smp.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2020,7 +2020,15 @@ static void smp_timeout(struct k_work *work)
20202020
struct k_work_delayable *dwork = k_work_delayable_from_work(work);
20212021
struct bt_smp *smp = CONTAINER_OF(dwork, struct bt_smp, work);
20222022

2023-
LOG_ERR("SMP Timeout");
2023+
/* if number of flags or supported commands exceed capacity of one
2024+
* atomic variable following error log shall be extended
2025+
*/
2026+
BUILD_ASSERT(ATOMIC_BITMAP_SIZE(SMP_NUM_FLAGS) == 1);
2027+
BUILD_ASSERT(ATOMIC_BITMAP_SIZE(BT_SMP_NUM_CMDS) == 1);
2028+
2029+
LOG_ERR("SMP Timeout (flags:0x%08x allowed_cmds:0x%08x)",
2030+
(unsigned int)atomic_get(&smp->flags[0]),
2031+
(unsigned int)atomic_get(&smp->allowed_cmds[0]));
20242032

20252033
smp_pairing_complete(smp, BT_SMP_ERR_UNSPECIFIED);
20262034

0 commit comments

Comments
 (0)