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>
This commit is contained in:
parent
4d73cd3980
commit
c37a206673
@ -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)
|
||||
|
||||
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…
Reference in New Issue
Block a user