Skip to content

Commit 15d3293

Browse files
Revert "[nrf fromlist][nrfconnect] Add checking of Wi-Fi supplicant and Interface"
This reverts commit 324ff76.
1 parent 324ff76 commit 15d3293

File tree

2 files changed

+1
-52
lines changed

2 files changed

+1
-52
lines changed

src/platform/nrfconnect/wifi/WiFiManager.cpp

+1-41
Original file line numberDiff line numberDiff line change
@@ -144,33 +144,6 @@ const Map<uint32_t, WiFiManager::NetEventHandler, 5> WiFiManager::sEventHandlerM
144144
{ NET_EVENT_WIFI_DISCONNECT_COMPLETE, WiFiManager::DisconnectHandler },
145145
});
146146

147-
void WiFiManager::WiFiSupplicantEventHandler(net_mgmt_event_callback * cb, uint32_t mgmtEvent, net_if * iface)
148-
{
149-
switch (mgmtEvent)
150-
{
151-
case NET_EVENT_WPA_SUPP_READY:
152-
Instance().mSupplicantReady = true;
153-
break;
154-
case NET_EVENT_WPA_SUPP_NOT_READY:
155-
Instance().mSupplicantReady = false;
156-
break;
157-
case NET_EVENT_WPA_SUPP_IFACE_ADDED:
158-
Instance().mInterfaceUp = true;
159-
break;
160-
case NET_EVENT_WPA_SUPP_IFACE_REMOVED:
161-
Instance().mInterfaceUp = false;
162-
break;
163-
default:
164-
break;
165-
}
166-
167-
if (Instance().mSupplicantReady && Instance().mInterfaceUp)
168-
{
169-
// In this case the Supplicant and Interface is fully ready.
170-
DeviceLayer::SystemLayer().CancelTimer(SupplicantInitTimeout, nullptr);
171-
}
172-
}
173-
174147
void WiFiManager::WifiMgmtEventHandler(net_mgmt_event_callback * cb, uint32_t mgmtEvent, net_if * iface)
175148
{
176149
if (iface == Instance().mNetIf)
@@ -197,16 +170,11 @@ CHIP_ERROR WiFiManager::Init()
197170

198171
net_mgmt_init_event_callback(&mWiFiMgmtClbk, WifiMgmtEventHandler, kWifiManagementEvents);
199172
net_mgmt_init_event_callback(&mIPv6MgmtClbk, IPv6MgmtEventHandler, kIPv6ManagementEvents);
200-
net_mgmt_init_event_callback(&mSuppMgmtClbk, WiFiSupplicantEventHandler, kSupplicantEvents);
201173

202174
net_mgmt_add_event_callback(&mWiFiMgmtClbk);
203175
net_mgmt_add_event_callback(&mIPv6MgmtClbk);
204-
net_mgmt_add_event_callback(&mSuppMgmtClbk);
205176

206-
// Set the timer and wait for the WiFi supplicant and interface ready.
207-
DeviceLayer::SystemLayer().StartTimer(System::Clock::Milliseconds32(kSupplicantReadyTimeoutMs), SupplicantInitTimeout, nullptr);
208-
209-
ChipLogDetail(DeviceLayer, "WiFiManager initialization requested");
177+
ChipLogDetail(DeviceLayer, "WiFiManager has been initialized");
210178

211179
return CHIP_NO_ERROR;
212180
}
@@ -620,13 +588,5 @@ CHIP_ERROR WiFiManager::SetLowPowerMode(bool onoff)
620588
return CHIP_NO_ERROR;
621589
}
622590

623-
void WiFiManager::SupplicantInitTimeout(System::Layer * layer, void * param)
624-
{
625-
ChipLogError(DeviceLayer, "Wi-Fi supplicant and interface have not been initialized!");
626-
// Wi-Fi driver must be initialized within the given timeout, when it is still not ready, do not to allow any further
627-
// operations.
628-
VerifyOrDie(Instance().mSupplicantReady && Instance().mInterfaceUp);
629-
}
630-
631591
} // namespace DeviceLayer
632592
} // namespace chip

