1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

sys/shell_commands: convert to SHELL_COMMAND()

Make use of XFA for shell commands
This commit is contained in:
Marian Buschsieweke 2022-05-31 23:27:27 +02:00
parent 66a04926ca
commit 5ea582b3dd
No known key found for this signature in database
GPG Key ID: CB8E3238CE715A94
85 changed files with 269 additions and 549 deletions

View File

@ -27,7 +27,6 @@
#include "thread.h" #include "thread.h"
#include "shell.h" #include "shell.h"
#include "shell_commands.h"
#ifdef MODULE_NETIF #ifdef MODULE_NETIF
#include "net/gnrc/pktdump.h" #include "net/gnrc/pktdump.h"

View File

@ -23,7 +23,6 @@
#include "thread.h" #include "thread.h"
#include "shell.h" #include "shell.h"
#include "shell_commands.h"
#include "board.h" #include "board.h"

View File

@ -25,7 +25,6 @@
#include "timex.h" #include "timex.h"
#include "ztimer.h" #include "ztimer.h"
#include "shell.h" #include "shell.h"
#include "shell_commands.h"
#include "nimble_scanner.h" #include "nimble_scanner.h"
#include "nimble_scanlist.h" #include "nimble_scanlist.h"

View File

@ -20,7 +20,6 @@
#include <stdio.h> #include <stdio.h>
#include "shell.h" #include "shell.h"
#include "shell_commands.h"
#include "control.h" #include "control.h"

View File

@ -24,7 +24,6 @@
#include "net/ieee802154.h" #include "net/ieee802154.h"
#include "net/l2util.h" #include "net/l2util.h"
#include "shell_commands.h"
#include "shell.h" #include "shell.h"
#include "ztimer.h" #include "ztimer.h"

View File

@ -22,7 +22,6 @@
#include <stdio.h> #include <stdio.h>
#include "shell.h" #include "shell.h"
#include "shell_commands.h"
#include "xfa.h" #include "xfa.h"
#include "nimble_riot.h" #include "nimble_riot.h"

View File

@ -19,9 +19,9 @@
#include <stdlib.h> #include <stdlib.h>
#include "clist.h" #include "clist.h"
#include "fmt.h"
#include "congure/test.h" #include "congure/test.h"
#include "fmt.h"
#include "shell.h"
static congure_snd_msg_t _msgs_pool[CONFIG_CONGURE_TEST_LOST_MSG_POOL_SIZE]; static congure_snd_msg_t _msgs_pool[CONFIG_CONGURE_TEST_LOST_MSG_POOL_SIZE];
static unsigned _msgs_pool_idx; static unsigned _msgs_pool_idx;
@ -45,6 +45,9 @@ int congure_test_clear_state(int argc, char **argv)
return 0; return 0;
} }
SHELL_COMMAND(cong_clear, "Clears CongURE state object",
congure_test_clear_state);
int congure_test_call_setup(int argc, char **argv) int congure_test_call_setup(int argc, char **argv)
{ {
congure_test_snd_t *c = congure_test_get_state(); congure_test_snd_t *c = congure_test_get_state();
@ -70,6 +73,10 @@ int congure_test_call_setup(int argc, char **argv)
return 0; return 0;
} }
SHELL_COMMAND(cong_setup,
"Calls the setup function for the CongURE state object",
congure_test_call_setup);
static inline bool _check_driver(congure_test_snd_t *c) static inline bool _check_driver(congure_test_snd_t *c)
{ {
if (c->super.driver == NULL) { if (c->super.driver == NULL) {
@ -103,6 +110,9 @@ int congure_test_call_init(int argc, char **argv)
return 0; return 0;
} }
SHELL_COMMAND(cong_init, "Calls init method of the CongURE state object",
congure_test_call_init);
int congure_test_call_inter_msg_interval(int argc, char **argv) int congure_test_call_inter_msg_interval(int argc, char **argv)
{ {
congure_test_snd_t *c = congure_test_get_state(); congure_test_snd_t *c = congure_test_get_state();
@ -129,6 +139,10 @@ int congure_test_call_inter_msg_interval(int argc, char **argv)
return 0; return 0;
} }
SHELL_COMMAND(cong_imi,
"Calls inter_message_interval method of the CongURE state object",
congure_test_call_inter_msg_interval);
int congure_test_add_msg(int argc, char **argv) int congure_test_add_msg(int argc, char **argv)
{ {
uint32_t tmp; uint32_t tmp;
@ -169,6 +183,11 @@ int congure_test_add_msg(int argc, char **argv)
return 0; return 0;
} }
SHELL_COMMAND(cong_add_msg,
"Adds a message to the list of messages to be reported with "
"report_msgs_lost or report_msgs_timeout",
congure_test_add_msg);
int congure_test_msgs_reset(int argc, char **argv) int congure_test_msgs_reset(int argc, char **argv)
{ {
(void)argc; (void)argc;
@ -179,6 +198,11 @@ int congure_test_msgs_reset(int argc, char **argv)
return 0; return 0;
} }
SHELL_COMMAND(cong_msgs_reset,
"Resets the list of messages to be reported with report_msgs_lost or "
"report_msgs_timeout",
congure_test_msgs_reset);
static int _call_report_msg_sent(int argc, char **argv) static int _call_report_msg_sent(int argc, char **argv)
{ {
congure_test_snd_t *c = congure_test_get_state(); congure_test_snd_t *c = congure_test_get_state();
@ -364,4 +388,8 @@ int congure_test_call_report(int argc, char **argv)
return 1; return 1;
} }
SHELL_COMMAND(cong_report,
"Calls a report_* method of the CongURE state object",
congure_test_call_report);
/** @} */ /** @} */

View File

@ -1,51 +0,0 @@
/*
* Copyright (C) 2010 Kaspar Schleiser <kaspar@schleiser.de>
*
* 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.
*/
/**
* @defgroup sys_shell_commands Shell commands
* @ingroup sys
*
* @{
*
* @file
* @brief Shell command definitions
*
* @author Kaspar Schleiser <kaspar@schleiser.de>
*/
#ifndef SHELL_COMMANDS_H
#define SHELL_COMMANDS_H
#include "shell.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @name Disk manipulation command names
* @{
*/
#define DISK_GET_SECTOR_SIZE "dget_ssize"
#define DISK_GET_SECTOR_COUNT "dget_scount"
#define DISK_GET_BLOCK_SIZE "dget_bsize"
#define DISK_READ_SECTOR_CMD "dread_sec"
#define DISK_READ_BYTES_CMD "dread"
/** @} */
/**
* @brief List of shell commands
*/
extern const shell_command_t _shell_command_list[];
#ifdef __cplusplus
}
#endif
#endif /* SHELL_COMMANDS_H */
/** @} */

View File

@ -1,6 +1,6 @@
MODULE = shell_commands MODULE = shell_commands
SRC = shell_commands.c sc_sys.c SRC = sc_sys.c
ifneq (,$(filter app_metadata,$(USEMODULE))) ifneq (,$(filter app_metadata,$(USEMODULE)))
SRC += sc_app_metadata.c SRC += sc_app_metadata.c

View File

@ -19,6 +19,7 @@
*/ */
#include "app_metadata.h" #include "app_metadata.h"
#include "shell.h"
int _app_metadata_handler(int argc, char **argv) int _app_metadata_handler(int argc, char **argv)
{ {
@ -27,3 +28,5 @@ int _app_metadata_handler(int argc, char **argv)
app_metadata_print_json(); app_metadata_print_json();
return 0; return 0;
} }
SHELL_COMMAND(app_metadata, "Returns application metadata", _app_metadata_handler);

View File

@ -22,7 +22,9 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdbool.h> #include <stdbool.h>
#include "at30tse75x.h" #include "at30tse75x.h"
#include "shell.h"
#ifdef MODULE_AT30TSE75X #ifdef MODULE_AT30TSE75X
@ -157,4 +159,6 @@ int _at30tse75x_handler(int argc, char **argv)
return 0; return 0;
} }
SHELL_COMMAND(at30tse75x, "Test AT30TSE75X temperature sensor", _at30tse75x_handler);
#endif /* MODULE_AT30TSE75X */ #endif /* MODULE_AT30TSE75X */

View File

@ -63,4 +63,6 @@ usage:
printf("usage: %s [start|stop|config] <server> <port>\n", argv[0]); printf("usage: %s [start|stop|config] <server> <port>\n", argv[0]);
return -1; return -1;
} }
SHELL_COMMAND(bench_udp, "UDP benchmark", _benchmark_udp_handler);
/** @} */ /** @} */

View File

@ -18,6 +18,7 @@
#include <string.h> #include <string.h>
#include "net/gnrc/ipv6/blacklist.h" #include "net/gnrc/ipv6/blacklist.h"
#include "shell.h"
static void _usage(char *cmd) static void _usage(char *cmd)
{ {
@ -60,4 +61,8 @@ int _blacklist(int argc, char **argv)
return 0; return 0;
} }
SHELL_COMMAND(blacklist,
"blacklists an address for receival ('blacklist [add|del|help]')",
_blacklist);
/** @} */ /** @} */

