mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #20237 from benpicco/suit_worker_done_cb
sys/suit: introduce suit_worker_done_cb()
This commit is contained in:
commit
45bc3bbcdc
@ -81,6 +81,15 @@ void suit_worker_trigger_prepared(const uint8_t *manifest, size_t size);
|
||||
*/
|
||||
int suit_worker_try_prepare(uint8_t **buffer, size_t *size);
|
||||
|
||||
/**
|
||||
* @brief Callback that is executed after the SUIT process has finished
|
||||
*
|
||||
* @param[in] res Result of the SUIT update, 0 on success
|
||||
*
|
||||
* By default this will reboot the board, can be overwritten by the application.
|
||||
*/
|
||||
void suit_worker_done_cb(int res);
|
||||
|
||||
/**
|
||||
* @brief Trigger a SUIT update
|
||||
*
|
||||
|
@ -146,6 +146,21 @@ int suit_handle_manifest_buf(const uint8_t *buffer, size_t size)
|
||||
return res;
|
||||
}
|
||||
|
||||
__attribute__((weak))
|
||||
void suit_worker_done_cb(int res)
|
||||
{
|
||||
if (res == 0) {
|
||||
LOG_INFO("suit_worker: update successful\n");
|
||||
if (IS_USED(MODULE_SUIT_STORAGE_FLASHWRITE)) {
|
||||
LOG_INFO("suit_worker: rebooting...\n");
|
||||
pm_reboot();
|
||||
}
|
||||
}
|
||||
else {
|
||||
LOG_INFO("suit_worker: update failed, hdr invalid\n ");
|
||||
}
|
||||
}
|
||||
|
||||
static void *_suit_worker_thread(void *arg)
|
||||
{
|
||||
(void)arg;
|
||||
@ -159,16 +174,7 @@ static void *_suit_worker_thread(void *arg)
|
||||
res = suit_handle_url(_url);
|
||||
}
|
||||
|
||||
if (res == 0) {
|
||||
LOG_INFO("suit_worker: update successful\n");
|
||||
if (IS_USED(MODULE_SUIT_STORAGE_FLASHWRITE)) {
|
||||
LOG_INFO("suit_worker: rebooting...\n");
|
||||
pm_reboot();
|
||||
}
|
||||
}
|
||||
else {
|
||||
LOG_INFO("suit_worker: update failed, hdr invalid\n ");
|
||||
}
|
||||
suit_worker_done_cb(res);
|
||||
|
||||
mutex_unlock(&_worker_lock);
|
||||
thread_zombify();
|
||||
|
Loading…
Reference in New Issue
Block a user