src/platform/nrfconnect/wifi/WiFiManager.h

-11
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333

3434
extern "C" {
3535
#include <src/utils/common.h>
36-
#include <supp_events.h>
3736
#include <wpa_supplicant/wpa_supplicant_i.h>
3837
}
3938

@@ -174,7 +173,6 @@ class WiFiManager
174173
static constexpr uint32_t kConnectionRecoveryMaxIntervalMs = CONFIG_CHIP_WIFI_CONNECTION_RECOVERY_MAXIMUM_INTERVAL;
175174
static constexpr uint32_t kConnectionRecoveryJitterMs = CONFIG_CHIP_WIFI_CONNECTION_RECOVERY_JITTER;
176175
static constexpr uint32_t kConnectionRecoveryMaxRetries = CONFIG_CHIP_WIFI_CONNECTION_RECOVERY_MAX_RETRIES_NUMBER;
177-
static constexpr uint32_t kSupplicantReadyTimeoutMs = 500;
178176

179177
CHIP_ERROR Init();
180178
CHIP_ERROR Scan(const ByteSpan & ssid, ScanResultCallback resultCallback, ScanDoneCallback doneCallback,
@@ -202,13 +200,9 @@ class WiFiManager
202200

203201
constexpr static uint32_t kIPv6ManagementEvents = NET_EVENT_IPV6_ADDR_ADD | NET_EVENT_IPV6_ADDR_DEL;
204202

205-
constexpr static uint32_t kSupplicantEvents = NET_EVENT_WPA_SUPP_READY | NET_EVENT_WPA_SUPP_CMD_NOT_READY |
206-
NET_EVENT_WPA_SUPP_IFACE_ADDED | NET_EVENT_WPA_SUPP_IFACE_REMOVED;
207-
208203
// Event handling
209204
static void WifiMgmtEventHandler(net_mgmt_event_callback * cb, uint32_t mgmtEvent, net_if * iface);
210205
static void IPv6MgmtEventHandler(net_mgmt_event_callback * cb, uint32_t mgmtEvent, net_if * iface);
211-
static void WiFiSupplicantEventHandler(net_mgmt_event_callback * cb, uint32_t mgmtEvent, net_if * iface);
212206
static void ScanResultHandler(Platform::UniquePtr<uint8_t> data);
213207
static void ScanDoneHandler(Platform::UniquePtr<uint8_t> data);
214208
static void ConnectHandler(Platform::UniquePtr<uint8_t> data);
@@ -227,21 +221,16 @@ class WiFiManager
227221
// To avoid frequent recovery attempts when the signal to an access point is poor quality
228222
// The connection recovery interval will be cleared after the defined delay in kConnectionRecoveryDelayToReset.
229223
static void Recover(System::Layer * layer, void * param);
230-
static void SupplicantInitTimeout(System::Layer * layer, void * param);
231224
void ResetRecoveryTime();
232225
System::Clock::Milliseconds32 CalculateNextRecoveryTime();
233226

234-
bool mSupplicantReady{ false };
235-
bool mInterfaceUp{ false };
236-
bool mSupplicantInitTimeoutElapsed{ false };
237227
net_if * mNetIf{ nullptr };
238228
ConnectionParams mWiFiParams{};
239229
ConnectionHandling mHandling;
240230
wifi_iface_state mWiFiState;
241231
wifi_iface_state mCachedWiFiState;
242232
net_mgmt_event_callback mWiFiMgmtClbk{};
243233
net_mgmt_event_callback mIPv6MgmtClbk{};
244-
net_mgmt_event_callback mSuppMgmtClbk{};
245234
ScanResultCallback mScanResultCallback{ nullptr };
246235
ScanDoneCallback mScanDoneCallback{ nullptr };
247236
WiFiNetwork mWantedNetwork{};

0 commit comments

Comments
 (0)