Skip to content

Commit

Permalink
Fix test value fallback for hardware version string read (#25864)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmartinez-silabs authored and pull[bot] committed Jul 14, 2023
1 parent 6c95f5e commit 2852785
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -355,13 +355,13 @@ CHIP_ERROR SIWx917DeviceDataProvider::GetHardwareVersionString(char * buf, size_
size_t hardwareVersionStringLen = 0; // without counting null-terminator
CHIP_ERROR err =
SilabsConfig::ReadConfigValueStr(SilabsConfig::kConfigKey_HardwareVersionString, buf, bufSize, hardwareVersionStringLen);
#if defined(CHIP_DEVICE_CONFIG_DEVICE_HARDWARE_VERSION_STRING)
#if defined(CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION_STRING)
if (err == CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND)
{
memcpy(buf, CHIP_DEVICE_CONFIG_DEVICE_HARDWARE_VERSION_STRING, sizeof(bufSize));
memcpy(buf, CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION_STRING, bufSize);
err = CHIP_NO_ERROR;
}
#endif // CHIP_DEVICE_CONFIG_DEVICE_HARDWARE_VERSION_STRING
#endif // CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION_STRING
return err;
}

Expand Down
6 changes: 3 additions & 3 deletions examples/platform/silabs/efr32/EFR32DeviceDataProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,13 @@ CHIP_ERROR EFR32DeviceDataProvider::GetHardwareVersionString(char * buf, size_t
size_t hardwareVersionStringLen = 0; // without counting null-terminator
CHIP_ERROR err =
SilabsConfig::ReadConfigValueStr(SilabsConfig::kConfigKey_HardwareVersionString, buf, bufSize, hardwareVersionStringLen);
#if defined(CHIP_DEVICE_CONFIG_DEVICE_HARDWARE_VERSION_STRING)
#if defined(CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION_STRING)
if (err == CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND)
{
memcpy(buf, CHIP_DEVICE_CONFIG_DEVICE_HARDWARE_VERSION_STRING, sizeof(bufSize));
memcpy(buf, CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION_STRING, bufSize);
err = CHIP_NO_ERROR;
}
#endif // CHIP_DEVICE_CONFIG_DEVICE_HARDWARE_VERSION_STRING
#endif // CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION_STRING
return err;
}

Expand Down
2 changes: 1 addition & 1 deletion src/include/platform/CHIPDeviceConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@
#endif

/**
* CHIP_DEVICE_CONFIG_DEVICE_HARDWARE_VERSION_STRING
* CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION_STRING
*
* Human readable string identifying version of the product assigned by the device vendor.
*/
Expand Down

0 comments on commit 2852785

Please sign in to comment.