View File

@ -25,7 +25,7 @@
#include "can/conn/raw.h" #include "can/conn/raw.h"
#include "can/raw.h" #include "can/raw.h"
#include "shell.h"
#include "timex.h" #include "timex.h"
#define SC_CAN_MAX_FILTERS 10 #define SC_CAN_MAX_FILTERS 10
@ -183,3 +183,5 @@ int _can_handler(int argc, char **argv)
} }
return 0; return 0;
} }
SHELL_COMMAND(can, "CAN commands", _can_handler);

View File

@ -20,11 +20,12 @@
#include <string.h> #include <string.h>
#include "random.h"
#include "sched.h"
#include "net/gnrc/netif.h"
#include "ccn-lite-riot.h" #include "ccn-lite-riot.h"
#include "ccnl-pkt-ndntlv.h" #include "ccnl-pkt-ndntlv.h"
#include "net/gnrc/netif.h"
#include "random.h"
#include "sched.h"
#include "shell.h"
#define BUF_SIZE (64) #define BUF_SIZE (64)
@ -73,6 +74,8 @@ int _ccnl_open(int argc, char **argv)
return 0; return 0;
} }
SHELL_COMMAND(ccnl_open, "opens an interface or socket", _ccnl_open);
static void _content_usage(char *argv) static void _content_usage(char *argv)
{ {
printf("usage: %s [URI] [content]\n" printf("usage: %s [URI] [content]\n"
@ -142,6 +145,9 @@ int _ccnl_content(int argc, char **argv)
return 0; return 0;
} }
SHELL_COMMAND(ccnl_cs, "shows CS or creates content and populates it",
_ccnl_content);
static struct ccnl_face_s *_intern_face_get(char *addr_str) static struct ccnl_face_s *_intern_face_get(char *addr_str)
{ {
/* initialize address with 0xFF for broadcast */ /* initialize address with 0xFF for broadcast */
@ -219,6 +225,8 @@ int _ccnl_interest(int argc, char **argv)
return res; return res;
} }
SHELL_COMMAND(ccnl_int, "sends an interest", _ccnl_interest);
static void _ccnl_fib_usage(char *argv) static void _ccnl_fib_usage(char *argv)
{ {
printf("usage: %s [<action> <options>]\n" printf("usage: %s [<action> <options>]\n"
@ -272,3 +280,5 @@ int _ccnl_fib(int argc, char **argv)
} }
return 0; return 0;
} }
SHELL_COMMAND(ccnl_fib, "shows or modifies the CCN-Lite FIB", _ccnl_fib);

View File

@ -21,11 +21,12 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "net/cord/config.h"
#include "net/cord/ep.h" #include "net/cord/ep.h"
#include "net/gnrc/netif.h" #include "net/gnrc/netif.h"
#include "net/nanocoap.h" #include "net/nanocoap.h"
#include "net/sock/util.h" #include "net/sock/util.h"
#include "net/cord/config.h" #include "shell.h"
static int make_sock_ep(sock_udp_ep_t *ep, const char *addr) static int make_sock_ep(sock_udp_ep_t *ep, const char *addr)
{ {
@ -132,3 +133,5 @@ int _cord_ep_handler(int argc, char **argv)
return 0; return 0;
} }
SHELL_COMMAND(cord_ep, "Resource directory endpoint commands", _cord_ep_handler);

View File

@ -19,7 +19,9 @@
*/ */
#include <stdio.h> #include <stdio.h>
#include <stdint.h> #include <stdint.h>
#include "cryptoauthlib.h" #include "cryptoauthlib.h"
#include "shell.h"
void get_bin(char *result, uint8_t byte) void get_bin(char *result, uint8_t byte)
{ {
@ -237,3 +239,6 @@ int _cryptoauth(int argc, char **argv)
} }
return 0; return 0;
} }
SHELL_COMMAND(cryptoauth, "Commands for Microchip CryptoAuth devices",
_cryptoauth);

View File

@ -26,6 +26,7 @@
#include "dfplayer.h" #include "dfplayer.h"
#include "dfplayer_internal.h" #include "dfplayer_internal.h"
#include "fmt.h" #include "fmt.h"
#include "shell.h"
static const char *_equalizers[] = { static const char *_equalizers[] = {
[DFPLAYER_EQ_NORMAL] = "normal", [DFPLAYER_EQ_NORMAL] = "normal",
@ -305,7 +306,7 @@ static void _print_help(const char *progname)
); );
} }
int _sc_dfplayer(int argc, char **argv) static int _sc_dfplayer(int argc, char **argv)
{ {
unsigned dev_num = 0; unsigned dev_num = 0;
int pos = 1; int pos = 1;
@ -619,3 +620,5 @@ int _sc_dfplayer(int argc, char **argv)
_print_help(argv[0]); _print_help(argv[0]);
return 1; return 1;
} }
SHELL_COMMAND(dfplayer, "Control a DFPlayer Mini MP3 player", _sc_dfplayer);

View File

@ -22,8 +22,8 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include "shell_commands.h"
#include "diskio.h" #include "diskio.h"
#include "shell.h"
static inline uint8_t sector_read(unsigned char *read_buf, unsigned long sector, unsigned long length, unsigned long offset) static inline uint8_t sector_read(unsigned char *read_buf, unsigned long sector, unsigned long length, unsigned long offset)
{ {
@ -63,6 +63,8 @@ int _get_sectorsize(int argc, char **argv)
} }
} }
SHELL_COMMAND(dget_ssize, "Get the sector size of inserted memory card", _get_sectorsize);
int _get_blocksize(int argc, char **argv) int _get_blocksize(int argc, char **argv)
{ {
(void) argc; (void) argc;
@ -81,6 +83,8 @@ int _get_blocksize(int argc, char **argv)
} }
} }
SHELL_COMMAND(dget_bsize, "Get the block size of inserted memory card", _get_blocksize);
int _get_sectorcount(int argc, char **argv) int _get_sectorcount(int argc, char **argv)
{ {
(void) argc; (void) argc;
@ -99,6 +103,8 @@ int _get_sectorcount(int argc, char **argv)
} }
} }
SHELL_COMMAND(dget_scount, "Get the sector count of inserted memory card", _get_sectorcount);
int _read_sector(int argc, char **argv) int _read_sector(int argc, char **argv)
{ {
if (argc == 2) { if (argc == 2) {
@ -124,6 +130,8 @@ int _read_sector(int argc, char **argv)
} }
} }
SHELL_COMMAND(dread_sec, "Reads the specified sector of inserted memory card", _read_sector);
int _read_bytes(int argc, char **argv) int _read_bytes(int argc, char **argv)
{ {
unsigned long sector = 1, scount, offset; unsigned long sector = 1, scount, offset;
@ -173,3 +181,5 @@ int _read_bytes(int argc, char **argv)
return 1; return 1;
} }
SHELL_COMMAND(dread, "Reads the specified bytes from inserted memory card", _read_bytes);

View File

@ -19,15 +19,17 @@
*/ */
#include <arpa/inet.h> #include <arpa/inet.h>
#include <stdio.h>
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "thread.h" #include <string.h>
#include "net/af.h" #include "net/af.h"
#include "net/gnrc/netif.h"
#include "net/fib.h" #include "net/fib.h"
#include "net/gnrc/ipv6.h" #include "net/gnrc/ipv6.h"
#include "net/gnrc/netif.h"
#include "shell.h"
#include "thread.h"
#define INFO1_TXT "fibroute add <destination> via <next hop> [dev <device>]" #define INFO1_TXT "fibroute add <destination> via <next hop> [dev <device>]"
#define INFO2_TXT " [lifetime <lifetime>]" #define INFO2_TXT " [lifetime <lifetime>]"
@ -252,3 +254,5 @@ int _fib_route_handler(int argc, char **argv)
puts("\nunrecognized parameters.\nPlease enter fibroute [add|del] for more information."); puts("\nunrecognized parameters.\nPlease enter fibroute [add|del] for more information.");
return 1; return 1;
} }
SHELL_COMMAND(fibroute, "Manipulate the FIB (info: 'fibroute [add|del]')", _fib_route_handler);

View File

@ -20,9 +20,10 @@
#include <string.h> #include <string.h>
#include "kernel_defines.h" #include "kernel_defines.h"
#include "net/ipv6/addr.h"
#include "net/gnrc/sixlowpan/ctx.h" #include "net/gnrc/sixlowpan/ctx.h"
#include "net/ipv6/addr.h"
#include "net/sixlowpan/nd.h" #include "net/sixlowpan/nd.h"
#include "shell.h"
#include "timex.h" #include "timex.h"
#if IS_USED(MODULE_ZTIMER_MSEC) #if IS_USED(MODULE_ZTIMER_MSEC)
@ -164,4 +165,6 @@ int _gnrc_6ctx(int argc, char **argv)
return 0; return 0;
} }
SHELL_COMMAND(6ctx, "6LoWPAN context configuration tool", _gnrc_6ctx);
/** @} */ /** @} */

