Skip to content

Commit 8878020

Browse files
Damian-Nordicrestyled-commits
authored andcommitted
[nrfconnect] Don't erase factory keys on the factory reset (#12253)
* [nrfconnect] Don't erase factory keys on the factory reset The factory reset on nRF Connect platforms erases all settings starting with "mt/". Make sure that factory configuration keys are not descendants of the "mt" subtree, so use "mt-fact" prefix for them. * Restyled by clang-format Co-authored-by: Restyled.io <commits@restyled.io>
1 parent f02172d commit 8878020

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/platform/Zephyr/ZephyrConfig.cpp

+5-6
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,12 @@ namespace Internal {
4141
(key); \
4242
static_assert(sizeof(key) <= SETTINGS_MAX_NAME_LEN, "Config key too long: " key)
4343

44-
// Define the configuration keys to be part of the CHIP_DEVICE_CONFIG_SETTINGS_KEY subtree
45-
// so that they get erased when KeyValueStoreManagerImpl::DoFactoryReset() is called.
46-
// clang-format off
47-
#define NAMESPACE_FACTORY CHIP_DEVICE_CONFIG_SETTINGS_KEY "/fct/"
48-
#define NAMESPACE_CONFIG CHIP_DEVICE_CONFIG_SETTINGS_KEY "/cfg/"
44+
// Define the configuration keys (except the factory keys) to be part of the
45+
// CHIP_DEVICE_CONFIG_SETTINGS_KEY subtree so that they get erased when
46+
// KeyValueStoreManagerImpl::DoFactoryReset() is called.
47+
#define NAMESPACE_FACTORY CHIP_DEVICE_CONFIG_SETTINGS_KEY "-fct/"
48+
#define NAMESPACE_CONFIG CHIP_DEVICE_CONFIG_SETTINGS_KEY "/cfg/"
4949
#define NAMESPACE_COUNTERS CHIP_DEVICE_CONFIG_SETTINGS_KEY "/ctr/"
50-
// clang-format on
5150

5251
// Keys stored in the chip factory nam
5352
const ZephyrConfig::Key ZephyrConfig::kConfigKey_SerialNum = CONFIG_KEY(NAMESPACE_FACTORY "serial-num");

0 commit comments

Comments
 (0)