mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 16:50:18 +00:00
Merge "wifi(vts): Add retry for HAL start" into oc-dev am: 4197ba0208
am: 647d7a8aec
Change-Id: I43f2d5f90c8e5bba71753cdb8587f5fd59233e30
This commit is contained in:
@@ -36,6 +36,9 @@ using ::android::hardware::hidl_string;
|
||||
using ::android::hardware::hidl_vec;
|
||||
|
||||
namespace {
|
||||
constexpr uint32_t kHalStartRetryMaxCount = 5;
|
||||
constexpr uint32_t kHalStartRetryIntervalInMs = 2;
|
||||
|
||||
bool findAnyModeSupportingIfaceType(
|
||||
IfaceType desired_type, const std::vector<IWifiChip::ChipMode>& modes,
|
||||
ChipModeId* mode_id) {
|
||||
@@ -92,7 +95,15 @@ sp<IWifiChip> getWifiChip() {
|
||||
if (!wifi.get()) {
|
||||
return nullptr;
|
||||
}
|
||||
if (HIDL_INVOKE(wifi, start).code != WifiStatusCode::SUCCESS) {
|
||||
uint32_t retry_count = 0;
|
||||
auto status = HIDL_INVOKE(wifi, start);
|
||||
while (retry_count < kHalStartRetryMaxCount &&
|
||||
status.code == WifiStatusCode::ERROR_NOT_AVAILABLE) {
|
||||
retry_count++;
|
||||
usleep(kHalStartRetryIntervalInMs * 1000);
|
||||
status = HIDL_INVOKE(wifi, start);
|
||||
}
|
||||
if (status.code != WifiStatusCode::SUCCESS) {
|
||||
return nullptr;
|
||||
}
|
||||
const auto& status_and_chip_ids = HIDL_INVOKE(wifi, getChipIds);
|
||||
|
||||
Reference in New Issue
Block a user