mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #18556 from benpicco/shell_suit_revert
sys/shell/commands: add suit revert sub-command
This commit is contained in:
commit
2eb440b05c
@ -26,10 +26,18 @@
|
||||
#include "suit/storage.h"
|
||||
#include "suit/transport/coap.h"
|
||||
|
||||
#ifdef MODULE_SUIT_STORAGE_FLASHWRITE
|
||||
#include "riotboot/flashwrite.h"
|
||||
#include "periph/pm.h"
|
||||
#endif
|
||||
|
||||
static void _print_usage(char **argv)
|
||||
{
|
||||
printf("Usage: %s fetch <manifest url>\n", argv[0]);
|
||||
printf(" %s seq_no\n", argv[0]);
|
||||
if (IS_USED(MODULE_SUIT_STORAGE_FLASHWRITE)) {
|
||||
printf(" %s revert\n", argv[0]);
|
||||
}
|
||||
}
|
||||
|
||||
static int _suit_handler(int argc, char **argv)
|
||||
@ -47,6 +55,18 @@ static int _suit_handler(int argc, char **argv)
|
||||
suit_storage_get_highest_seq_no(&seq_no);
|
||||
printf("seq_no: 0x%08" PRIx32 "\n", seq_no);
|
||||
}
|
||||
#ifdef MODULE_SUIT_STORAGE_FLASHWRITE
|
||||
else if (strcmp(argv[1], "revert") == 0) {
|
||||
int res = riotboot_flashwrite_invalidate_latest();
|
||||
if (res) {
|
||||
printf("revert failed: %d\n", res);
|
||||
}
|
||||
else {
|
||||
printf("reverted to previous version, rebooting…\n");
|
||||
pm_reboot();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
_print_usage(argv);
|
||||
return -1;
|
||||
|
Loading…
Reference in New Issue
Block a user