View File

@ -16,6 +16,7 @@
#include <stdio.h> #include <stdio.h>
#include "net/gnrc/sixlowpan/frag/stats.h" #include "net/gnrc/sixlowpan/frag/stats.h"
#include "shell.h"
#ifdef MODULE_GNRC_SIXLOWPAN_FRAG_SFR_STATS #ifdef MODULE_GNRC_SIXLOWPAN_FRAG_SFR_STATS
#include "net/gnrc/sixlowpan/frag/sfr.h" #include "net/gnrc/sixlowpan/frag/sfr.h"
#endif #endif
@ -54,4 +55,6 @@ int _gnrc_6lo_frag_stats(int argc, char **argv)
return 0; return 0;
} }
SHELL_COMMAND(6lo_frag, "6LoWPAN fragment statistics", _gnrc_6lo_frag_stats);
/** @} */ /** @} */

View File

@ -27,24 +27,26 @@
#include "bitfield.h" #include "bitfield.h"
#include "byteorder.h" #include "byteorder.h"
#include "sched.h"
#ifdef MODULE_LUID
#include "luid.h"
#endif
#include "msg.h" #include "msg.h"
#include "net/gnrc.h" #include "net/gnrc.h"
#include "net/gnrc/icmpv6.h" #include "net/gnrc/icmpv6.h"
#ifdef MODULE_GNRC_IPV6_NIB
#include "net/gnrc/ipv6/nib/nc.h"
#endif
#include "net/icmpv6.h" #include "net/icmpv6.h"
#include "net/ipv6.h" #include "net/ipv6.h"
#include "net/utils.h" #include "net/utils.h"
#include "sched.h"
#include "shell.h"
#include "timex.h" #include "timex.h"
#include "unaligned.h" #include "unaligned.h"
#include "utlist.h" #include "utlist.h"
#include "xtimer.h" #include "xtimer.h"
#ifdef MODULE_LUID
#include "luid.h"
#endif
#ifdef MODULE_GNRC_IPV6_NIB
#include "net/gnrc/ipv6/nib/nc.h"
#endif
#define _SEND_NEXT_PING (0xEF48) #define _SEND_NEXT_PING (0xEF48)
#define _PING_FINISH (0xEF49) #define _PING_FINISH (0xEF49)
@ -144,6 +146,9 @@ finish:
return res; return res;
} }
SHELL_COMMAND(ping6, "Ping via ICMPv6", _gnrc_icmpv6_ping);
SHELL_COMMAND(ping, "Alias for ping6", _gnrc_icmpv6_ping);
static void _usage(char *cmdname) static void _usage(char *cmdname)
{ {
printf("%s [-c <count>] [-h] [-i <ms interval>] [-s <packetsize>]\n", printf("%s [-c <count>] [-h] [-i <ms interval>] [-s <packetsize>]\n",

View File

@ -14,7 +14,9 @@
*/ */
#include <stdio.h> #include <stdio.h>
#include "net/gnrc/ipv6/ext/frag.h" #include "net/gnrc/ipv6/ext/frag.h"
#include "shell.h"
int _gnrc_ipv6_frag_stats(int argc, char **argv) int _gnrc_ipv6_frag_stats(int argc, char **argv)
{ {
@ -31,4 +33,6 @@ int _gnrc_ipv6_frag_stats(int argc, char **argv)
return 0; return 0;
} }
SHELL_COMMAND(ip6_frag, "IPv6 fragmentation statistics", _gnrc_ipv6_frag_stats);
/** @} */ /** @} */

View File

@ -14,12 +14,12 @@
*/ */
#include <stdio.h> #include <stdio.h>
#include <kernel_defines.h>
#include "kernel_defines.h"
#include "net/gnrc/ipv6/nib.h" #include "net/gnrc/ipv6/nib.h"
#include "net/gnrc/netif.h" #include "net/gnrc/netif.h"
#include "net/ipv6/addr.h" #include "net/ipv6/addr.h"
#include "shell.h"
#include "timex.h" #include "timex.h"
static void _usage(char **argv); static void _usage(char **argv);
@ -58,6 +58,8 @@ int _gnrc_ipv6_nib(int argc, char **argv)
return res; return res;
} }
SHELL_COMMAND(nib, "Configure neighbor information base", _gnrc_ipv6_nib);
static void _usage(char **argv) static void _usage(char **argv)
{ {
#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) #if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C)

View File

@ -24,14 +24,15 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "net/netif.h" #include "fmt.h"
#include "net/ipv6/addr.h"
#include "net/gnrc.h" #include "net/gnrc.h"
#include "net/gnrc/netif.h" #include "net/gnrc/netif.h"
#include "net/gnrc/netif/hdr.h" #include "net/gnrc/netif/hdr.h"
#include "net/ipv6/addr.h"
#include "net/lora.h" #include "net/lora.h"
#include "net/loramac.h" #include "net/loramac.h"
#include "fmt.h" #include "net/netif.h"
#include "shell.h"
#ifdef MODULE_NETSTATS #ifdef MODULE_NETSTATS
#include "net/netstats.h" #include "net/netstats.h"
@ -1781,6 +1782,8 @@ int _gnrc_netif_send(int argc, char **argv)
return 0; return 0;
} }
SHELL_COMMAND(txtsnd, "Sends a custom string as is over the link layer", _gnrc_netif_send);
#endif #endif
int _gnrc_netif_config(int argc, char **argv) int _gnrc_netif_config(int argc, char **argv)
@ -1905,3 +1908,5 @@ int _gnrc_netif_config(int argc, char **argv)
_usage(argv[0]); _usage(argv[0]);
return 1; return 1;
} }
SHELL_COMMAND(ifconfig, "Configure network interfaces", _gnrc_netif_config);

View File

@ -14,6 +14,7 @@
*/ */
#include "net/gnrc/pktbuf.h" #include "net/gnrc/pktbuf.h"
#include "shell.h"
int _gnrc_pktbuf_cmd(int argc, char **argv) int _gnrc_pktbuf_cmd(int argc, char **argv)
{ {
@ -23,4 +24,6 @@ int _gnrc_pktbuf_cmd(int argc, char **argv)
return 0; return 0;
} }
SHELL_COMMAND(pktbuf, "prints internal stats of the packet buffer", _gnrc_pktbuf_cmd);
/** @} */ /** @} */

View File

@ -18,12 +18,14 @@
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include "net/gnrc/netif.h" #include "net/gnrc/netif.h"
#include "net/gnrc/rpl.h" #include "net/gnrc/rpl.h"
#include "net/gnrc/rpl/structs.h"
#include "net/gnrc/rpl/dodag.h" #include "net/gnrc/rpl/dodag.h"
#include "utlist.h" #include "net/gnrc/rpl/structs.h"
#include "shell.h"
#include "trickle.h" #include "trickle.h"
#include "utlist.h"
#ifdef MODULE_GNRC_RPL_P2P #ifdef MODULE_GNRC_RPL_P2P
#include "net/gnrc/rpl/p2p.h" #include "net/gnrc/rpl/p2p.h"
#include "net/gnrc/rpl/p2p_dodag.h" #include "net/gnrc/rpl/p2p_dodag.h"
@ -453,6 +455,8 @@ int _gnrc_rpl(int argc, char **argv)
puts("* show\t\t\t\t\t- show instance and dodag tables"); puts("* show\t\t\t\t\t- show instance and dodag tables");
return 0; return 0;
} }
SHELL_COMMAND(rpl, "rpl configuration tool ('rpl help' for more information)", _gnrc_rpl);
/** /**
* @} * @}
*/ */

View File

@ -26,9 +26,10 @@
#include "net/gnrc/ipv6.h" #include "net/gnrc/ipv6.h"
#include "net/gnrc/netif.h" #include "net/gnrc/netif.h"
#include "net/gnrc/netif/hdr.h" #include "net/gnrc/netif/hdr.h"
#include "net/gnrc/udp.h"
#include "net/gnrc/pktdump.h" #include "net/gnrc/pktdump.h"
#include "net/gnrc/udp.h"
#include "net/utils.h" #include "net/utils.h"
#include "shell.h"
#include "timex.h" #include "timex.h"
#include "utlist.h" #include "utlist.h"
#if IS_USED(MODULE_ZTIMER_USEC) || IS_USED(MODULE_ZTIMER_MSEC) #if IS_USED(MODULE_ZTIMER_USEC) || IS_USED(MODULE_ZTIMER_MSEC)
@ -203,3 +204,5 @@ int _gnrc_udp_cmd(int argc, char **argv)
} }
return 0; return 0;
} }
SHELL_COMMAND(udp, "send data over UDP and listen on UDP ports", _gnrc_udp_cmd);

