Skip to content

Commit

Permalink
[linux]: Use LocationCapability if GetRegulatoryLocation fail (#23602)
Browse files Browse the repository at this point in the history
* [linux]: Use LocationCapability if GetRegulatoryLocation fail

* Address the review comment
  • Loading branch information
yufengwangca authored and pull[bot] committed Nov 24, 2023
1 parent a66c6f7 commit 9158817
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/platform/Linux/ConfigurationManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,17 +369,23 @@ CHIP_ERROR ConfigurationManagerImpl::StoreBootReason(uint32_t bootReason)

CHIP_ERROR ConfigurationManagerImpl::GetRegulatoryLocation(uint8_t & location)
{
uint32_t value = 0;
uint32_t value;

CHIP_ERROR err = ReadConfigValue(PosixConfig::kConfigKey_RegulatoryLocation, value);
if (CHIP_NO_ERROR != ReadConfigValue(PosixConfig::kConfigKey_RegulatoryLocation, value))
{
ReturnErrorOnFailure(GetLocationCapability(location));

if (err == CHIP_NO_ERROR)
if (CHIP_NO_ERROR != StoreRegulatoryLocation(location))
{
ChipLogError(DeviceLayer, "Failed to store RegulatoryLocation");
}
}
else
{
VerifyOrReturnError(value <= UINT8_MAX, CHIP_ERROR_INVALID_INTEGER_VALUE);
location = static_cast<uint8_t>(value);
}

return err;
return CHIP_NO_ERROR;
}

CHIP_ERROR ConfigurationManagerImpl::GetLocationCapability(uint8_t & location)
Expand Down

0 comments on commit 9158817

Please sign in to comment.