Browse Source

updatehub: use the new API method in autohandler

Call updatehub_report_error() when detecting an unconfirmed image in
autohandler to ensure the server is notified of the failure before
triggering a rollback.

Signed-off-by: Adrien Maillard <adrien.maillard@edu.hefr.ch>
pull/92275/head
Adrien Maillard 2 months ago committed by Daniel DeGrasse
parent
commit
c37a206673
  1. 11
      subsys/mgmt/updatehub/updatehub.c

11
subsys/mgmt/updatehub/updatehub.c

@ -1001,9 +1001,7 @@ static void autohandler(struct k_work *work) @@ -1001,9 +1001,7 @@ static void autohandler(struct k_work *work)
case UPDATEHUB_UNCONFIRMED_IMAGE:
LOG_ERR("Image is unconfirmed. Rebooting to revert back to previous"
"confirmed image.");
if (report(UPDATEHUB_STATE_ERROR) < 0) {
LOG_ERR("Failed to report rollback error to server");
}
updatehub_report_error();
LOG_PANIC();
updatehub_reboot();
break;
@ -1049,5 +1047,10 @@ void z_impl_updatehub_autohandler(void) @@ -1049,5 +1047,10 @@ void z_impl_updatehub_autohandler(void)
int z_impl_updatehub_report_error(void)
{
return report(UPDATEHUB_STATE_ERROR);
int ret = report(UPDATEHUB_STATE_ERROR);
if (ret < 0) {
LOG_ERR("Failed to report rollback error to server");
}
return ret;
}

Loading…
Cancel
Save