View File

@ -19,6 +19,7 @@
*/ */
#include "cpu_conf.h" #include "cpu_conf.h"
#include "shell.h"
#if defined(MODULE_NEWLIB_SYSCALLS_DEFAULT) || defined (HAVE_HEAP_STATS) #if defined(MODULE_NEWLIB_SYSCALLS_DEFAULT) || defined (HAVE_HEAP_STATS)
extern void heap_stats(void); extern void heap_stats(void);
@ -39,3 +40,5 @@ int _heap_handler(int argc, char **argv)
return 1; return 1;
#endif #endif
} }
SHELL_COMMAND(heap, "Prints heap statistics.", _heap_handler);

View File

@ -26,6 +26,7 @@
#include "board.h" #include "board.h"
#include "periph/i2c.h" #include "periph/i2c.h"
#include "shell.h"
static int get_dev(i2c_t *dev, int argc, char **argv) static int get_dev(i2c_t *dev, int argc, char **argv)
{ {
@ -107,3 +108,5 @@ int _i2c_scan(int argc, char **argv)
i2c_release(dev); i2c_release(dev);
return 0; return 0;
} }
SHELL_COMMAND(i2c_scan, "Performs an I2C bus scan", _i2c_scan);

View File

@ -21,11 +21,10 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "shell.h"
#include "fmt.h" #include "fmt.h"
#include "net/loramac.h" #include "net/loramac.h"
#include "semtech_loramac.h" #include "semtech_loramac.h"
#include "shell.h"
extern semtech_loramac_t loramac; extern semtech_loramac_t loramac;
@ -512,3 +511,5 @@ int _loramac_handler(int argc, char **argv)
return 0; return 0;
} }
SHELL_COMMAND(loramac, "Control Semtech loramac stack", _loramac_handler);

View File

@ -20,9 +20,11 @@
#include <kernel_defines.h> #include <kernel_defines.h>
#include <stdio.h> #include <stdio.h>
#include "lwip/netif/compat.h" #include "lwip/netif/compat.h"
#include "net/netdev.h" #include "net/netdev.h"
#include "net/netopt.h" #include "net/netopt.h"
#include "shell.h"
#ifdef MODULE_LWIP_IPV6 #ifdef MODULE_LWIP_IPV6
static void _netif_list_ipv6(struct netif *netif, int addr_index) { static void _netif_list_ipv6(struct netif *netif, int addr_index) {
@ -102,3 +104,5 @@ int _lwip_netif_config(int argc, char **argv)
printf("%s takes no arguments.\n", argv[0]); printf("%s takes no arguments.\n", argv[0]);
return 1; return 1;
} }
SHELL_COMMAND(ifconfig, "List network interfaces", _lwip_netif_config);

View File

@ -23,9 +23,10 @@
#include <string.h> #include <string.h>
#include <inttypes.h> #include <inttypes.h>
#include "vfs_default.h"
#include "net/nanocoap_vfs.h"
#include "net/nanocoap_sock.h" #include "net/nanocoap_sock.h"
#include "net/nanocoap_vfs.h"
#include "shell.h"
#include "vfs_default.h"
struct dir_list_ctx { struct dir_list_ctx {
char *buf; char *buf;
@ -137,3 +138,5 @@ int _nanocoap_get_handler(int argc, char **argv)
} }
return res; return res;
} }
SHELL_COMMAND(ncget, "download a file from a CoAP server", _nanocoap_get_handler);

View File

@ -24,6 +24,7 @@
#include "net/gnrc/netif.h" #include "net/gnrc/netif.h"
#include "net/netstats.h" #include "net/netstats.h"
#include "net/netstats/neighbor.h" #include "net/netstats/neighbor.h"
#include "shell.h"
static void _print_neighbors(netif_t *dev) static void _print_neighbors(netif_t *dev)
{ {
@ -100,3 +101,5 @@ int _netstats_nb(int argc, char **argv)
return 0; return 0;
} }
SHELL_COMMAND(neigh, "Show neighbor statistics", _netstats_nb);

View File

@ -24,6 +24,7 @@
#include <stdlib.h> #include <stdlib.h>
#include "sched.h" #include "sched.h"
#include "shell.h"
#include "thread.h" #include "thread.h"
int _sc_nice(int argc, char **argv) int _sc_nice(int argc, char **argv)
@ -51,3 +52,5 @@ int _sc_nice(int argc, char **argv)
sched_change_priority(thread, prio); sched_change_priority(thread, prio);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
SHELL_COMMAND(nice, "Change priority of an active thread", _sc_nice);

View File

@ -24,12 +24,13 @@
#include <stdbool.h> #include <stdbool.h>
#include "fmt.h" #include "fmt.h"
#include "ztimer.h"
#include "nimble_riot.h"
#include "nimble_netif.h"
#include "nimble_netif_conn.h"
#include "net/bluetil/ad.h" #include "net/bluetil/ad.h"
#include "net/bluetil/addr.h" #include "net/bluetil/addr.h"
#include "nimble_netif.h"
#include "nimble_netif_conn.h"
#include "nimble_riot.h"
#include "shell.h"
#include "ztimer.h"
#define FULL_CONTROL !IS_USED(MODULE_NIMBLE_AUTOCONN) && \ #define FULL_CONTROL !IS_USED(MODULE_NIMBLE_AUTOCONN) && \
!IS_USED(MODULE_NIMBLE_STATCONN) && \ !IS_USED(MODULE_NIMBLE_STATCONN) && \
@ -627,3 +628,5 @@ int _nimble_netif_handler(int argc, char **argv)
return 0; return 0;
} }
SHELL_COMMAND(ble, "Manage BLE connections for NimBLE", _nimble_netif_handler);

View File

@ -23,7 +23,7 @@
#include "net/bluetil/addr.h" #include "net/bluetil/addr.h"
#include "nimble_statconn.h" #include "nimble_statconn.h"
#include "shell.h"
static uint8_t _parsephy(const char *phy_str) static uint8_t _parsephy(const char *phy_str)
{ {
@ -104,3 +104,5 @@ int _nimble_statconn_handler(int argc, char **argv)
return 0; return 0;
} }
SHELL_COMMAND(statconn, "NimBLE netif statconn", _nimble_statconn_handler);

View File

@ -187,6 +187,8 @@ int _openwsn_ifconfig(int argc, char **argv)
return 0; return 0;
} }
SHELL_COMMAND(ifconfig, "Shows assigned IPv6 addresses", _openwsn_ifconfig);
static int _neighbors_cmd(char *arg) static int _neighbors_cmd(char *arg)
{ {
(void)arg; (void)arg;
@ -610,3 +612,5 @@ int _openwsn_handler(int argc, char **argv)
_print_usage(); _print_usage();
return -1; return -1;
} }
SHELL_COMMAND(openwsn, "OpenWSN commands", _openwsn_handler);

View File

@ -23,7 +23,9 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "periph/pm.h" #include "periph/pm.h"
#include "shell.h"
#ifdef MODULE_PM_LAYERED #ifdef MODULE_PM_LAYERED
#include "pm_layered.h" #include "pm_layered.h"
@ -196,3 +198,5 @@ int _pm_handler(int argc, char **argv)
_print_usage(); _print_usage();
return 1; return 1;
} }
SHELL_COMMAND(pm, "interact with layered PM subsystem", _pm_handler);

View File

@ -19,6 +19,7 @@
*/ */
#include "ps.h" #include "ps.h"
#include "shell.h"
int _ps_handler(int argc, char **argv) int _ps_handler(int argc, char **argv)
{ {
@ -29,3 +30,5 @@ int _ps_handler(int argc, char **argv)
return 0; return 0;
} }
SHELL_COMMAND(ps, "Prints information about running threads.", _ps_handler);

View File

@ -24,12 +24,13 @@
#include <string.h> #include <string.h>
#include <inttypes.h> #include <inttypes.h>
#include "random.h"
#include "shell.h"
#ifdef MODULE_XTIMER #ifdef MODULE_XTIMER
#include "xtimer.h" #include "xtimer.h"
#endif #endif
#include "random.h"
int _random_init(int argc, char **argv) int _random_init(int argc, char **argv)
{ {
int initval; int initval;
@ -55,6 +56,8 @@ int _random_init(int argc, char **argv)
return 0; return 0;
} }
SHELL_COMMAND(random_init, "initializes the PRNG", _random_init);
int _random_get(int argc, char **argv) int _random_get(int argc, char **argv)
{ {
(void) argc; (void) argc;
@ -64,3 +67,5 @@ int _random_get(int argc, char **argv)
return 0; return 0;
} }
SHELL_COMMAND(random_get, "returns 32 bit of pseudo randomness", _random_get);

View File

