This is an automated email from the ASF dual-hosted git repository.
janc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
The following commit(s) were added to refs/heads/master by this push:
new f80cde637 sys/shell: Add "/compat reset_cause" command
f80cde637 is described below
commit f80cde637386bbbad8393ea6938e993164d93a5f
Author: Michal Gorecki <[email protected]>
AuthorDate: Fri Aug 12 16:04:00 2022 +0200
sys/shell: Add "/compat reset_cause" command
Command prints reset cause when called.
---
sys/shell/src/shell_os.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/sys/shell/src/shell_os.c b/sys/shell/src/shell_os.c
index 82100d550..662c2ab02 100644
--- a/sys/shell/src/shell_os.c
+++ b/sys/shell/src/shell_os.c
@@ -169,6 +169,14 @@ shell_os_date_cmd(const struct shell_cmd *cmd, int argc,
char **argv,
return rc;
}
+int
+shell_os_print_reset_cause(const struct shell_cmd *cmd, int argc, char **argv,
+ struct streamer *streamer)
+{
+ streamer_printf(streamer, "Reset cause: %s\n", hal_reset_cause_str());
+ return 0;
+}
+
int
shell_os_reset_cmd(const struct shell_cmd *cmd, int argc, char **argv,
struct streamer *streamer)
@@ -250,6 +258,10 @@ static const struct shell_param reset_params[] = {
{NULL, NULL}
};
+static const struct shell_cmd_help print_reset_cause_help = {
+ .summary = "Print reset cause.",
+};
+
static const struct shell_cmd_help reset_help = {
.summary = "reset system",
.usage = NULL,
@@ -266,6 +278,7 @@ static const struct shell_cmd os_commands[] = {
SHELL_CMD_EXT("mpool", shell_os_mpool_display_cmd, &mpool_help),
SHELL_CMD_EXT("date", shell_os_date_cmd, &date_help),
SHELL_CMD_EXT("reset", shell_os_reset_cmd, &reset_help),
+ SHELL_CMD_EXT("reset_cause", shell_os_print_reset_cause,
&print_reset_cause_help),
SHELL_CMD_EXT("lsdev", shell_os_ls_dev_cmd, &ls_dev_help),
{ 0 },
};