From 357d179f22c236b20df8945af29187826cf64cd9 Mon Sep 17 00:00:00 2001 From: ready2die4u Date: Wed, 3 Jul 2024 05:11:32 +0900 Subject: [PATCH] ESP32: Fix to connect to wifi using shell command (#34080) - Fix an issue that 'matter wifi connect' doesn't work on ESP32 by calling chip::Shell::SetWiFiDriver --- examples/platform/esp32/common/Esp32AppServer.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/examples/platform/esp32/common/Esp32AppServer.cpp b/examples/platform/esp32/common/Esp32AppServer.cpp index 4f854c518bd01f..1c30098e9010d5 100644 --- a/examples/platform/esp32/common/Esp32AppServer.cpp +++ b/examples/platform/esp32/common/Esp32AppServer.cpp @@ -38,6 +38,10 @@ #endif // CONFIG_BT_ENABLED #endif // CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE +#ifdef CONFIG_ENABLE_CHIP_SHELL +#include +#endif + #include using namespace chip; @@ -147,6 +151,9 @@ void Esp32AppServer::Init(AppDelegate * sAppDelegate) #if CHIP_DEVICE_CONFIG_ENABLE_WIFI sWiFiNetworkCommissioningInstance.Init(); +#ifdef CONFIG_ENABLE_CHIP_SHELL + chip::Shell::SetWiFiDriver(&(chip::DeviceLayer::NetworkCommissioning::ESPWiFiDriver::GetInstance())); +#endif #endif #if CHIP_DEVICE_CONFIG_ENABLE_ETHERNET sEthernetNetworkCommissioningInstance.Init();