@ -26,6 +26,7 @@
#include <stdlib.h> #include <stdlib.h>
#include "periph/rtc.h" #include "periph/rtc.h"
#include "shell.h"
static void _alarm_handler(void *arg) static void _alarm_handler(void *arg)
{ {
@ -182,3 +183,5 @@ int _rtc_handler(int argc, char **argv)
} }
return 0; return 0;
} }
SHELL_COMMAND(rtc, "control RTC peripheral interface", _rtc_handler);

View File

@ -25,6 +25,7 @@
#include <inttypes.h> #include <inttypes.h>
#include "periph/rtt.h" #include "periph/rtt.h"
#include "shell.h"
/* /*
* Since some RTT implementations do not implement all API functions, default * Since some RTT implementations do not implement all API functions, default
@ -192,3 +193,5 @@ int _rtt_handler(int argc, char **argv)
} }
return 0; return 0;
} }
SHELL_COMMAND(rtt, "control RTT peripheral interface", _rtt_handler);

View File

@ -25,6 +25,7 @@
#include <stdlib.h> #include <stdlib.h>
#include "saul_reg.h" #include "saul_reg.h"
#include "shell.h"
static const char *_devname(saul_reg_t *dev) { static const char *_devname(saul_reg_t *dev) {
if (dev->name == NULL) { if (dev->name == NULL) {
@ -162,3 +163,5 @@ int _saul(int argc, char **argv)
} }
return 0; return 0;
} }
SHELL_COMMAND(saul, "interact with sensors and actuators using SAUL", _saul);

View File

@ -20,10 +20,13 @@
* @} * @}
*/ */
#include <stdio.h> #include <errno.h>
#include <stdint.h> #include <stdint.h>
#include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "shell.h"
#include "sht1x.h" #include "sht1x.h"
#include "sht1x_params.h" #include "sht1x_params.h"
@ -102,6 +105,8 @@ int _get_humidity_handler(int argc, char **argv)
return 0; return 0;
} }
SHELL_COMMAND(hum, "Prints measured humidity.", _get_humidity_handler);
int _get_temperature_handler(int argc, char **argv) int _get_temperature_handler(int argc, char **argv)
{ {
int16_t temp; int16_t temp;
@ -114,6 +119,8 @@ int _get_temperature_handler(int argc, char **argv)
return 0; return 0;
} }
SHELL_COMMAND(temp, "Prints measured temperature.", _get_temperature_handler);
int _get_weather_handler(int argc, char **argv) int _get_weather_handler(int argc, char **argv)
{ {
int16_t hum; int16_t hum;
@ -128,6 +135,8 @@ int _get_weather_handler(int argc, char **argv)
return 0; return 0;
} }
SHELL_COMMAND(weather, "Prints measured humidity and temperature.", _get_weather_handler);
static void print_config(const sht1x_dev_t *dev) static void print_config(const sht1x_dev_t *dev)
{ {
const char *vdds[] = { "5.0", "4.0", "3.5", "3.0", "2.5" }; const char *vdds[] = { "5.0", "4.0", "3.5", "3.0", "2.5" };
@ -372,3 +381,5 @@ int _sht_config_handler(int argc, char **argv)
print_config(&sht1x_devs[dev_num]); print_config(&sht1x_devs[dev_num]);
return 0; return 0;
} }
SHELL_COMMAND(sht_config, "Get/set SHT10/11/15 sensor configuration.", _sht_config_handler);

View File

@ -21,11 +21,12 @@
#include <stdio.h> #include <stdio.h>
#include <time.h> #include <time.h>
#include "net/sntp.h"
#include "net/ntp_packet.h"
#include "net/af.h" #include "net/af.h"
#include "net/gnrc/netif.h" #include "net/gnrc/netif.h"
#include "net/ipv6/addr.h" #include "net/ipv6/addr.h"
#include "net/ntp_packet.h"
#include "net/sntp.h"
#include "shell.h"
#include "timex.h" #include "timex.h"
#define _DEFAULT_TIMEOUT (500000LU) #define _DEFAULT_TIMEOUT (500000LU)
@ -101,3 +102,5 @@ int _ntpdate(int argc, char **argv)
#endif #endif
return 0; return 0;
} }
SHELL_COMMAND(ntpdate, "synchronizes with a remote time server", _ntpdate);

View File

@ -22,8 +22,9 @@
#include <string.h> #include <string.h>
#include <inttypes.h> #include <inttypes.h>
#include "suit/transport/coap.h" #include "shell.h"
#include "suit/storage.h" #include "suit/storage.h"
#include "suit/transport/coap.h"
static void _print_usage(char **argv) static void _print_usage(char **argv)
{ {
@ -53,3 +54,5 @@ int _suit_handler(int argc, char **argv)
return 0; return 0;
} }
SHELL_COMMAND(suit, "Trigger a SUIT firmware update", _suit_handler);

View File

@ -21,6 +21,7 @@
#include <stdio.h> #include <stdio.h>
#include "periph/pm.h" #include "periph/pm.h"
#include "shell.h"
#ifdef MODULE_USB_BOARD_RESET #ifdef MODULE_USB_BOARD_RESET
#include "usb_board_reset.h" #include "usb_board_reset.h"
@ -36,6 +37,8 @@ int _reboot_handler(int argc, char **argv)
return 0; return 0;
} }
SHELL_COMMAND(reboot, "Reboot the node", _reboot_handler);
#ifdef MODULE_USB_BOARD_RESET #ifdef MODULE_USB_BOARD_RESET
int _bootloader_handler(int argc, char **argv) int _bootloader_handler(int argc, char **argv)
{ {
@ -46,6 +49,8 @@ int _bootloader_handler(int argc, char **argv)
return 0; return 0;
} }
SHELL_COMMAND(bootloader, "Reboot to bootloader", _bootloader_handler);
#endif #endif
int _version_handler(int argc, char **argv) int _version_handler(int argc, char **argv)
@ -57,3 +62,5 @@ int _version_handler(int argc, char **argv)
return 0; return 0;
} }
SHELL_COMMAND(version, "Prints current RIOT_VERSION", _version_handler);

View File

@ -29,6 +29,7 @@
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include "shell.h"
#include "vfs.h" #include "vfs.h"
#if MODULE_VFS_UTIL #if MODULE_VFS_UTIL
#include "vfs_util.h" #include "vfs_util.h"
@ -659,6 +660,8 @@ int _ls_handler(int argc, char **argv)
return ret; return ret;
} }
SHELL_COMMAND(ls, "list files", _ls_handler);
int _vfs_handler(int argc, char **argv) int _vfs_handler(int argc, char **argv)
{ {
if (argc < 2) { if (argc < 2) {
@ -705,6 +708,8 @@ int _vfs_handler(int argc, char **argv)
} }
} }
SHELL_COMMAND(vfs, "virtual file system operations", _vfs_handler);
static inline void _print_digest(const uint8_t *digest, size_t len, const char *file) static inline void _print_digest(const uint8_t *digest, size_t len, const char *file)
{ {
for (unsigned i = 0; i < len; ++i) { for (unsigned i = 0; i < len; ++i) {
@ -738,6 +743,8 @@ int _vfs_md5sum_cmd(int argc, char **argv)
return 0; return 0;
} }
SHELL_COMMAND(md5sum, "Compute and check MD5 message digest", _vfs_md5sum_cmd);
#endif #endif
#if MODULE_SHA1SUM #if MODULE_SHA1SUM
@ -765,6 +772,8 @@ int _vfs_sha1sum_cmd(int argc, char **argv)
return 0; return 0;
} }
SHELL_COMMAND(sha1sum, "Compute and check SHA1 message digest", _vfs_sha1sum_cmd);
#endif #endif
#if MODULE_SHA256SUM #if MODULE_SHA256SUM
@ -792,5 +801,7 @@ int _vfs_sha256sum_cmd(int argc, char **argv)
return 0; return 0;
} }
SHELL_COMMAND(sha256sum, "Compute and check SHA256 message digest", _vfs_sha256sum_cmd);
#endif #endif
#endif #endif

View File

@ -17,6 +17,7 @@
#include <string.h> #include <string.h>
#include "net/gnrc/ipv6/whitelist.h" #include "net/gnrc/ipv6/whitelist.h"
#include "shell.h"
static void _usage(char *cmd) static void _usage(char *cmd)
{ {
@ -59,4 +60,6 @@ int _whitelist(int argc, char **argv)
return 0; return 0;
} }
SHELL_COMMAND(whitelist, "whitelists an address for receival ('whitelist [add|del|help]')", _whitelist);
/** @} */ /** @} */

View File

