Loading wifi/1.3/default/wifi_chip.cpp +19 −2 Original line number Diff line number Diff line Loading @@ -41,7 +41,9 @@ constexpr size_t kMaxBufferSizeBytes = 1024 * 1024 * 3; constexpr uint32_t kMaxRingBufferFileAgeSeconds = 60 * 60 * 10; constexpr uint32_t kMaxRingBufferFileNum = 20; constexpr char kTombstoneFolderPath[] = "/data/vendor/tombstones/wifi/"; constexpr unsigned kMaxWlanIfaces = 100; constexpr char kActiveWlanIfaceNameProperty[] = "wifi.active.interface"; constexpr char kNoActiveWlanIfaceNamePropertyValue[] = ""; constexpr unsigned kMaxWlanIfaces = 5; template <typename Iface> void invalidateAndClear(std::vector<sp<Iface>>& ifaces, sp<Iface> iface) { Loading Loading @@ -105,6 +107,13 @@ std::string getP2pIfaceName() { return buffer.data(); } void setActiveWlanIfaceNameProperty(const std::string& ifname) { auto res = property_set(kActiveWlanIfaceNameProperty, ifname.data()); if (res != 0) { PLOG(ERROR) << "Failed to set active wlan iface name property"; } } // delete files that meet either conditions: // 1. older than a predefined time in the wifi tombstone dir. // 2. Files in excess to a predefined amount, starting from the oldest ones Loading Loading @@ -316,13 +325,16 @@ WifiChip::WifiChip( is_valid_(true), current_mode_id_(feature_flags::chip_mode_ids::kInvalid), modes_(feature_flags.lock()->getChipModes()), debug_ring_buffer_cb_registered_(false) {} debug_ring_buffer_cb_registered_(false) { setActiveWlanIfaceNameProperty(kNoActiveWlanIfaceNamePropertyValue); } void WifiChip::invalidate() { if (!writeRingbufferFilesInternal()) { LOG(ERROR) << "Error writing files to flash"; } invalidateAndRemoveAllIfaces(); setActiveWlanIfaceNameProperty(kNoActiveWlanIfaceNamePropertyValue); legacy_hal_.reset(); event_cb_handler_.invalidate(); is_valid_ = false; Loading Loading @@ -693,6 +705,7 @@ WifiStatus WifiChip::configureChipInternal( } current_mode_id_ = mode_id; LOG(INFO) << "Configured chip in mode " << mode_id; setActiveWlanIfaceNameProperty(getFirstActiveWlanIfaceName()); return status; } Loading Loading @@ -780,6 +793,7 @@ std::pair<WifiStatus, sp<IWifiApIface>> WifiChip::createApIfaceInternal() { LOG(ERROR) << "Failed to invoke onIfaceAdded callback"; } } setActiveWlanIfaceNameProperty(getFirstActiveWlanIfaceName()); return {createWifiStatus(WifiStatusCode::SUCCESS), iface}; } Loading Loading @@ -811,6 +825,7 @@ WifiStatus WifiChip::removeApIfaceInternal(const std::string& ifname) { LOG(ERROR) << "Failed to invoke onIfaceRemoved callback"; } } setActiveWlanIfaceNameProperty(getFirstActiveWlanIfaceName()); return createWifiStatus(WifiStatusCode::SUCCESS); } Loading Loading @@ -919,6 +934,7 @@ std::pair<WifiStatus, sp<IWifiStaIface>> WifiChip::createStaIfaceInternal() { LOG(ERROR) << "Failed to invoke onIfaceAdded callback"; } } setActiveWlanIfaceNameProperty(getFirstActiveWlanIfaceName()); return {createWifiStatus(WifiStatusCode::SUCCESS), iface}; } Loading Loading @@ -950,6 +966,7 @@ WifiStatus WifiChip::removeStaIfaceInternal(const std::string& ifname) { LOG(ERROR) << "Failed to invoke onIfaceRemoved callback"; } } setActiveWlanIfaceNameProperty(getFirstActiveWlanIfaceName()); return createWifiStatus(WifiStatusCode::SUCCESS); } Loading Loading
wifi/1.3/default/wifi_chip.cpp +19 −2 Original line number Diff line number Diff line Loading @@ -41,7 +41,9 @@ constexpr size_t kMaxBufferSizeBytes = 1024 * 1024 * 3; constexpr uint32_t kMaxRingBufferFileAgeSeconds = 60 * 60 * 10; constexpr uint32_t kMaxRingBufferFileNum = 20; constexpr char kTombstoneFolderPath[] = "/data/vendor/tombstones/wifi/"; constexpr unsigned kMaxWlanIfaces = 100; constexpr char kActiveWlanIfaceNameProperty[] = "wifi.active.interface"; constexpr char kNoActiveWlanIfaceNamePropertyValue[] = ""; constexpr unsigned kMaxWlanIfaces = 5; template <typename Iface> void invalidateAndClear(std::vector<sp<Iface>>& ifaces, sp<Iface> iface) { Loading Loading @@ -105,6 +107,13 @@ std::string getP2pIfaceName() { return buffer.data(); } void setActiveWlanIfaceNameProperty(const std::string& ifname) { auto res = property_set(kActiveWlanIfaceNameProperty, ifname.data()); if (res != 0) { PLOG(ERROR) << "Failed to set active wlan iface name property"; } } // delete files that meet either conditions: // 1. older than a predefined time in the wifi tombstone dir. // 2. Files in excess to a predefined amount, starting from the oldest ones Loading Loading @@ -316,13 +325,16 @@ WifiChip::WifiChip( is_valid_(true), current_mode_id_(feature_flags::chip_mode_ids::kInvalid), modes_(feature_flags.lock()->getChipModes()), debug_ring_buffer_cb_registered_(false) {} debug_ring_buffer_cb_registered_(false) { setActiveWlanIfaceNameProperty(kNoActiveWlanIfaceNamePropertyValue); } void WifiChip::invalidate() { if (!writeRingbufferFilesInternal()) { LOG(ERROR) << "Error writing files to flash"; } invalidateAndRemoveAllIfaces(); setActiveWlanIfaceNameProperty(kNoActiveWlanIfaceNamePropertyValue); legacy_hal_.reset(); event_cb_handler_.invalidate(); is_valid_ = false; Loading Loading @@ -693,6 +705,7 @@ WifiStatus WifiChip::configureChipInternal( } current_mode_id_ = mode_id; LOG(INFO) << "Configured chip in mode " << mode_id; setActiveWlanIfaceNameProperty(getFirstActiveWlanIfaceName()); return status; } Loading Loading @@ -780,6 +793,7 @@ std::pair<WifiStatus, sp<IWifiApIface>> WifiChip::createApIfaceInternal() { LOG(ERROR) << "Failed to invoke onIfaceAdded callback"; } } setActiveWlanIfaceNameProperty(getFirstActiveWlanIfaceName()); return {createWifiStatus(WifiStatusCode::SUCCESS), iface}; } Loading Loading @@ -811,6 +825,7 @@ WifiStatus WifiChip::removeApIfaceInternal(const std::string& ifname) { LOG(ERROR) << "Failed to invoke onIfaceRemoved callback"; } } setActiveWlanIfaceNameProperty(getFirstActiveWlanIfaceName()); return createWifiStatus(WifiStatusCode::SUCCESS); } Loading Loading @@ -919,6 +934,7 @@ std::pair<WifiStatus, sp<IWifiStaIface>> WifiChip::createStaIfaceInternal() { LOG(ERROR) << "Failed to invoke onIfaceAdded callback"; } } setActiveWlanIfaceNameProperty(getFirstActiveWlanIfaceName()); return {createWifiStatus(WifiStatusCode::SUCCESS), iface}; } Loading Loading @@ -950,6 +966,7 @@ WifiStatus WifiChip::removeStaIfaceInternal(const std::string& ifname) { LOG(ERROR) << "Failed to invoke onIfaceRemoved callback"; } } setActiveWlanIfaceNameProperty(getFirstActiveWlanIfaceName()); return createWifiStatus(WifiStatusCode::SUCCESS); } Loading