diff --git a/examples/telnetd/telnetd.c b/examples/telnetd/telnetd.c index 72a21a270..1716f145b 100644 --- a/examples/telnetd/telnetd.c +++ b/examples/telnetd/telnetd.c @@ -48,6 +48,11 @@ #include #include +#ifdef CONFIG_BOARDCTL_RESET +# include +# include +#endif + #include "netutils/telnetd.h" #include "netutils/netlib.h" @@ -68,6 +73,11 @@ struct ptentry_s ****************************************************************************/ static void telnetd_help(int argc, char **argv); + +#ifdef CONFIG_BOARDCTL_RESET +static void telnetd_reset(int argc, char **argv); +#endif + static void telnetd_quit(int argc, char **argv); static void telnetd_unknown(int argc, char **argv); static void telnetd_parse(FAR char *line, int len); @@ -79,6 +89,9 @@ static void telnetd_parse(FAR char *line, int len); static const struct ptentry_s g_parsetab[] = { {"help", telnetd_help}, + #ifdef CONFIG_BOARDCTL_RESET + {"reset", telnetd_reset}, + #endif {"exit", telnetd_quit}, {"?", telnetd_help}, {NULL, telnetd_unknown} @@ -96,6 +109,9 @@ static void telnetd_help(int argc, char **argv) { printf("Available commands:\n"); printf(" help, ? - show help\n"); + #ifdef CONFIG_BOARDCTL_RESET + printf(" reset - reset the board\n"); + #endif printf(" exit - exit shell\n"); } @@ -121,6 +137,18 @@ static void telnetd_quit(int argc, char **argv) exit(0); } +/**************************************************************************** + * Name: telnetd_reset + ****************************************************************************/ +#ifdef CONFIG_BOARDCTL_RESET +static void telnetd_reset(int argc, char **argv) +{ + printf("Reset!\n"); + boardctl(BOARDIOC_RESET, 0); + exit(0); +} +#endif + /**************************************************************************** * Name: telnetd_parse ****************************************************************************/