@ -1,407 +0,0 @@
/*
* Copyright (C) 2014 INRIA.
*
* 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 Provides prototypes and sets up available shell commands
*
* @author Oliver Hahm <oliver.hahm@inria.fr>
* @author Zakaria Kasmi <zkasmi@inf.fu-berlin.de>
* @author Ludwig Knüpfer <ludwig.knuepfer@fu-berlin.de>
*
* @}
*/
#include <stdlib.h>
#include "shell_commands.h"
#ifdef MODULE_CONGURE_TEST
#include "congure/test.h"
#endif
extern int _reboot_handler(int argc, char **argv);
extern int _version_handler(int argc, char **argv);
#ifdef MODULE_DFPLAYER
extern int _sc_dfplayer(int argc, char **argv);
#endif
#ifdef MODULE_HEAP_CMD
extern int _heap_handler(int argc, char **argv);
#endif
#ifdef MODULE_PERIPH_PM
extern int _pm_handler(int argc, char **argv);
#endif
#ifdef MODULE_PS
extern int _ps_handler(int argc, char **argv);
#endif
#ifdef MODULE_SHT1X
extern int _get_temperature_handler(int argc, char **argv);
extern int _get_humidity_handler(int argc, char **argv);
extern int _get_weather_handler(int argc, char **argv);
extern int _sht_config_handler(int argc, char **argv);
#endif
#ifdef MODULE_AT30TSE75X
extern int _at30tse75x_handler(int argc, char **argv);
#endif
#ifdef MODULE_SAUL_REG
extern int _saul(int argc, char **argv);
#endif
#if defined(MODULE_PERIPH_RTC) || defined(MODULE_RTT_RTC)
extern int _rtc_handler(int argc, char **argv);
#endif
#ifdef MODULE_RTT_CMD
extern int _rtt_handler(int argc, char **argv);
#endif
#ifdef MODULE_MCI
extern int _get_sectorsize(int argc, char **argv);
extern int _get_blocksize(int argc, char **argv);
extern int _get_sectorcount(int argc, char **argv);
extern int _read_sector(int argc, char **argv);
extern int _read_bytes(int argc, char **argv);
#endif
#ifdef MODULE_GNRC_ICMPV6_ECHO
#ifdef MODULE_XTIMER
extern int _gnrc_icmpv6_ping(int argc, char **argv);
#endif
#endif
#ifdef MODULE_RANDOM_CMD
extern int _random_init(int argc, char **argv);
extern int _random_get(int argc, char **argv);
#endif
#ifdef MODULE_GNRC_IPV6_NIB
extern int _gnrc_ipv6_nib(int argc, char **argv);
#endif
#ifdef MODULE_NETSTATS_NEIGHBOR
extern int _netstats_nb(int argc, char **argv);
#endif
#ifdef MODULE_GNRC_NETIF
extern int _gnrc_netif_config(int argc, char **argv);
#ifdef MODULE_GNRC_TXTSND
extern int _gnrc_netif_send(int argc, char **argv);
#endif
#endif
#ifdef MODULE_OPENWSN
extern int _openwsn_ifconfig(int argc, char **argv);
extern int _openwsn_handler(int argc, char **argv);
#endif
#ifdef MODULE_LWIP_NETIF
extern int _lwip_netif_config(int argc, char **argv);
#endif
#ifdef MODULE_FIB
extern int _fib_route_handler(int argc, char **argv);
#endif
#ifdef MODULE_GNRC_IPV6_EXT_FRAG_STATS
extern int _gnrc_ipv6_frag_stats(int argc, char **argv);
#endif
#ifdef MODULE_GNRC_IPV6_WHITELIST
extern int _whitelist(int argc, char **argv);
#endif
#ifdef MODULE_GNRC_IPV6_BLACKLIST
extern int _blacklist(int argc, char **argv);
#endif
#ifdef MODULE_GNRC_PKTBUF_CMD
extern int _gnrc_pktbuf_cmd(int argc, char **argv);
#endif
#ifdef MODULE_GNRC_RPL
extern int _gnrc_rpl(int argc, char **argv);
#endif
#ifdef MODULE_GNRC_SIXLOWPAN_CTX
extern int _gnrc_6ctx(int argc, char **argv);
#endif
#ifdef MODULE_GNRC_SIXLOWPAN_FRAG_STATS
extern int _gnrc_6lo_frag_stats(int argc, char **argv);
#endif
#ifdef MODULE_CCN_LITE_UTILS
extern int _ccnl_open(int argc, char **argv);
extern int _ccnl_content(int argc, char **argv);
extern int _ccnl_interest(int argc, char **argv);
extern int _ccnl_fib(int argc, char **argv);
#endif
#ifdef MODULE_SNTP
extern int _ntpdate(int argc, char **argv);
#endif
#ifdef MODULE_VFS
extern int _vfs_handler(int argc, char **argv);
extern int _ls_handler(int argc, char **argv);
#endif
#ifdef MODULE_BENCHMARK_UDP
extern int _benchmark_udp_handler(int argc, char **argv);
#endif
#ifdef MODULE_CONN_CAN
extern int _can_handler(int argc, char **argv);
#endif
#ifdef MODULE_CORD_EP
extern int _cord_ep_handler(int argc, char **argv);
#endif
#ifdef MODULE_APP_METADATA
extern int _app_metadata_handler(int argc, char **argv);
#endif
#ifdef MODULE_I2C_SCAN
extern int _i2c_scan(int argc, char **argv);
#endif
#ifdef MODULE_SEMTECH_LORAMAC
extern int _loramac_handler(int argc, char **argv);
#endif
#ifdef MODULE_NANOCOAP_VFS
extern int _nanocoap_get_handler(int argc, char **argv);
#endif
#ifdef MODULE_NICE
extern int _sc_nice(int argc, char **argv);
#endif
#ifdef MODULE_NIMBLE_NETIF
extern int _nimble_netif_handler(int argc, char **argv);
#endif
#ifdef MODULE_NIMBLE_STATCONN
extern int _nimble_statconn_handler(int argc, char **argv);
#endif
#ifdef MODULE_SUIT_TRANSPORT_WORKER
extern int _suit_handler(int argc, char **argv);
#endif
#ifdef MODULE_CRYPTOAUTHLIB
extern int _cryptoauth(int argc, char **argv);
#endif
#ifdef MODULE_USB_BOARD_RESET
extern int _bootloader_handler(int argc, char **argv);
#endif
#ifdef MODULE_GNRC_UDP_CMD
extern int _gnrc_udp_cmd(int argc, char **argv);
#endif
#ifdef MODULE_MD5SUM
extern int _vfs_md5sum_cmd(int argc, char **argv);
#endif
#ifdef MODULE_SHA1SUM
extern int _vfs_sha1sum_cmd(int argc, char **argv);
#endif
#ifdef MODULE_SHA256SUM
extern int _vfs_sha256sum_cmd(int argc, char **argv);
#endif
const shell_command_t _shell_command_list[] = {
{"reboot", "Reboot the node", _reboot_handler},
{"version", "Prints current RIOT_VERSION", _version_handler},
#ifdef MODULE_USB_BOARD_RESET
{"bootloader", "Reboot to bootloader", _bootloader_handler},
#endif
#ifdef MODULE_BENCHMARK_UDP
{"bench_udp", "UDP benchmark", _benchmark_udp_handler},
#endif
#ifdef MODULE_HEAP_CMD
{"heap", "Prints heap statistics.", _heap_handler},
#endif
#ifdef MODULE_PERIPH_PM
{ "pm", "interact with layered PM subsystem", _pm_handler },
#endif
#ifdef MODULE_PS
{"ps", "Prints information about running threads.", _ps_handler},
#endif
#ifdef MODULE_SHT1X
{"temp", "Prints measured temperature.", _get_temperature_handler},
{"hum", "Prints measured humidity.", _get_humidity_handler},
{"weather", "Prints measured humidity and temperature.", _get_weather_handler},
{"sht-config", "Get/set SHT10/11/15 sensor configuration.", _sht_config_handler},
#endif
#ifdef MODULE_AT30TSE75X
{"at30tse75x", "Test AT30TSE75X temperature sensor", _at30tse75x_handler},
#endif
#ifdef MODULE_MCI
{DISK_READ_SECTOR_CMD, "Reads the specified sector of inserted memory card", _read_sector},
{DISK_READ_BYTES_CMD, "Reads the specified bytes from inserted memory card", _read_bytes},
{DISK_GET_SECTOR_SIZE, "Get the sector size of inserted memory card", _get_sectorsize},
{DISK_GET_SECTOR_COUNT, "Get the sector count of inserted memory card", _get_sectorcount},
{DISK_GET_BLOCK_SIZE, "Get the block size of inserted memory card", _get_blocksize},
#endif
#ifdef MODULE_GNRC_ICMPV6_ECHO
#ifdef MODULE_XTIMER
{ "ping6", "Ping via ICMPv6", _gnrc_icmpv6_ping },
{ "ping", "Alias for ping6", _gnrc_icmpv6_ping },
#endif
#endif
#ifdef MODULE_RANDOM_CMD
{ "random_init", "initializes the PRNG", _random_init },
{ "random_get", "returns 32 bit of pseudo randomness", _random_get },
#endif
#if defined(MODULE_PERIPH_RTC) || defined(MODULE_RTT_RTC)
{"rtc", "control RTC peripheral interface", _rtc_handler},
#endif
#ifdef MODULE_RTT_CMD
{"rtt", "control RTC peripheral interface", _rtt_handler},
#endif
#ifdef MODULE_MD5SUM
{"md5sum", "Compute and check MD5 message digest", _vfs_md5sum_cmd},
#endif
#ifdef MODULE_SHA1SUM
{"sha1sum", "Compute and check SHA1 message digest", _vfs_sha1sum_cmd},
#endif
#ifdef MODULE_SHA256SUM
{"sha256sum", "Compute and check SHA256 message digest", _vfs_sha256sum_cmd},
#endif
#ifdef MODULE_NANOCOAP_VFS
{"ncget", "download a file from a CoAP server", _nanocoap_get_handler},
#endif
#ifdef MODULE_GNRC_IPV6_NIB
{"nib", "Configure neighbor information base", _gnrc_ipv6_nib},
#endif
#ifdef MODULE_NICE
{"nice", "Change priority of an active thread", _sc_nice},
#endif
#ifdef MODULE_NETSTATS_NEIGHBOR
{"neigh", "Show neighbor statistics", _netstats_nb},
#endif
#ifdef MODULE_GNRC_NETIF
{"ifconfig", "Configure network interfaces", _gnrc_netif_config},
#ifdef MODULE_GNRC_TXTSND
{"txtsnd", "Sends a custom string as is over the link layer", _gnrc_netif_send },
#endif
#endif
#ifdef MODULE_OPENWSN
{"ifconfig", "Shows assigned IPv6 addresses", _openwsn_ifconfig},
{"openwsn", "OpenWSN commands", _openwsn_handler},
#endif
#ifdef MODULE_LWIP_NETIF
{"ifconfig", "List network interfaces", _lwip_netif_config},
#endif
#ifdef MODULE_FIB
{"fibroute", "Manipulate the FIB (info: 'fibroute [add|del]')", _fib_route_handler},
#endif
#ifdef MODULE_GNRC_IPV6_EXT_FRAG_STATS
{"ip6_frag", "IPv6 fragmentation statistics", _gnrc_ipv6_frag_stats },
#endif
#ifdef MODULE_GNRC_IPV6_WHITELIST
{"whitelist", "whitelists an address for receival ('whitelist [add|del|help]')", _whitelist },
#endif
#ifdef MODULE_GNRC_IPV6_BLACKLIST
{"blacklist", "blacklists an address for receival ('blacklist [add|del|help]')", _blacklist },
#endif
#ifdef MODULE_GNRC_PKTBUF_CMD
{"pktbuf", "prints internal stats of the packet buffer", _gnrc_pktbuf_cmd },
#endif
#ifdef MODULE_GNRC_RPL
{"rpl", "rpl configuration tool ('rpl help' for more information)", _gnrc_rpl },
#endif
#ifdef MODULE_GNRC_SIXLOWPAN_CTX
{"6ctx", "6LoWPAN context configuration tool", _gnrc_6ctx },
#endif
#ifdef MODULE_GNRC_SIXLOWPAN_FRAG_STATS
{"6lo_frag", "6LoWPAN fragment statistics", _gnrc_6lo_frag_stats },
#endif
#ifdef MODULE_GNRC_UDP_CMD
{ "udp", "send data over UDP and listen on UDP ports", _gnrc_udp_cmd },
#endif
#ifdef MODULE_SAUL_REG
{"saul", "interact with sensors and actuators using SAUL", _saul },
#endif
#ifdef MODULE_CCN_LITE_UTILS
{ "ccnl_open", "opens an interface or socket", _ccnl_open },
{ "ccnl_int", "sends an interest", _ccnl_interest },
{ "ccnl_cs", "shows CS or creates content and populates it", _ccnl_content },
{ "ccnl_fib", "shows or modifies the CCN-Lite FIB", _ccnl_fib },
#endif
#ifdef MODULE_SNTP
{ "ntpdate", "synchronizes with a remote time server", _ntpdate },
#endif
#ifdef MODULE_VFS
{"vfs", "virtual file system operations", _vfs_handler},
{"ls", "list files", _ls_handler},
#endif
#ifdef MODULE_CONN_CAN
{"can", "CAN commands", _can_handler},
#endif
#ifdef MODULE_CORD_EP
{"cord_ep", "Resource directory endpoint commands", _cord_ep_handler },
#endif
#ifdef MODULE_APP_METADATA
{"app_metadata", "Returns application metadata", _app_metadata_handler },
#endif
#ifdef MODULE_I2C_SCAN
{ "i2c_scan", "Performs an I2C bus scan", _i2c_scan },
#endif
#ifdef MODULE_SEMTECH_LORAMAC
{"loramac", "Control Semtech loramac stack", _loramac_handler},
#endif
#ifdef MODULE_NIMBLE_NETIF
{ "ble", "Manage BLE connections for NimBLE", _nimble_netif_handler },
#endif
#ifdef MODULE_NIMBLE_STATCONN
{ "statconn", "NimBLE netif statconn", _nimble_statconn_handler},
#endif
#ifdef MODULE_SUIT_TRANSPORT_WORKER
{ "suit", "Trigger a SUIT firmware update", _suit_handler },
#endif
#ifdef MODULE_CRYPTOAUTHLIB
{ "cryptoauth", "Commands for Microchip CryptoAuth devices", _cryptoauth },
#endif
#ifdef MODULE_DFPLAYER
{"dfplayer", "Control a DFPlayer Mini MP3 player", _sc_dfplayer},
#endif
#ifdef MODULE_CONGURE_TEST
{ "cong_clear", "Clears CongURE state object", congure_test_clear_state },
{ "cong_setup", "Calls the setup function for the CongURE state object",
congure_test_call_setup },
{ "cong_init", "Calls init method of the CongURE state object",
congure_test_call_init },
{ "cong_imi", "Calls inter_message_interval method of the CongURE state object",
congure_test_call_inter_msg_interval },
{ "cong_add_msg",
"Adds a message to the list of messages to be reported with "
"report_msgs_lost or report_msgs_timeout",
congure_test_add_msg },
{ "cong_msgs_reset",
"Resets the list of messages to be reported with report_msgs_lost or "
"report_msgs_timeout",
congure_test_msgs_reset },
{ "cong_report", "Calls a report_* method of the CongURE state object",
congure_test_call_report },
#endif
{NULL, NULL, NULL}
};

