From 062c1a80cd0cbc1c06fe33d87709d8b4b9e0c274 Mon Sep 17 00:00:00 2001 From: Mathieu Kardous Date: Tue, 10 Jan 2023 10:17:48 -0500 Subject: [PATCH 1/3] Fix factory data provider init --- .../silabs/EFR32/ConfigurationManagerImpl.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/platform/silabs/EFR32/ConfigurationManagerImpl.cpp b/src/platform/silabs/EFR32/ConfigurationManagerImpl.cpp index aad749374aa943..9788d0ac64cb3c 100644 --- a/src/platform/silabs/EFR32/ConfigurationManagerImpl.cpp +++ b/src/platform/silabs/EFR32/ConfigurationManagerImpl.cpp @@ -49,11 +49,9 @@ ConfigurationManagerImpl & ConfigurationManagerImpl::GetDefaultInstance() CHIP_ERROR ConfigurationManagerImpl::Init() { - CHIP_ERROR err; - // Initialize the generic implementation base class. - err = Internal::GenericConfigurationManagerImpl::Init(); - SuccessOrExit(err); + // err = Internal::GenericConfigurationManagerImpl::Init(); + // VerifyOrReturnError(err == CHIP_NO_ERROR, err); // TODO: Initialize the global GroupKeyStore object here (#1626) @@ -63,10 +61,7 @@ CHIP_ERROR ConfigurationManagerImpl::Init() rebootCause = RMU_ResetCauseGet(); RMU_ResetCauseClear(); - err = CHIP_NO_ERROR; - -exit: - return err; + return CHIP_NO_ERROR; } bool ConfigurationManagerImpl::CanFactoryReset() From 0cfd908376dccec9b33a841ff620a4f3bbd3be0a Mon Sep 17 00:00:00 2001 From: Mathieu Kardous Date: Tue, 10 Jan 2023 10:19:39 -0500 Subject: [PATCH 2/3] remove commented code --- src/platform/silabs/EFR32/ConfigurationManagerImpl.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/platform/silabs/EFR32/ConfigurationManagerImpl.cpp b/src/platform/silabs/EFR32/ConfigurationManagerImpl.cpp index 9788d0ac64cb3c..b81b5d588975af 100644 --- a/src/platform/silabs/EFR32/ConfigurationManagerImpl.cpp +++ b/src/platform/silabs/EFR32/ConfigurationManagerImpl.cpp @@ -49,10 +49,6 @@ ConfigurationManagerImpl & ConfigurationManagerImpl::GetDefaultInstance() CHIP_ERROR ConfigurationManagerImpl::Init() { - // Initialize the generic implementation base class. - // err = Internal::GenericConfigurationManagerImpl::Init(); - // VerifyOrReturnError(err == CHIP_NO_ERROR, err); - // TODO: Initialize the global GroupKeyStore object here (#1626) IncreaseBootCount(); From f8559655f146f60db717c93b4449d9b7cd4cfbbe Mon Sep 17 00:00:00 2001 From: Mathieu Kardous Date: Thu, 19 Jan 2023 15:40:01 -0500 Subject: [PATCH 3/3] Add missing function to data provider --- .../silabs/efr32/EFR32DeviceDataProvider.cpp | 19 ++++++++++++++++++- .../silabs/efr32/EFR32DeviceDataProvider.h | 3 +++ src/platform/silabs/SilabsConfig.h | 3 +++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/examples/platform/silabs/efr32/EFR32DeviceDataProvider.cpp b/examples/platform/silabs/efr32/EFR32DeviceDataProvider.cpp index 6e097ffa4db0e2..272af10c9997bd 100644 --- a/examples/platform/silabs/efr32/EFR32DeviceDataProvider.cpp +++ b/examples/platform/silabs/efr32/EFR32DeviceDataProvider.cpp @@ -321,7 +321,24 @@ CHIP_ERROR EFR32DeviceDataProvider::GetManufacturingDate(uint16_t & year, uint8_ ChipLogError(DeviceLayer, "Invalid manufacturing date: %s", dateStr); } return err; - return CHIP_ERROR_NOT_IMPLEMENTED; +} + +CHIP_ERROR EFR32DeviceDataProvider::GetPartNumber(char * buf, size_t bufSize) +{ + size_t partNumberLen = 0; // without counting null-terminator + return SILABSConfig::ReadConfigValueStr(SILABSConfig::kConfigKey_PartNumber, buf, bufSize, partNumberLen); +} + +CHIP_ERROR EFR32DeviceDataProvider::GetProductURL(char * buf, size_t bufSize) +{ + size_t productUrlLen = 0; // without counting null-terminator + return SILABSConfig::ReadConfigValueStr(SILABSConfig::kConfigKey_ProductURL, buf, bufSize, productUrlLen); +} + +CHIP_ERROR EFR32DeviceDataProvider::GetProductLabel(char * buf, size_t bufSize) +{ + size_t productLabelLen = 0; // without counting null-terminator + return SILABSConfig::ReadConfigValueStr(SILABSConfig::KConfigKey_ProductLabel, buf, bufSize, productLabelLen); } EFR32DeviceDataProvider & EFR32DeviceDataProvider::GetDeviceDataProvider() diff --git a/examples/platform/silabs/efr32/EFR32DeviceDataProvider.h b/examples/platform/silabs/efr32/EFR32DeviceDataProvider.h index 99d90496b30d12..2963bf74183107 100644 --- a/examples/platform/silabs/efr32/EFR32DeviceDataProvider.h +++ b/examples/platform/silabs/efr32/EFR32DeviceDataProvider.h @@ -60,6 +60,9 @@ class EFR32DeviceDataProvider : public CommissionableDataProvider, CHIP_ERROR GetSerialNumber(char * buf, size_t bufSize) override; CHIP_ERROR GetManufacturingDate(uint16_t & year, uint8_t & month, uint8_t & day) override; CHIP_ERROR GetHardwareVersion(uint16_t & hardwareVersion) override; + CHIP_ERROR GetPartNumber(char * buf, size_t bufSize) override; + CHIP_ERROR GetProductURL(char * buf, size_t bufSzie) override; + CHIP_ERROR GetProductLabel(char * buf, size_t bufSize) override; }; } // namespace EFR32 diff --git a/src/platform/silabs/SilabsConfig.h b/src/platform/silabs/SilabsConfig.h index d08daf14158a1b..3dfe3ed0b95394 100644 --- a/src/platform/silabs/SilabsConfig.h +++ b/src/platform/silabs/SilabsConfig.h @@ -108,6 +108,9 @@ class SILABSConfig static constexpr Key kConfigKey_VendorName = SILABSConfigKey(kMatterFactory_KeyBase, 0x0D); static constexpr Key kConfigKey_ProductName = SILABSConfigKey(kMatterFactory_KeyBase, 0x0E); static constexpr Key kConfigKey_HardwareVersionString = SILABSConfigKey(kMatterFactory_KeyBase, 0x0F); + static constexpr Key KConfigKey_ProductLabel = SILABSConfigKey(kMatterFactory_KeyBase, 0x10); + static constexpr Key kConfigKey_ProductURL = SILABSConfigKey(kMatterFactory_KeyBase, 0x11); + static constexpr Key kConfigKey_PartNumber = SILABSConfigKey(kMatterFactory_KeyBase, 0x12); static constexpr Key kConfigKey_UniqueId = SILABSConfigKey(kMatterFactory_KeyBase, 0x1F); // Matter Config Keys static constexpr Key kConfigKey_ServiceConfig = SILABSConfigKey(kMatterConfig_KeyBase, 0x01);