btshell: Ensure ID address is properly read on init
diff --git a/apps/btshell/pkg.yml b/apps/btshell/pkg.yml
index 9b4f7c7..be6d685 100644
--- a/apps/btshell/pkg.yml
+++ b/apps/btshell/pkg.yml
@@ -33,6 +33,7 @@
- nimble/host/services/gap
- nimble/host/services/gatt
- nimble/host/store/config
+ - nimble/host/util
- nimble/transport
pkg.deps.BTSHELL_ANS:
diff --git a/apps/btshell/src/main.c b/apps/btshell/src/main.c
index b703183..99f0a79 100644
--- a/apps/btshell/src/main.c
+++ b/apps/btshell/src/main.c
@@ -43,6 +43,7 @@
#include "host/ble_gatt.h"
#include "host/ble_store.h"
#include "host/ble_sm.h"
+#include "host/util/util.h"
/* Mandatory services. */
#include "services/gap/ble_svc_gap.h"
@@ -2105,6 +2106,11 @@
static void
btshell_on_sync(void)
{
+ /* Make sure we have proper identity address set (public preferred) */
+ if (ble_hs_util_ensure_addr(0) != 0) {
+ console_printf("Failed to set identity address\n");
+ }
+
#if MYNEWT_VAL(BLE_SM_SC)
int rc;