25
sys/shell/doc.txt Normal file
View File

@ -0,0 +1,25 @@
/*
* Copyright (C) 2010 Kaspar Schleiser <kaspar@schleiser.de>
*
* 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.
*/
/**
* @defgroup sys_shell_commands Shell commands
* @ingroup sys_shell
Shell Commands
==============
Certain modules such as `ps`, `saul_reg`, or `gnrc_icmpv6_echo` can expose
(some of) their functionality not only as C-API, but also as shell command.
Using the module `shell_commands` will enable the shell integration of the used
modules, if it exists.
A few rarely needed shell commands that needs to be used in addition to the
`shell_commands` and the module providing the C-API. Examples include `nice`,
`gnrc_udp_cmd`, or `random_cmd`. Consult the documentation of the modules to
find out whether they have a shell integration and how to enable it.
*/

View File

@ -38,7 +38,6 @@
#include "kernel_defines.h" #include "kernel_defines.h"
#include "xfa.h" #include "xfa.h"
#include "shell.h" #include "shell.h"
#include "shell_commands.h"
/* define shell command cross file array */ /* define shell command cross file array */
XFA_INIT_CONST(shell_command_t*, shell_commands_xfa); XFA_INIT_CONST(shell_command_t*, shell_commands_xfa);
@ -111,10 +110,6 @@ static shell_command_handler_t find_handler(
handler = search_commands(command_list, command); handler = search_commands(command_list, command);
} }
if (IS_USED(MODULE_SHELL_COMMANDS) && handler == NULL) {
handler = search_commands(_shell_command_list, command);
}
if (handler == NULL) { if (handler == NULL) {
handler = search_commands_xfa(command); handler = search_commands_xfa(command);
} }
@ -146,10 +141,6 @@ static void print_help(const shell_command_t *command_list)
print_commands(command_list); print_commands(command_list);
} }
if (IS_USED(MODULE_SHELL_COMMANDS)) {
print_commands(_shell_command_list);
}
print_commands_xfa(); print_commands_xfa();
} }

View File

