Skip to content

Commit

Permalink
Bluetooth: Settings: Fix generated identity not persistently stored.
Browse files Browse the repository at this point in the history
Fix an issue where the generated identity was not permanently stored.
This resulted in being unable to reconnect after bonding when using
privacy, since a new local IRK was generated on reboot.

When settings is enabled the application is responsible for loading
identities and possible creating its own identities.
When settings_load is called and no identities has been created or found
in persistent storage a new identity will be created.
Since bt init has not been finalized bt_id_create will not make a call
to bt_settings_save_id. So we need to make sure that this identity will
be stored.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
  • Loading branch information
joerchan authored and carlescufi committed Aug 5, 2019
1 parent 33535a2 commit 2b84c72
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions subsys/bluetooth/host/settings.c
Expand Up @@ -217,6 +217,12 @@ static int commit(void)
} }
} }


/* Make sure that the identities created by bt_id_create after
* bt_enable is saved to persistent storage. */
if (!atomic_test_bit(bt_dev.flags, BT_DEV_PRESET_ID)) {
bt_settings_save_id();
}

if (!atomic_test_bit(bt_dev.flags, BT_DEV_READY)) { if (!atomic_test_bit(bt_dev.flags, BT_DEV_READY)) {
bt_finalize_init(); bt_finalize_init();
} }
Expand Down

0 comments on commit 2b84c72

Please sign in to comment.