From b1310365064badcc6d9085ef010ae57b7c959506 Mon Sep 17 00:00:00 2001 From: jmartinez-silabs <67972863+jmartinez-silabs@users.noreply.github.com> Date: Tue, 12 Apr 2022 17:46:15 -0400 Subject: [PATCH] Fix WiFi build (#17290) fix compilation issue and race condition in wifi build --- .../EFR32/NetworkCommissioningWiFiDriver.cpp | 30 +++++++++------- .../EFR32/NetworkCommissioningWiFiDriver.h | 35 +------------------ third_party/efr32_sdk/efr32_sdk.gni | 7 ++++ third_party/efr32_sdk/repo | 2 +- 4 files changed, 26 insertions(+), 48 deletions(-) diff --git a/src/platform/EFR32/NetworkCommissioningWiFiDriver.cpp b/src/platform/EFR32/NetworkCommissioningWiFiDriver.cpp index 4d1708200e34d6..af06d1a7bfd40e 100644 --- a/src/platform/EFR32/NetworkCommissioningWiFiDriver.cpp +++ b/src/platform/EFR32/NetworkCommissioningWiFiDriver.cpp @@ -175,30 +175,34 @@ void SlWiFiDriver::ConnectNetwork(ByteSpan networkId, ConnectCallback * callback } } -uint8_t SlWiFiDriver::ConvertSecuritytype(uint8_t security) +chip::BitFlags SlWiFiDriver::ConvertSecuritytype(uint8_t security) { - uint8_t securityType = EMBER_ZCL_SECURITY_TYPE_UNSPECIFIED; + chip::BitFlags securityType; if (security == WFX_SEC_NONE) { - securityType = EMBER_ZCL_SECURITY_TYPE_NONE; + securityType = WiFiSecurity::kUnencrypted; } - else if (security == WFX_SEC_WPA3) + else if (security & WFX_SEC_WEP) + { + securityType = WiFiSecurity::kWepPersonal; + } + else if (security & WFX_SEC_WPA) { - securityType = EMBER_ZCL_SECURITY_TYPE_WPA3; + securityType = WiFiSecurity::kWpaPersonal; } else if (security & WFX_SEC_WPA2) { - securityType = EMBER_ZCL_SECURITY_TYPE_WPA2; + securityType = WiFiSecurity::kWpa2Personal; } - else if (security & WFX_SEC_WPA) + else if (security == WFX_SEC_WPA3) { - securityType = EMBER_ZCL_SECURITY_TYPE_WPA; + securityType = WiFiSecurity::kWpa3Personal; } - else if (security & WFX_SEC_WEP) + else { - securityType = EMBER_ZCL_SECURITY_TYPE_WEP; + // wfx_sec_t support more type + securityType = WiFiSecurity::kUnencrypted; } - // wfx_sec_t support more type return securityType; } @@ -235,9 +239,9 @@ void SlWiFiDriver::OnScanWiFiNetworkDone(wfx_wifi_scan_result_t * aScanResult) } else { - NetworkCommissioning::WiFiScanResponse scanResponse = { 0 }; + NetworkCommissioning::WiFiScanResponse scanResponse = {}; - scanResponse.security.SetRaw(GetInstance().ConvertSecuritytype(aScanResult->security)); + scanResponse.security.Set(GetInstance().ConvertSecuritytype(aScanResult->security)); scanResponse.channel = aScanResult->chan; scanResponse.rssi = aScanResult->rssi; scanResponse.ssidLen = strnlen(aScanResult->ssid, DeviceLayer::Internal::kMaxWiFiSSIDLength); diff --git a/src/platform/EFR32/NetworkCommissioningWiFiDriver.h b/src/platform/EFR32/NetworkCommissioningWiFiDriver.h index 99b650f01f89a2..411de01e3d1637 100644 --- a/src/platform/EFR32/NetworkCommissioningWiFiDriver.h +++ b/src/platform/EFR32/NetworkCommissioningWiFiDriver.h @@ -30,39 +30,6 @@ constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 20; } // namespace -// class SlScanResponseIterator : public Iterator -// { -// public: -// SlScanResponseIterator(const size_t size, const wifi_ap_record_t * scanResults) : mSize(size), mpScanResults(scanResults) {} -// size_t Count() override { return mSize; } -// bool Next(WiFiScanResponse & item) override -// { -// if (mIternum >= mSize) -// { -// return false; -// } - -// item.security.SetRaw(mpScanResults[mIternum].authmode); -// item.ssidLen = -// strnlen(reinterpret_cast(mpScanResults[mIternum].ssid), -// chip::DeviceLayer::Internal::kMaxWiFiSSIDLength); -// item.channel = mpScanResults[mIternum].primary; -// item.wiFiBand = chip::DeviceLayer::NetworkCommissioning::WiFiBand::k2g4; -// item.rssi = mpScanResults[mIternum].rssi; -// memcpy(item.ssid, mpScanResults[mIternum].ssid, item.ssidLen); -// memcpy(item.bssid, mpScanResults[mIternum].bssid, 6); - -// mIternum++; -// return true; -// } -// void Release() override {} - -// private: -// const size_t mSize; -// const wifi_ap_record_t * mpScanResults; -// size_t mIternum = 0; -// }; - template class SlScanResponseIterator : public Iterator { @@ -153,7 +120,7 @@ class SlWiFiDriver final : public WiFiDriver CHIP_ERROR ConnectWiFiNetwork(const char * ssid, uint8_t ssidLen, const char * key, uint8_t keyLen); - uint8_t ConvertSecuritytype(uint8_t security); + chip::BitFlags ConvertSecuritytype(uint8_t security); void OnConnectWiFiNetwork(); static SlWiFiDriver & GetInstance() diff --git a/third_party/efr32_sdk/efr32_sdk.gni b/third_party/efr32_sdk/efr32_sdk.gni index 846733d07e4e7a..9b7c13c4d4c5f8 100644 --- a/third_party/efr32_sdk/efr32_sdk.gni +++ b/third_party/efr32_sdk/efr32_sdk.gni @@ -284,6 +284,13 @@ template("efr32_sdk") { "-Wno-shadow", ] + if (defined(invoker.use_rs911x)) { + if (invoker.use_rs911x == true) { + #add compilation flags for rs991x build. This will be addressed directly in wiseconnect sdk in the next version release of that sdk + cflags += invoker.rs911x_cflags + } + } + if (defined(invoker.defines)) { defines += invoker.defines } diff --git a/third_party/efr32_sdk/repo b/third_party/efr32_sdk/repo index d90c8379f259e1..175cbe761d2fab 160000 --- a/third_party/efr32_sdk/repo +++ b/third_party/efr32_sdk/repo @@ -1 +1 @@ -Subproject commit d90c8379f259e1a6b33c1ec147289f5e55d2b6a8 +Subproject commit 175cbe761d2fab133725dab01abb1a149e23eb20