From 1e11dd676cc77333f4475aadf39877576ba4c387 Mon Sep 17 00:00:00 2001 From: Yufeng Wang Date: Mon, 15 Aug 2022 15:49:03 -0700 Subject: [PATCH] [linux] Set DeviceInfoProvider before Server::Init to setup the storage of DeviceInfoProvider properly. (#21803) --- examples/platform/linux/AppMain.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/platform/linux/AppMain.cpp b/examples/platform/linux/AppMain.cpp index 8afd89d23b8098..35f85dc3f016ca 100644 --- a/examples/platform/linux/AppMain.cpp +++ b/examples/platform/linux/AppMain.cpp @@ -315,12 +315,12 @@ void ChipLinuxAppMainLoop() initParams.testEventTriggerDelegate = &testEventTriggerDelegate; #endif + // We need to set DeviceInfoProvider before Server::Init to setup the storage of DeviceInfoProvider properly. + DeviceLayer::SetDeviceInfoProvider(&gExampleDeviceInfoProvider); + // Init ZCL Data Model and CHIP App Server Server::GetInstance().Init(initParams); - gExampleDeviceInfoProvider.SetStorageDelegate(&chip::Server::GetInstance().GetPersistentStorage()); - DeviceLayer::SetDeviceInfoProvider(&gExampleDeviceInfoProvider); - // Now that the server has started and we are done with our startup logging, // log our discovery/onboarding information again so it's not lost in the // noise.