mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-27 07:21:18 +01:00
sys/shell: add suit shell command
This command allows for triggering an update from the device itself
This commit is contained in:
parent
560ee3bac9
commit
2ff3d4cd8d
@ -144,17 +144,12 @@ int suit_coap_get_blockwise_url(const char *url,
|
||||
coap_blockwise_cb_t callback, void *arg);
|
||||
|
||||
/**
|
||||
* @brief Set the url used to fetch the SUIT manifest
|
||||
* @brief Trigger a SUIT udate
|
||||
*
|
||||
* @param[in] url url pointer containing the full coap url to the manifest
|
||||
* @param[in] len length of the url
|
||||
*/
|
||||
void suit_coap_set_url(const uint8_t *url, size_t len);
|
||||
|
||||
/**
|
||||
* @brief Trigger a SUIT udate
|
||||
*/
|
||||
void suit_coap_trigger(void);
|
||||
void suit_coap_trigger(const uint8_t *url, size_t len);
|
||||
|
||||
#endif /* DOXYGEN */
|
||||
|
||||
|
||||
@ -99,4 +99,8 @@ ifneq (,$(filter test_utils_interactive_sync,$(USEMODULE)))
|
||||
SRC += sc_interactive_sync.c
|
||||
endif
|
||||
|
||||
ifneq (,$(filter suit_coap,$(USEMODULE)))
|
||||
SRC += sc_suit.c
|
||||
endif
|
||||
|
||||
include $(RIOTBASE)/Makefile.base
|
||||
|
||||
38
sys/shell/commands/sc_suit.c
Normal file
38
sys/shell/commands/sc_suit.c
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Alexandre Abadie <alexandre.abadie@inria.fr>
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup sys_shell_commands
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Trigger a firmware update from the shell
|
||||
*
|
||||
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
|
||||
*
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "suit/coap.h"
|
||||
|
||||
|
||||
int _suit_handler(int argc, char **argv)
|
||||
{
|
||||
if (argc != 2) {
|
||||
printf("Usage: %s <manifest url>\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
suit_coap_trigger((uint8_t *)argv[1], strlen(argv[1]));
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -168,6 +168,10 @@ extern int _test_start(int argc, char **argv);
|
||||
extern int _test_ready(int argc, char **argv);
|
||||
#endif
|
||||
|
||||
#ifdef MODULE_SUIT_COAP
|
||||
extern int _suit_handler(int argc, char **argv);
|
||||
#endif
|
||||
|
||||
const shell_command_t _shell_command_list[] = {
|
||||
{"reboot", "Reboot the node", _reboot_handler},
|
||||
#ifdef MODULE_CONFIG
|
||||
@ -276,6 +280,9 @@ const shell_command_t _shell_command_list[] = {
|
||||
#ifdef MODULE_TEST_UTILS_INTERACTIVE_SYNC
|
||||
{ "r", "Test sync, Ready query", _test_ready },
|
||||
{ "s", "Test sync, Start test trigger", _test_start },
|
||||
#endif
|
||||
#ifdef MODULE_SUIT_COAP
|
||||
{ "suit", "Trigger a SUIT firmware update", _suit_handler },
|
||||
#endif
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user