Skip to content

Commit d8ffa46

Browse files
committed
btshell: Ensure ID address is properly read on init
1 parent 33a73ce commit d8ffa46

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

apps/btshell/pkg.yml

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ pkg.deps:
3333
- nimble/host/services/gap
3434
- nimble/host/services/gatt
3535
- nimble/host/store/config
36+
- nimble/host/util
3637
- nimble/transport
3738

3839
pkg.deps.BTSHELL_ANS:

apps/btshell/src/main.c

+6
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#include "host/ble_gatt.h"
4444
#include "host/ble_store.h"
4545
#include "host/ble_sm.h"
46+
#include "host/util/util.h"
4647

4748
/* Mandatory services. */
4849
#include "services/gap/ble_svc_gap.h"
@@ -2105,6 +2106,11 @@ btshell_on_reset(int reason)
21052106
static void
21062107
btshell_on_sync(void)
21072108
{
2109+
/* Make sure we have proper identity address set (public preferred) */
2110+
if (ble_hs_util_ensure_addr(0) != 0) {
2111+
console_printf("Failed to set identity address\n");
2112+
}
2113+
21082114
#if MYNEWT_VAL(BLE_SM_SC)
21092115
int rc;
21102116

0 commit comments

Comments
 (0)