Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a way to disable the spec-mandated 2-minute floor on OTA retries. #25925

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/app/chip_data_model.gni
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ _zap_cluster_list_script = get_path_info("zap_cluster_list.py", "abspath")
template("chip_data_model") {
_data_model_name = target_name

declare_args() {
# Allow building ota-requestor-app with a non-spec-compliant floor
# (i.e. smaller than 2 minutes) for action delays.
non_spec_compliant_ota_action_delay_floor = -1
}

if (defined(invoker.idl)) {
_idl = invoker.idl
} else {
Expand Down Expand Up @@ -285,6 +291,10 @@ template("chip_data_model") {

cflags += [ "-Wconversion" ]

if (non_spec_compliant_ota_action_delay_floor >= 0) {
cflags += [ "-DNON_SPEC_COMPLIANT_OTA_ACTION_DELAY_FLOOR=${non_spec_compliant_ota_action_delay_floor}" ]
}

if (!defined(public_configs)) {
public_configs = []
}
Expand Down
7 changes: 6 additions & 1 deletion src/app/clusters/ota-requestor/DefaultOTARequestorDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@ using namespace app::Clusters::OtaSoftwareUpdateRequestor::Structs;
constexpr uint8_t kMaxInvalidSessionRetries = 1; // Max # of query image retries to perform on invalid session error
constexpr uint32_t kDelayQueryUponCommissioningSec = 30; // Delay before sending the initial image query after commissioning
constexpr uint32_t kImmediateStartDelaySec = 1; // Delay before sending a query in response to UrgentUpdateAvailable

#ifdef NON_SPEC_COMPLIANT_OTA_ACTION_DELAY_FLOOR
constexpr System::Clock::Seconds32 kDefaultDelayedActionTime = System::Clock::Seconds32(NON_SPEC_COMPLIANT_OTA_ACTION_DELAY_FLOOR);
#else
constexpr System::Clock::Seconds32 kDefaultDelayedActionTime = System::Clock::Seconds32(120);
#endif // NON_SPEC_COMPLIANT_OTA_ACTION_DELAY_FLOOR

DefaultOTARequestorDriver * ToDriver(void * context)
{
Expand Down Expand Up @@ -511,7 +516,7 @@ CHIP_ERROR DefaultOTARequestorDriver::ScheduleQueryRetry(bool trySameProvider, S

if (status == CHIP_NO_ERROR)
{
ChipLogProgress(SoftwareUpdate, "Scheduling a retry");
ChipLogProgress(SoftwareUpdate, "Scheduling a retry; delay: %" PRIu32, delay.count());
ScheduleDelayedAction(delay, StartDelayTimerHandler, this);
}

Expand Down