@ -21,7 +21,6 @@
#include <stdio.h> #include <stdio.h>
#include "shell.h" #include "shell.h"
#include "shell_commands.h"
int main(void) int main(void)
{ {

View File

@ -23,7 +23,6 @@
#include "at86rf215_internal.h" #include "at86rf215_internal.h"
#include "thread.h" #include "thread.h"
#include "shell.h" #include "shell.h"
#include "shell_commands.h"
#include "sys/bus.h" #include "sys/bus.h"
#include "net/gnrc/pktdump.h" #include "net/gnrc/pktdump.h"

View File

@ -22,7 +22,6 @@
#include "net/netdev.h" #include "net/netdev.h"
#include "shell.h" #include "shell.h"
#include "shell_commands.h"
#include "thread.h" #include "thread.h"
#include "xtimer.h" #include "xtimer.h"

View File

@ -24,7 +24,6 @@
#include <inttypes.h> #include <inttypes.h>
#include "shell.h" #include "shell.h"
#include "shell_commands.h"
#include "ata8520e_params.h" #include "ata8520e_params.h"
#include "ata8520e.h" #include "ata8520e.h"

View File

@ -22,7 +22,6 @@
#include <string.h> #include <string.h>
#include "shell.h" #include "shell.h"
#include "shell_commands.h"
#include "net/gnrc/pktdump.h" #include "net/gnrc/pktdump.h"
#include "net/gnrc.h" #include "net/gnrc.h"

View File

@ -8,7 +8,6 @@
#include "dynamixel.h" #include "dynamixel.h"
#include "shell.h" #include "shell.h"
#include "shell_commands.h"
#include "stdio_uart.h" #include "stdio_uart.h"
#include "board.h" #include "board.h"
#include "periph/gpio.h" #include "periph/gpio.h"

View File

@ -8,7 +8,6 @@
#include "feetech.h" #include "feetech.h"
#include "shell.h" #include "shell.h"
#include "shell_commands.h"
#include "stdio_uart.h" #include "stdio_uart.h"
#include <stdio.h> #include <stdio.h>

View File

@ -22,7 +22,6 @@
#include "fmt.h" #include "fmt.h"
#include "shell.h" #include "shell.h"
#include "kw2xrf.h" #include "kw2xrf.h"
#include "shell_commands.h"
#include "net/gnrc.h" #include "net/gnrc.h"
#include "net/gnrc/netapi.h" #include "net/gnrc/netapi.h"
#include "net/netopt.h" #include "net/netopt.h"

View File

@ -19,7 +19,6 @@
#include "thread.h" #include "thread.h"
#include "shell.h" #include "shell.h"
#include "shell_commands.h"
#include "net/gnrc/pktdump.h" #include "net/gnrc/pktdump.h"
#include "net/gnrc.h" #include "net/gnrc.h"

View File

@ -43,7 +43,6 @@
#include "periph/gpio.h" #include "periph/gpio.h"
#include "ztimer.h" #include "ztimer.h"
#include "shell.h" #include "shell.h"
#include "shell_commands.h"
#include "thread.h" #include "thread.h"
#include "msg.h" #include "msg.h"

View File

@ -20,7 +20,6 @@
#include <string.h> #include <string.h>
#include "shell.h" #include "shell.h"
#include "shell_commands.h"
#include "net/gnrc.h" #include "net/gnrc.h"
#define MAIN_QUEUE_SIZE (8) #define MAIN_QUEUE_SIZE (8)

View File

@ -24,7 +24,6 @@
#include "timex.h" #include "timex.h"
#include "shell.h" #include "shell.h"
#include "shell_commands.h"
#include "fmt.h" #include "fmt.h"
#include "rn2xx3.h" #include "rn2xx3.h"

View File

@ -22,7 +22,6 @@
#include <stdio.h> #include <stdio.h>
#include "shell.h" #include "shell.h"
#include "shell_commands.h"
#include "sht1x_params.h" #include "sht1x_params.h"
#define SHT1X_NUM ARRAY_SIZE(sht1x_params) #define SHT1X_NUM ARRAY_SIZE(sht1x_params)

View File

@ -28,7 +28,6 @@
#include "thread.h" #include "thread.h"
#include "shell.h" #include "shell.h"
#include "shell_commands.h"
#include "net/netdev.h" #include "net/netdev.h"
#include "net/netdev/lora.h" #include "net/netdev/lora.h"

View File

@ -23,7 +23,6 @@
#include "thread.h" #include "thread.h"
#include "shell.h" #include "shell.h"
#include "shell_commands.h"
#include "net/gnrc/pktdump.h" #include "net/gnrc/pktdump.h"
#include "net/gnrc.h" #include "net/gnrc.h"

View File

@ -28,7 +28,6 @@
#include "thread.h" #include "thread.h"
#include "shell.h" #include "shell.h"
#include "shell_commands.h"
#include "net/gnrc/pktdump.h" #include "net/gnrc/pktdump.h"
#include "net/gnrc.h" #include "net/gnrc.h"

View File

@ -18,7 +18,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "shell_commands.h"
#include "shell.h" #include "shell.h"
static int malloc_cmd(int argc, char **argv) static int malloc_cmd(int argc, char **argv)

View File

@ -32,7 +32,6 @@
#include "net/ieee802154/radio.h" #include "net/ieee802154/radio.h"
#include "shell.h" #include "shell.h"
#include "shell_commands.h"
#include "test_utils/expect.h" #include "test_utils/expect.h"
#include "xtimer.h" #include "xtimer.h"

View File

@ -19,7 +19,6 @@
#include "thread.h" #include "thread.h"
#include "shell.h" #include "shell.h"
#include "shell_commands.h"
#include "net/gnrc/pktdump.h" #include "net/gnrc/pktdump.h"
#include "net/gnrc.h" #include "net/gnrc.h"

View File

@ -27,7 +27,6 @@
#include "net/netdev.h" #include "net/netdev.h"
#include "shell.h" #include "shell.h"
#include "shell_commands.h"
#include "net/ieee802154/submac.h" #include "net/ieee802154/submac.h"
#include "net/ieee802154.h" #include "net/ieee802154.h"
#include "net/netdev/ieee802154_submac.h" #include "net/netdev/ieee802154_submac.h"

View File

@ -21,7 +21,6 @@
#include <stdio.h> #include <stdio.h>
#include "shell.h" #include "shell.h"
#include "shell_commands.h"
int main(void) int main(void)
{ {

View File

@ -25,7 +25,6 @@
#include "timex.h" #include "timex.h"
#include "ztimer.h" #include "ztimer.h"
#include "shell.h" #include "shell.h"
#include "shell_commands.h"
#include "nimble_scanner.h" #include "nimble_scanner.h"
#include "nimble_scanlist.h" #include "nimble_scanlist.h"

View File

@ -24,7 +24,6 @@
#include "architecture.h" #include "architecture.h"
#include "sched.h" #include "sched.h"
#include "shell.h" #include "shell.h"
#include "shell_commands.h"
#include "thread.h" #include "thread.h"
static int sc_hint(int argc, char **argv); static int sc_hint(int argc, char **argv);

View File

@ -21,7 +21,6 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "shell_commands.h"
#include "shell.h" #include "shell.h"
#if MODULE_STDIO_RTT #if MODULE_STDIO_RTT

View File

@ -21,7 +21,6 @@
#include <stdio.h> #include <stdio.h>
#include "shell.h" #include "shell.h"
#include "shell_commands.h"
#include "net/gnrc.h" #include "net/gnrc.h"
#include "net/gnrc/pktdump.h" #include "net/gnrc/pktdump.h"

View File

@ -25,7 +25,6 @@
#include "fmt.h" #include "fmt.h"
#include "net/sock/udp.h" #include "net/sock/udp.h"
#include "shell.h" #include "shell.h"
#include "shell_commands.h"
#include "net/ipv6/addr.h" #include "net/ipv6/addr.h"
#define MAIN_QUEUE_SIZE (8) #define MAIN_QUEUE_SIZE (8)

View File

@ -22,7 +22,6 @@
#include <string.h> #include <string.h>
#include "shell.h" #include "shell.h"
#include "shell_commands.h"
int main(void) int main(void)
{ {

View File

@ -22,7 +22,6 @@
#include <stdio.h> #include <stdio.h>
#include "shell.h" #include "shell.h"
#include "shell_commands.h"
int main(void) int main(void)
{ {

View File

@ -19,7 +19,6 @@
#include <ctype.h> #include <ctype.h>
#include "kernel_defines.h" #include "kernel_defines.h"
#include "shell_commands.h"
#include "shell.h" #include "shell.h"
#if !IS_ACTIVE(CONFIG_SHELL_NO_ECHO) || !IS_ACTIVE(CONFIG_SHELL_NO_PROMPT) #if !IS_ACTIVE(CONFIG_SHELL_NO_ECHO) || !IS_ACTIVE(CONFIG_SHELL_NO_PROMPT)

View File

@ -21,7 +21,6 @@
#include <stdlib.h> #include <stdlib.h>
#include "shell.h" #include "shell.h"
#include "shell_commands.h"
static int cmd_text(int argc, char **argv) static int cmd_text(int argc, char **argv)
{ {

View File

@ -20,7 +20,6 @@
#include <stdio.h> #include <stdio.h>
#include "shell.h" #include "shell.h"
#include "shell_commands.h"
#include "vfs_default.h" #include "vfs_default.h"
int main(void) int main(void)