Skip to content

Commit 15cd94d

Browse files
Adam Augustynmbolivar-nordic
authored andcommitted
[nrf fromtree] Bluetooth: Host: Clear random address field in bt_dev in bt_disable()
This commit clears cached random address in bt_dev when calling bt_disable(). This change makes future calls of set_random_address() function possible with previously used address value, after BLE stack re-initialization. Without this change no HCI command was sent, see this condition in set_random_address(): /* Do nothing if we already have the right address */ if (!bt_addr_cmp(addr, &bt_dev.random_addr.a)) { return 0; } Signed-off-by: Adam Augustyn <[email protected]> Signed-off-by: Herman Berget <[email protected]> (cherry picked from commit e82fb9b)
1 parent bda604e commit 15cd94d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

subsys/bluetooth/host/hci_core.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3765,6 +3765,9 @@ int bt_disable(void)
37653765
/* Some functions rely on checking this bitfield */
37663766
memset(bt_dev.supported_commands, 0x00, sizeof(bt_dev.supported_commands));
37673767

3768+
/* If random address was set up - clear it */
3769+
bt_addr_le_copy(&bt_dev.random_addr, BT_ADDR_LE_ANY);
3770+
37683771
/* Abort TX thread */
37693772
k_thread_abort(&tx_thread_data);
37703773

0 commit comments

Comments
 (0)