diff --git a/examples/default/main.c b/examples/default/main.c index 9d6542d0fd..b5e7ae7a23 100644 --- a/examples/default/main.c +++ b/examples/default/main.c @@ -27,7 +27,6 @@ #include "thread.h" #include "shell.h" -#include "shell_commands.h" #ifdef MODULE_NETIF #include "net/gnrc/pktdump.h" diff --git a/examples/gnrc_lorawan/main.c b/examples/gnrc_lorawan/main.c index 0308de4bda..b6837e8dac 100644 --- a/examples/gnrc_lorawan/main.c +++ b/examples/gnrc_lorawan/main.c @@ -23,7 +23,6 @@ #include "thread.h" #include "shell.h" -#include "shell_commands.h" #include "board.h" diff --git a/examples/nimble_scanner/main.c b/examples/nimble_scanner/main.c index 14f4f98122..6efa2494b8 100644 --- a/examples/nimble_scanner/main.c +++ b/examples/nimble_scanner/main.c @@ -25,7 +25,6 @@ #include "timex.h" #include "ztimer.h" #include "shell.h" -#include "shell_commands.h" #include "nimble_scanner.h" #include "nimble_scanlist.h" diff --git a/examples/twr_aloha/main.c b/examples/twr_aloha/main.c index b87a1159f8..cadabdc2db 100644 --- a/examples/twr_aloha/main.c +++ b/examples/twr_aloha/main.c @@ -20,7 +20,6 @@ #include #include "shell.h" -#include "shell_commands.h" #include "control.h" diff --git a/examples/twr_aloha/twr_shell.c b/examples/twr_aloha/twr_shell.c index fdf6640cf7..cd0f748502 100644 --- a/examples/twr_aloha/twr_shell.c +++ b/examples/twr_aloha/twr_shell.c @@ -24,7 +24,6 @@ #include "net/ieee802154.h" #include "net/l2util.h" -#include "shell_commands.h" #include "shell.h" #include "ztimer.h" diff --git a/pkg/nimble/autoadv/shell.c b/pkg/nimble/autoadv/shell.c index 8ef844263b..a45e2a132d 100644 --- a/pkg/nimble/autoadv/shell.c +++ b/pkg/nimble/autoadv/shell.c @@ -22,7 +22,6 @@ #include #include "shell.h" -#include "shell_commands.h" #include "xfa.h" #include "nimble_riot.h" diff --git a/sys/congure/test/congure_test.c b/sys/congure/test/congure_test.c index 891a973790..8505073a88 100644 --- a/sys/congure/test/congure_test.c +++ b/sys/congure/test/congure_test.c @@ -19,9 +19,9 @@ #include #include "clist.h" -#include "fmt.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 unsigned _msgs_pool_idx; @@ -45,6 +45,9 @@ int congure_test_clear_state(int argc, char **argv) return 0; } +SHELL_COMMAND(cong_clear, "Clears CongURE state object", + congure_test_clear_state); + int congure_test_call_setup(int argc, char **argv) { congure_test_snd_t *c = congure_test_get_state(); @@ -70,6 +73,10 @@ int congure_test_call_setup(int argc, char **argv) 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) { if (c->super.driver == NULL) { @@ -103,6 +110,9 @@ int congure_test_call_init(int argc, char **argv) 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) { 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; } +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) { uint32_t tmp; @@ -169,6 +183,11 @@ int congure_test_add_msg(int argc, char **argv) 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) { (void)argc; @@ -179,6 +198,11 @@ int congure_test_msgs_reset(int argc, char **argv) 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) { congure_test_snd_t *c = congure_test_get_state(); @@ -364,4 +388,8 @@ int congure_test_call_report(int argc, char **argv) return 1; } +SHELL_COMMAND(cong_report, + "Calls a report_* method of the CongURE state object", + congure_test_call_report); + /** @} */ diff --git a/sys/include/shell_commands.h b/sys/include/shell_commands.h deleted file mode 100644 index 11dbe97a09..0000000000 --- a/sys/include/shell_commands.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2010 Kaspar Schleiser - * - * 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 - */ - -#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 */ -/** @} */ diff --git a/sys/shell/commands/Makefile b/sys/shell/commands/Makefile index fdff3e9091..20f9cd0a54 100644 --- a/sys/shell/commands/Makefile +++ b/sys/shell/commands/Makefile @@ -1,6 +1,6 @@ MODULE = shell_commands -SRC = shell_commands.c sc_sys.c +SRC = sc_sys.c ifneq (,$(filter app_metadata,$(USEMODULE))) SRC += sc_app_metadata.c diff --git a/sys/shell/commands/sc_app_metadata.c b/sys/shell/commands/sc_app_metadata.c index b76a89adc6..c1871196ae 100644 --- a/sys/shell/commands/sc_app_metadata.c +++ b/sys/shell/commands/sc_app_metadata.c @@ -19,6 +19,7 @@ */ #include "app_metadata.h" +#include "shell.h" int _app_metadata_handler(int argc, char **argv) { @@ -27,3 +28,5 @@ int _app_metadata_handler(int argc, char **argv) app_metadata_print_json(); return 0; } + +SHELL_COMMAND(app_metadata, "Returns application metadata", _app_metadata_handler); diff --git a/sys/shell/commands/sc_at30tse75x.c b/sys/shell/commands/sc_at30tse75x.c index b1baac262b..fc1c3f8afb 100644 --- a/sys/shell/commands/sc_at30tse75x.c +++ b/sys/shell/commands/sc_at30tse75x.c @@ -22,7 +22,9 @@ #include #include #include + #include "at30tse75x.h" +#include "shell.h" #ifdef MODULE_AT30TSE75X @@ -157,4 +159,6 @@ int _at30tse75x_handler(int argc, char **argv) return 0; } +SHELL_COMMAND(at30tse75x, "Test AT30TSE75X temperature sensor", _at30tse75x_handler); + #endif /* MODULE_AT30TSE75X */ diff --git a/sys/shell/commands/sc_benchmark_udp.c b/sys/shell/commands/sc_benchmark_udp.c index d432ad13a6..e0d4fefce9 100644 --- a/sys/shell/commands/sc_benchmark_udp.c +++ b/sys/shell/commands/sc_benchmark_udp.c @@ -63,4 +63,6 @@ usage: printf("usage: %s [start|stop|config] \n", argv[0]); return -1; } + +SHELL_COMMAND(bench_udp, "UDP benchmark", _benchmark_udp_handler); /** @} */ diff --git a/sys/shell/commands/sc_blacklist.c b/sys/shell/commands/sc_blacklist.c index 27df59e750..ccd0d87077 100644 --- a/sys/shell/commands/sc_blacklist.c +++ b/sys/shell/commands/sc_blacklist.c @@ -18,6 +18,7 @@ #include #include "net/gnrc/ipv6/blacklist.h" +#include "shell.h" static void _usage(char *cmd) { @@ -60,4 +61,8 @@ int _blacklist(int argc, char **argv) return 0; } +SHELL_COMMAND(blacklist, + "blacklists an address for receival ('blacklist [add|del|help]')", + _blacklist); + /** @} */ diff --git a/sys/shell/commands/sc_can.c b/sys/shell/commands/sc_can.c index d1986a7fbf..f5841cb31f 100644 --- a/sys/shell/commands/sc_can.c +++ b/sys/shell/commands/sc_can.c @@ -25,7 +25,7 @@ #include "can/conn/raw.h" #include "can/raw.h" - +#include "shell.h" #include "timex.h" #define SC_CAN_MAX_FILTERS 10 @@ -183,3 +183,5 @@ int _can_handler(int argc, char **argv) } return 0; } + +SHELL_COMMAND(can, "CAN commands", _can_handler); diff --git a/sys/shell/commands/sc_ccnl.c b/sys/shell/commands/sc_ccnl.c index a00cda8b03..d2323814bb 100644 --- a/sys/shell/commands/sc_ccnl.c +++ b/sys/shell/commands/sc_ccnl.c @@ -20,11 +20,12 @@ #include -#include "random.h" -#include "sched.h" -#include "net/gnrc/netif.h" #include "ccn-lite-riot.h" #include "ccnl-pkt-ndntlv.h" +#include "net/gnrc/netif.h" +#include "random.h" +#include "sched.h" +#include "shell.h" #define BUF_SIZE (64) @@ -73,6 +74,8 @@ int _ccnl_open(int argc, char **argv) return 0; } +SHELL_COMMAND(ccnl_open, "opens an interface or socket", _ccnl_open); + static void _content_usage(char *argv) { printf("usage: %s [URI] [content]\n" @@ -142,6 +145,9 @@ int _ccnl_content(int argc, char **argv) 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) { /* initialize address with 0xFF for broadcast */ @@ -219,6 +225,8 @@ int _ccnl_interest(int argc, char **argv) return res; } +SHELL_COMMAND(ccnl_int, "sends an interest", _ccnl_interest); + static void _ccnl_fib_usage(char *argv) { printf("usage: %s [ ]\n" @@ -272,3 +280,5 @@ int _ccnl_fib(int argc, char **argv) } return 0; } + +SHELL_COMMAND(ccnl_fib, "shows or modifies the CCN-Lite FIB", _ccnl_fib); diff --git a/sys/shell/commands/sc_cord_ep.c b/sys/shell/commands/sc_cord_ep.c index f4b1152590..1e47b7a2f3 100644 --- a/sys/shell/commands/sc_cord_ep.c +++ b/sys/shell/commands/sc_cord_ep.c @@ -21,11 +21,12 @@ #include #include +#include "net/cord/config.h" #include "net/cord/ep.h" #include "net/gnrc/netif.h" #include "net/nanocoap.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) { @@ -132,3 +133,5 @@ int _cord_ep_handler(int argc, char **argv) return 0; } + +SHELL_COMMAND(cord_ep, "Resource directory endpoint commands", _cord_ep_handler); diff --git a/sys/shell/commands/sc_cryptoauthlib.c b/sys/shell/commands/sc_cryptoauthlib.c index dc6258b9e9..cfcb83ddbd 100644 --- a/sys/shell/commands/sc_cryptoauthlib.c +++ b/sys/shell/commands/sc_cryptoauthlib.c @@ -19,7 +19,9 @@ */ #include #include + #include "cryptoauthlib.h" +#include "shell.h" void get_bin(char *result, uint8_t byte) { @@ -237,3 +239,6 @@ int _cryptoauth(int argc, char **argv) } return 0; } + +SHELL_COMMAND(cryptoauth, "Commands for Microchip CryptoAuth devices", + _cryptoauth); diff --git a/sys/shell/commands/sc_dfplayer.c b/sys/shell/commands/sc_dfplayer.c index b41683fa11..486edb6868 100644 --- a/sys/shell/commands/sc_dfplayer.c +++ b/sys/shell/commands/sc_dfplayer.c @@ -26,6 +26,7 @@ #include "dfplayer.h" #include "dfplayer_internal.h" #include "fmt.h" +#include "shell.h" static const char *_equalizers[] = { [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; int pos = 1; @@ -619,3 +620,5 @@ int _sc_dfplayer(int argc, char **argv) _print_help(argv[0]); return 1; } + +SHELL_COMMAND(dfplayer, "Control a DFPlayer Mini MP3 player", _sc_dfplayer); diff --git a/sys/shell/commands/sc_disk.c b/sys/shell/commands/sc_disk.c index 037b1be442..435a8e8ed6 100644 --- a/sys/shell/commands/sc_disk.c +++ b/sys/shell/commands/sc_disk.c @@ -22,8 +22,8 @@ #include #include -#include "shell_commands.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) { @@ -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) { (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) { (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) { 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) { unsigned long sector = 1, scount, offset; @@ -173,3 +181,5 @@ int _read_bytes(int argc, char **argv) return 1; } + +SHELL_COMMAND(dread, "Reads the specified bytes from inserted memory card", _read_bytes); diff --git a/sys/shell/commands/sc_fib.c b/sys/shell/commands/sc_fib.c index 6e22d13f82..a260e66c94 100644 --- a/sys/shell/commands/sc_fib.c +++ b/sys/shell/commands/sc_fib.c @@ -19,15 +19,17 @@ */ #include -#include #include -#include +#include #include -#include "thread.h" +#include + #include "net/af.h" -#include "net/gnrc/netif.h" #include "net/fib.h" #include "net/gnrc/ipv6.h" +#include "net/gnrc/netif.h" +#include "shell.h" +#include "thread.h" #define INFO1_TXT "fibroute add via [dev ]" #define INFO2_TXT " [lifetime ]" @@ -252,3 +254,5 @@ int _fib_route_handler(int argc, char **argv) puts("\nunrecognized parameters.\nPlease enter fibroute [add|del] for more information."); return 1; } + +SHELL_COMMAND(fibroute, "Manipulate the FIB (info: 'fibroute [add|del]')", _fib_route_handler); diff --git a/sys/shell/commands/sc_gnrc_6ctx.c b/sys/shell/commands/sc_gnrc_6ctx.c index 7c1db3c7c0..8ba66c81ac 100644 --- a/sys/shell/commands/sc_gnrc_6ctx.c +++ b/sys/shell/commands/sc_gnrc_6ctx.c @@ -20,9 +20,10 @@ #include #include "kernel_defines.h" -#include "net/ipv6/addr.h" #include "net/gnrc/sixlowpan/ctx.h" +#include "net/ipv6/addr.h" #include "net/sixlowpan/nd.h" +#include "shell.h" #include "timex.h" #if IS_USED(MODULE_ZTIMER_MSEC) @@ -164,4 +165,6 @@ int _gnrc_6ctx(int argc, char **argv) return 0; } +SHELL_COMMAND(6ctx, "6LoWPAN context configuration tool", _gnrc_6ctx); + /** @} */ diff --git a/sys/shell/commands/sc_gnrc_6lo_frag_stats.c b/sys/shell/commands/sc_gnrc_6lo_frag_stats.c index 6e256fc7cf..26a3c40d21 100644 --- a/sys/shell/commands/sc_gnrc_6lo_frag_stats.c +++ b/sys/shell/commands/sc_gnrc_6lo_frag_stats.c @@ -16,6 +16,7 @@ #include #include "net/gnrc/sixlowpan/frag/stats.h" +#include "shell.h" #ifdef MODULE_GNRC_SIXLOWPAN_FRAG_SFR_STATS #include "net/gnrc/sixlowpan/frag/sfr.h" #endif @@ -54,4 +55,6 @@ int _gnrc_6lo_frag_stats(int argc, char **argv) return 0; } +SHELL_COMMAND(6lo_frag, "6LoWPAN fragment statistics", _gnrc_6lo_frag_stats); + /** @} */ diff --git a/sys/shell/commands/sc_gnrc_icmpv6_echo.c b/sys/shell/commands/sc_gnrc_icmpv6_echo.c index b441a157b8..a1a7d0e532 100644 --- a/sys/shell/commands/sc_gnrc_icmpv6_echo.c +++ b/sys/shell/commands/sc_gnrc_icmpv6_echo.c @@ -27,24 +27,26 @@ #include "bitfield.h" #include "byteorder.h" -#include "sched.h" -#ifdef MODULE_LUID -#include "luid.h" -#endif #include "msg.h" #include "net/gnrc.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/ipv6.h" #include "net/utils.h" +#include "sched.h" +#include "shell.h" #include "timex.h" #include "unaligned.h" #include "utlist.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 _PING_FINISH (0xEF49) @@ -144,6 +146,9 @@ finish: 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) { printf("%s [-c ] [-h] [-i ] [-s ]\n", diff --git a/sys/shell/commands/sc_gnrc_ipv6_frag_stats.c b/sys/shell/commands/sc_gnrc_ipv6_frag_stats.c index 56c8ed19cc..ef7ca695df 100644 --- a/sys/shell/commands/sc_gnrc_ipv6_frag_stats.c +++ b/sys/shell/commands/sc_gnrc_ipv6_frag_stats.c @@ -14,7 +14,9 @@ */ #include + #include "net/gnrc/ipv6/ext/frag.h" +#include "shell.h" int _gnrc_ipv6_frag_stats(int argc, char **argv) { @@ -31,4 +33,6 @@ int _gnrc_ipv6_frag_stats(int argc, char **argv) return 0; } +SHELL_COMMAND(ip6_frag, "IPv6 fragmentation statistics", _gnrc_ipv6_frag_stats); + /** @} */ diff --git a/sys/shell/commands/sc_gnrc_ipv6_nib.c b/sys/shell/commands/sc_gnrc_ipv6_nib.c index 12a91876fc..51eeea78a8 100644 --- a/sys/shell/commands/sc_gnrc_ipv6_nib.c +++ b/sys/shell/commands/sc_gnrc_ipv6_nib.c @@ -14,12 +14,12 @@ */ #include -#include +#include "kernel_defines.h" #include "net/gnrc/ipv6/nib.h" #include "net/gnrc/netif.h" #include "net/ipv6/addr.h" - +#include "shell.h" #include "timex.h" static void _usage(char **argv); @@ -58,6 +58,8 @@ int _gnrc_ipv6_nib(int argc, char **argv) return res; } +SHELL_COMMAND(nib, "Configure neighbor information base", _gnrc_ipv6_nib); + static void _usage(char **argv) { #if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) diff --git a/sys/shell/commands/sc_gnrc_netif.c b/sys/shell/commands/sc_gnrc_netif.c index 4f82162b00..bc02f8ebe8 100644 --- a/sys/shell/commands/sc_gnrc_netif.c +++ b/sys/shell/commands/sc_gnrc_netif.c @@ -24,14 +24,15 @@ #include #include -#include "net/netif.h" -#include "net/ipv6/addr.h" +#include "fmt.h" #include "net/gnrc.h" #include "net/gnrc/netif.h" #include "net/gnrc/netif/hdr.h" +#include "net/ipv6/addr.h" #include "net/lora.h" #include "net/loramac.h" -#include "fmt.h" +#include "net/netif.h" +#include "shell.h" #ifdef MODULE_NETSTATS #include "net/netstats.h" @@ -1781,6 +1782,8 @@ int _gnrc_netif_send(int argc, char **argv) return 0; } + +SHELL_COMMAND(txtsnd, "Sends a custom string as is over the link layer", _gnrc_netif_send); #endif int _gnrc_netif_config(int argc, char **argv) @@ -1905,3 +1908,5 @@ int _gnrc_netif_config(int argc, char **argv) _usage(argv[0]); return 1; } + +SHELL_COMMAND(ifconfig, "Configure network interfaces", _gnrc_netif_config); diff --git a/sys/shell/commands/sc_gnrc_pktbuf.c b/sys/shell/commands/sc_gnrc_pktbuf.c index bbff91dd02..9b039320f1 100644 --- a/sys/shell/commands/sc_gnrc_pktbuf.c +++ b/sys/shell/commands/sc_gnrc_pktbuf.c @@ -14,6 +14,7 @@ */ #include "net/gnrc/pktbuf.h" +#include "shell.h" int _gnrc_pktbuf_cmd(int argc, char **argv) { @@ -23,4 +24,6 @@ int _gnrc_pktbuf_cmd(int argc, char **argv) return 0; } +SHELL_COMMAND(pktbuf, "prints internal stats of the packet buffer", _gnrc_pktbuf_cmd); + /** @} */ diff --git a/sys/shell/commands/sc_gnrc_rpl.c b/sys/shell/commands/sc_gnrc_rpl.c index 098b55586c..27454421df 100644 --- a/sys/shell/commands/sc_gnrc_rpl.c +++ b/sys/shell/commands/sc_gnrc_rpl.c @@ -18,12 +18,14 @@ #include #include + #include "net/gnrc/netif.h" #include "net/gnrc/rpl.h" -#include "net/gnrc/rpl/structs.h" #include "net/gnrc/rpl/dodag.h" -#include "utlist.h" +#include "net/gnrc/rpl/structs.h" +#include "shell.h" #include "trickle.h" +#include "utlist.h" #ifdef MODULE_GNRC_RPL_P2P #include "net/gnrc/rpl/p2p.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"); return 0; } + +SHELL_COMMAND(rpl, "rpl configuration tool ('rpl help' for more information)", _gnrc_rpl); /** * @} */ diff --git a/sys/shell/commands/sc_gnrc_udp.c b/sys/shell/commands/sc_gnrc_udp.c index db9cb2cef3..609d5449d7 100644 --- a/sys/shell/commands/sc_gnrc_udp.c +++ b/sys/shell/commands/sc_gnrc_udp.c @@ -26,9 +26,10 @@ #include "net/gnrc/ipv6.h" #include "net/gnrc/netif.h" #include "net/gnrc/netif/hdr.h" -#include "net/gnrc/udp.h" #include "net/gnrc/pktdump.h" +#include "net/gnrc/udp.h" #include "net/utils.h" +#include "shell.h" #include "timex.h" #include "utlist.h" #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; } + +SHELL_COMMAND(udp, "send data over UDP and listen on UDP ports", _gnrc_udp_cmd); diff --git a/sys/shell/commands/sc_heap.c b/sys/shell/commands/sc_heap.c index fbbdfe1847..9f188124d0 100644 --- a/sys/shell/commands/sc_heap.c +++ b/sys/shell/commands/sc_heap.c @@ -19,6 +19,7 @@ */ #include "cpu_conf.h" +#include "shell.h" #if defined(MODULE_NEWLIB_SYSCALLS_DEFAULT) || defined (HAVE_HEAP_STATS) extern void heap_stats(void); @@ -39,3 +40,5 @@ int _heap_handler(int argc, char **argv) return 1; #endif } + +SHELL_COMMAND(heap, "Prints heap statistics.", _heap_handler); diff --git a/sys/shell/commands/sc_i2c_scan.c b/sys/shell/commands/sc_i2c_scan.c index fc0e3f1bdd..f16eb68d01 100644 --- a/sys/shell/commands/sc_i2c_scan.c +++ b/sys/shell/commands/sc_i2c_scan.c @@ -26,6 +26,7 @@ #include "board.h" #include "periph/i2c.h" +#include "shell.h" 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); return 0; } + +SHELL_COMMAND(i2c_scan, "Performs an I2C bus scan", _i2c_scan); diff --git a/sys/shell/commands/sc_loramac.c b/sys/shell/commands/sc_loramac.c index 75a78efef5..52794ea649 100644 --- a/sys/shell/commands/sc_loramac.c +++ b/sys/shell/commands/sc_loramac.c @@ -21,11 +21,10 @@ #include #include -#include "shell.h" #include "fmt.h" - #include "net/loramac.h" #include "semtech_loramac.h" +#include "shell.h" extern semtech_loramac_t loramac; @@ -512,3 +511,5 @@ int _loramac_handler(int argc, char **argv) return 0; } + +SHELL_COMMAND(loramac, "Control Semtech loramac stack", _loramac_handler); diff --git a/sys/shell/commands/sc_lwip_netif.c b/sys/shell/commands/sc_lwip_netif.c index d86a78c8eb..b1bc4d77bb 100644 --- a/sys/shell/commands/sc_lwip_netif.c +++ b/sys/shell/commands/sc_lwip_netif.c @@ -20,9 +20,11 @@ #include #include + #include "lwip/netif/compat.h" #include "net/netdev.h" #include "net/netopt.h" +#include "shell.h" #ifdef MODULE_LWIP_IPV6 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]); return 1; } + +SHELL_COMMAND(ifconfig, "List network interfaces", _lwip_netif_config); diff --git a/sys/shell/commands/sc_nanocoap_vfs.c b/sys/shell/commands/sc_nanocoap_vfs.c index ca931adb82..598529e8c1 100644 --- a/sys/shell/commands/sc_nanocoap_vfs.c +++ b/sys/shell/commands/sc_nanocoap_vfs.c @@ -23,9 +23,10 @@ #include #include -#include "vfs_default.h" -#include "net/nanocoap_vfs.h" #include "net/nanocoap_sock.h" +#include "net/nanocoap_vfs.h" +#include "shell.h" +#include "vfs_default.h" struct dir_list_ctx { char *buf; @@ -137,3 +138,5 @@ int _nanocoap_get_handler(int argc, char **argv) } return res; } + +SHELL_COMMAND(ncget, "download a file from a CoAP server", _nanocoap_get_handler); diff --git a/sys/shell/commands/sc_netstats_nb.c b/sys/shell/commands/sc_netstats_nb.c index 32f8ede7dc..9b561f3811 100644 --- a/sys/shell/commands/sc_netstats_nb.c +++ b/sys/shell/commands/sc_netstats_nb.c @@ -24,6 +24,7 @@ #include "net/gnrc/netif.h" #include "net/netstats.h" #include "net/netstats/neighbor.h" +#include "shell.h" static void _print_neighbors(netif_t *dev) { @@ -100,3 +101,5 @@ int _netstats_nb(int argc, char **argv) return 0; } + +SHELL_COMMAND(neigh, "Show neighbor statistics", _netstats_nb); diff --git a/sys/shell/commands/sc_nice.c b/sys/shell/commands/sc_nice.c index 2905f9c389..1bc62a9d68 100644 --- a/sys/shell/commands/sc_nice.c +++ b/sys/shell/commands/sc_nice.c @@ -24,6 +24,7 @@ #include #include "sched.h" +#include "shell.h" #include "thread.h" int _sc_nice(int argc, char **argv) @@ -51,3 +52,5 @@ int _sc_nice(int argc, char **argv) sched_change_priority(thread, prio); return EXIT_SUCCESS; } + +SHELL_COMMAND(nice, "Change priority of an active thread", _sc_nice); diff --git a/sys/shell/commands/sc_nimble_netif.c b/sys/shell/commands/sc_nimble_netif.c index 8338b3c37f..cf8710ade5 100644 --- a/sys/shell/commands/sc_nimble_netif.c +++ b/sys/shell/commands/sc_nimble_netif.c @@ -24,12 +24,13 @@ #include #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/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) && \ !IS_USED(MODULE_NIMBLE_STATCONN) && \ @@ -627,3 +628,5 @@ int _nimble_netif_handler(int argc, char **argv) return 0; } + +SHELL_COMMAND(ble, "Manage BLE connections for NimBLE", _nimble_netif_handler); diff --git a/sys/shell/commands/sc_nimble_statconn.c b/sys/shell/commands/sc_nimble_statconn.c index 99679649c5..d6c1322d62 100644 --- a/sys/shell/commands/sc_nimble_statconn.c +++ b/sys/shell/commands/sc_nimble_statconn.c @@ -23,7 +23,7 @@ #include "net/bluetil/addr.h" #include "nimble_statconn.h" - +#include "shell.h" static uint8_t _parsephy(const char *phy_str) { @@ -104,3 +104,5 @@ int _nimble_statconn_handler(int argc, char **argv) return 0; } + +SHELL_COMMAND(statconn, "NimBLE netif statconn", _nimble_statconn_handler); diff --git a/sys/shell/commands/sc_openwsn.c b/sys/shell/commands/sc_openwsn.c index f342bd0aa8..6531db4703 100644 --- a/sys/shell/commands/sc_openwsn.c +++ b/sys/shell/commands/sc_openwsn.c @@ -187,6 +187,8 @@ int _openwsn_ifconfig(int argc, char **argv) return 0; } +SHELL_COMMAND(ifconfig, "Shows assigned IPv6 addresses", _openwsn_ifconfig); + static int _neighbors_cmd(char *arg) { (void)arg; @@ -610,3 +612,5 @@ int _openwsn_handler(int argc, char **argv) _print_usage(); return -1; } + +SHELL_COMMAND(openwsn, "OpenWSN commands", _openwsn_handler); diff --git a/sys/shell/commands/sc_pm.c b/sys/shell/commands/sc_pm.c index be8643df26..a54be34069 100644 --- a/sys/shell/commands/sc_pm.c +++ b/sys/shell/commands/sc_pm.c @@ -23,7 +23,9 @@ #include #include #include + #include "periph/pm.h" +#include "shell.h" #ifdef MODULE_PM_LAYERED #include "pm_layered.h" @@ -196,3 +198,5 @@ int _pm_handler(int argc, char **argv) _print_usage(); return 1; } + +SHELL_COMMAND(pm, "interact with layered PM subsystem", _pm_handler); diff --git a/sys/shell/commands/sc_ps.c b/sys/shell/commands/sc_ps.c index 7b31130516..5293cc5b99 100644 --- a/sys/shell/commands/sc_ps.c +++ b/sys/shell/commands/sc_ps.c @@ -19,6 +19,7 @@ */ #include "ps.h" +#include "shell.h" int _ps_handler(int argc, char **argv) { @@ -29,3 +30,5 @@ int _ps_handler(int argc, char **argv) return 0; } + +SHELL_COMMAND(ps, "Prints information about running threads.", _ps_handler); diff --git a/sys/shell/commands/sc_random.c b/sys/shell/commands/sc_random.c index 764885837a..df426a0dbe 100644 --- a/sys/shell/commands/sc_random.c +++ b/sys/shell/commands/sc_random.c @@ -24,12 +24,13 @@ #include #include +#include "random.h" +#include "shell.h" + #ifdef MODULE_XTIMER #include "xtimer.h" #endif -#include "random.h" - int _random_init(int argc, char **argv) { int initval; @@ -55,6 +56,8 @@ int _random_init(int argc, char **argv) return 0; } +SHELL_COMMAND(random_init, "initializes the PRNG", _random_init); + int _random_get(int argc, char **argv) { (void) argc; @@ -64,3 +67,5 @@ int _random_get(int argc, char **argv) return 0; } + +SHELL_COMMAND(random_get, "returns 32 bit of pseudo randomness", _random_get); diff --git a/sys/shell/commands/sc_rtc.c b/sys/shell/commands/sc_rtc.c index 22bbd92089..53d6b19dba 100644 --- a/sys/shell/commands/sc_rtc.c +++ b/sys/shell/commands/sc_rtc.c @@ -26,6 +26,7 @@ #include #include "periph/rtc.h" +#include "shell.h" static void _alarm_handler(void *arg) { @@ -182,3 +183,5 @@ int _rtc_handler(int argc, char **argv) } return 0; } + +SHELL_COMMAND(rtc, "control RTC peripheral interface", _rtc_handler); diff --git a/sys/shell/commands/sc_rtt.c b/sys/shell/commands/sc_rtt.c index 649193fe2f..3dc65401ff 100644 --- a/sys/shell/commands/sc_rtt.c +++ b/sys/shell/commands/sc_rtt.c @@ -25,6 +25,7 @@ #include #include "periph/rtt.h" +#include "shell.h" /* * Since some RTT implementations do not implement all API functions, default @@ -192,3 +193,5 @@ int _rtt_handler(int argc, char **argv) } return 0; } + +SHELL_COMMAND(rtt, "control RTT peripheral interface", _rtt_handler); diff --git a/sys/shell/commands/sc_saul_reg.c b/sys/shell/commands/sc_saul_reg.c index 50037bc82b..9e62a19577 100644 --- a/sys/shell/commands/sc_saul_reg.c +++ b/sys/shell/commands/sc_saul_reg.c @@ -25,6 +25,7 @@ #include #include "saul_reg.h" +#include "shell.h" static const char *_devname(saul_reg_t *dev) { if (dev->name == NULL) { @@ -162,3 +163,5 @@ int _saul(int argc, char **argv) } return 0; } + +SHELL_COMMAND(saul, "interact with sensors and actuators using SAUL", _saul); diff --git a/sys/shell/commands/sc_sht1x.c b/sys/shell/commands/sc_sht1x.c index 79e1bf04c2..8b992e2021 100644 --- a/sys/shell/commands/sc_sht1x.c +++ b/sys/shell/commands/sc_sht1x.c @@ -20,10 +20,13 @@ * @} */ -#include +#include #include +#include #include #include + +#include "shell.h" #include "sht1x.h" #include "sht1x_params.h" @@ -102,6 +105,8 @@ int _get_humidity_handler(int argc, char **argv) return 0; } +SHELL_COMMAND(hum, "Prints measured humidity.", _get_humidity_handler); + int _get_temperature_handler(int argc, char **argv) { int16_t temp; @@ -114,6 +119,8 @@ int _get_temperature_handler(int argc, char **argv) return 0; } +SHELL_COMMAND(temp, "Prints measured temperature.", _get_temperature_handler); + int _get_weather_handler(int argc, char **argv) { int16_t hum; @@ -128,6 +135,8 @@ int _get_weather_handler(int argc, char **argv) return 0; } +SHELL_COMMAND(weather, "Prints measured humidity and temperature.", _get_weather_handler); + static void print_config(const sht1x_dev_t *dev) { 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]); return 0; } + +SHELL_COMMAND(sht_config, "Get/set SHT10/11/15 sensor configuration.", _sht_config_handler); diff --git a/sys/shell/commands/sc_sntp.c b/sys/shell/commands/sc_sntp.c index 80463bc921..911fd89d24 100644 --- a/sys/shell/commands/sc_sntp.c +++ b/sys/shell/commands/sc_sntp.c @@ -21,11 +21,12 @@ #include #include -#include "net/sntp.h" -#include "net/ntp_packet.h" #include "net/af.h" #include "net/gnrc/netif.h" #include "net/ipv6/addr.h" +#include "net/ntp_packet.h" +#include "net/sntp.h" +#include "shell.h" #include "timex.h" #define _DEFAULT_TIMEOUT (500000LU) @@ -101,3 +102,5 @@ int _ntpdate(int argc, char **argv) #endif return 0; } + +SHELL_COMMAND(ntpdate, "synchronizes with a remote time server", _ntpdate); diff --git a/sys/shell/commands/sc_suit.c b/sys/shell/commands/sc_suit.c index ef96734992..4b99cec1a5 100644 --- a/sys/shell/commands/sc_suit.c +++ b/sys/shell/commands/sc_suit.c @@ -22,8 +22,9 @@ #include #include -#include "suit/transport/coap.h" +#include "shell.h" #include "suit/storage.h" +#include "suit/transport/coap.h" static void _print_usage(char **argv) { @@ -53,3 +54,5 @@ int _suit_handler(int argc, char **argv) return 0; } + +SHELL_COMMAND(suit, "Trigger a SUIT firmware update", _suit_handler); diff --git a/sys/shell/commands/sc_sys.c b/sys/shell/commands/sc_sys.c index a79df983f4..7678d3e564 100644 --- a/sys/shell/commands/sc_sys.c +++ b/sys/shell/commands/sc_sys.c @@ -21,6 +21,7 @@ #include #include "periph/pm.h" +#include "shell.h" #ifdef MODULE_USB_BOARD_RESET #include "usb_board_reset.h" @@ -36,6 +37,8 @@ int _reboot_handler(int argc, char **argv) return 0; } +SHELL_COMMAND(reboot, "Reboot the node", _reboot_handler); + #ifdef MODULE_USB_BOARD_RESET int _bootloader_handler(int argc, char **argv) { @@ -46,6 +49,8 @@ int _bootloader_handler(int argc, char **argv) return 0; } + +SHELL_COMMAND(bootloader, "Reboot to bootloader", _bootloader_handler); #endif int _version_handler(int argc, char **argv) @@ -57,3 +62,5 @@ int _version_handler(int argc, char **argv) return 0; } + +SHELL_COMMAND(version, "Prints current RIOT_VERSION", _version_handler); diff --git a/sys/shell/commands/sc_vfs.c b/sys/shell/commands/sc_vfs.c index ed8a001702..9821446530 100644 --- a/sys/shell/commands/sc_vfs.c +++ b/sys/shell/commands/sc_vfs.c @@ -29,6 +29,7 @@ #include #include +#include "shell.h" #include "vfs.h" #if MODULE_VFS_UTIL #include "vfs_util.h" @@ -659,6 +660,8 @@ int _ls_handler(int argc, char **argv) return ret; } +SHELL_COMMAND(ls, "list files", _ls_handler); + int _vfs_handler(int argc, char **argv) { 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) { for (unsigned i = 0; i < len; ++i) { @@ -738,6 +743,8 @@ int _vfs_md5sum_cmd(int argc, char **argv) return 0; } + +SHELL_COMMAND(md5sum, "Compute and check MD5 message digest", _vfs_md5sum_cmd); #endif #if MODULE_SHA1SUM @@ -765,6 +772,8 @@ int _vfs_sha1sum_cmd(int argc, char **argv) return 0; } + +SHELL_COMMAND(sha1sum, "Compute and check SHA1 message digest", _vfs_sha1sum_cmd); #endif #if MODULE_SHA256SUM @@ -792,5 +801,7 @@ int _vfs_sha256sum_cmd(int argc, char **argv) return 0; } + +SHELL_COMMAND(sha256sum, "Compute and check SHA256 message digest", _vfs_sha256sum_cmd); #endif #endif diff --git a/sys/shell/commands/sc_whitelist.c b/sys/shell/commands/sc_whitelist.c index ffc48d2473..b8b3ea69c9 100644 --- a/sys/shell/commands/sc_whitelist.c +++ b/sys/shell/commands/sc_whitelist.c @@ -17,6 +17,7 @@ #include #include "net/gnrc/ipv6/whitelist.h" +#include "shell.h" static void _usage(char *cmd) { @@ -59,4 +60,6 @@ int _whitelist(int argc, char **argv) return 0; } +SHELL_COMMAND(whitelist, "whitelists an address for receival ('whitelist [add|del|help]')", _whitelist); + /** @} */ diff --git a/sys/shell/commands/shell_commands.c b/sys/shell/commands/shell_commands.c deleted file mode 100644 index 71b9b67126..0000000000 --- a/sys/shell/commands/shell_commands.c +++ /dev/null @@ -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 - * @author Zakaria Kasmi - * @author Ludwig Knüpfer - * - * @} - */ - -#include -#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} -}; diff --git a/sys/shell/doc.txt b/sys/shell/doc.txt new file mode 100644 index 0000000000..e1a10c15f8 --- /dev/null +++ b/sys/shell/doc.txt @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2010 Kaspar Schleiser + * + * 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. + */ diff --git a/sys/shell/shell.c b/sys/shell/shell.c index b5f91f4b10..0730f8b1e9 100644 --- a/sys/shell/shell.c +++ b/sys/shell/shell.c @@ -38,7 +38,6 @@ #include "kernel_defines.h" #include "xfa.h" #include "shell.h" -#include "shell_commands.h" /* define shell command cross file array */ 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); } - if (IS_USED(MODULE_SHELL_COMMANDS) && handler == NULL) { - handler = search_commands(_shell_command_list, command); - } - if (handler == NULL) { handler = search_commands_xfa(command); } @@ -146,10 +141,6 @@ static void print_help(const shell_command_t *command_list) print_commands(command_list); } - if (IS_USED(MODULE_SHELL_COMMANDS)) { - print_commands(_shell_command_list); - } - print_commands_xfa(); } diff --git a/tests/driver_at30tse75x/main.c b/tests/driver_at30tse75x/main.c index 6a0f24bafa..fef2ffd4c3 100644 --- a/tests/driver_at30tse75x/main.c +++ b/tests/driver_at30tse75x/main.c @@ -21,7 +21,6 @@ #include #include "shell.h" -#include "shell_commands.h" int main(void) { diff --git a/tests/driver_at86rf215/main.c b/tests/driver_at86rf215/main.c index 4e8cc807a8..c1ca9c4e70 100644 --- a/tests/driver_at86rf215/main.c +++ b/tests/driver_at86rf215/main.c @@ -23,7 +23,6 @@ #include "at86rf215_internal.h" #include "thread.h" #include "shell.h" -#include "shell_commands.h" #include "sys/bus.h" #include "net/gnrc/pktdump.h" diff --git a/tests/driver_at86rf2xx/main.c b/tests/driver_at86rf2xx/main.c index 26a627033a..46da0d403e 100644 --- a/tests/driver_at86rf2xx/main.c +++ b/tests/driver_at86rf2xx/main.c @@ -22,7 +22,6 @@ #include "net/netdev.h" #include "shell.h" -#include "shell_commands.h" #include "thread.h" #include "xtimer.h" diff --git a/tests/driver_ata8520e/main.c b/tests/driver_ata8520e/main.c index f7a1ddd404..d88b3091eb 100644 --- a/tests/driver_ata8520e/main.c +++ b/tests/driver_ata8520e/main.c @@ -24,7 +24,6 @@ #include #include "shell.h" -#include "shell_commands.h" #include "ata8520e_params.h" #include "ata8520e.h" diff --git a/tests/driver_cc110x/main.c b/tests/driver_cc110x/main.c index ace0f61aac..40a982a325 100644 --- a/tests/driver_cc110x/main.c +++ b/tests/driver_cc110x/main.c @@ -22,7 +22,6 @@ #include #include "shell.h" -#include "shell_commands.h" #include "net/gnrc/pktdump.h" #include "net/gnrc.h" diff --git a/tests/driver_dynamixel/main.c b/tests/driver_dynamixel/main.c index e0619fc405..12a808fd7b 100644 --- a/tests/driver_dynamixel/main.c +++ b/tests/driver_dynamixel/main.c @@ -8,7 +8,6 @@ #include "dynamixel.h" #include "shell.h" -#include "shell_commands.h" #include "stdio_uart.h" #include "board.h" #include "periph/gpio.h" diff --git a/tests/driver_feetech/main.c b/tests/driver_feetech/main.c index d5587a5687..d0f04f46ef 100644 --- a/tests/driver_feetech/main.c +++ b/tests/driver_feetech/main.c @@ -8,7 +8,6 @@ #include "feetech.h" #include "shell.h" -#include "shell_commands.h" #include "stdio_uart.h" #include diff --git a/tests/driver_kw2xrf/main.c b/tests/driver_kw2xrf/main.c index 86a7fd8d3e..fed86b7c35 100644 --- a/tests/driver_kw2xrf/main.c +++ b/tests/driver_kw2xrf/main.c @@ -22,7 +22,6 @@ #include "fmt.h" #include "shell.h" #include "kw2xrf.h" -#include "shell_commands.h" #include "net/gnrc.h" #include "net/gnrc/netapi.h" #include "net/netopt.h" diff --git a/tests/driver_netdev_common/main.c b/tests/driver_netdev_common/main.c index ed19c73da9..17cdfdaa8b 100644 --- a/tests/driver_netdev_common/main.c +++ b/tests/driver_netdev_common/main.c @@ -19,7 +19,6 @@ #include "thread.h" #include "shell.h" -#include "shell_commands.h" #include "net/gnrc/pktdump.h" #include "net/gnrc.h" diff --git a/tests/driver_nrf24l01p_lowlevel/main.c b/tests/driver_nrf24l01p_lowlevel/main.c index 2e6c2b8fe9..96bda154a9 100644 --- a/tests/driver_nrf24l01p_lowlevel/main.c +++ b/tests/driver_nrf24l01p_lowlevel/main.c @@ -43,7 +43,6 @@ #include "periph/gpio.h" #include "ztimer.h" #include "shell.h" -#include "shell_commands.h" #include "thread.h" #include "msg.h" diff --git a/tests/driver_nrf24l01p_ng/main.c b/tests/driver_nrf24l01p_ng/main.c index 2a9c08f16b..5a0e9bad24 100644 --- a/tests/driver_nrf24l01p_ng/main.c +++ b/tests/driver_nrf24l01p_ng/main.c @@ -20,7 +20,6 @@ #include #include "shell.h" -#include "shell_commands.h" #include "net/gnrc.h" #define MAIN_QUEUE_SIZE (8) diff --git a/tests/driver_rn2xx3/main.c b/tests/driver_rn2xx3/main.c index 7ce3e7249f..d8107acf16 100644 --- a/tests/driver_rn2xx3/main.c +++ b/tests/driver_rn2xx3/main.c @@ -24,7 +24,6 @@ #include "timex.h" #include "shell.h" -#include "shell_commands.h" #include "fmt.h" #include "rn2xx3.h" diff --git a/tests/driver_sht1x/main.c b/tests/driver_sht1x/main.c index cf9db8927e..9524469d14 100644 --- a/tests/driver_sht1x/main.c +++ b/tests/driver_sht1x/main.c @@ -22,7 +22,6 @@ #include #include "shell.h" -#include "shell_commands.h" #include "sht1x_params.h" #define SHT1X_NUM ARRAY_SIZE(sht1x_params) diff --git a/tests/driver_sx127x/main.c b/tests/driver_sx127x/main.c index 4fe1257c04..6a78db0f1a 100644 --- a/tests/driver_sx127x/main.c +++ b/tests/driver_sx127x/main.c @@ -28,7 +28,6 @@ #include "thread.h" #include "shell.h" -#include "shell_commands.h" #include "net/netdev.h" #include "net/netdev/lora.h" diff --git a/tests/gnrc_gomach/main.c b/tests/gnrc_gomach/main.c index 21ce1c535d..e8a55a1042 100644 --- a/tests/gnrc_gomach/main.c +++ b/tests/gnrc_gomach/main.c @@ -23,7 +23,6 @@ #include "thread.h" #include "shell.h" -#include "shell_commands.h" #include "net/gnrc/pktdump.h" #include "net/gnrc.h" diff --git a/tests/gnrc_lwmac/main.c b/tests/gnrc_lwmac/main.c index ba5785b76b..2451b0367c 100644 --- a/tests/gnrc_lwmac/main.c +++ b/tests/gnrc_lwmac/main.c @@ -28,7 +28,6 @@ #include "thread.h" #include "shell.h" -#include "shell_commands.h" #include "net/gnrc/pktdump.h" #include "net/gnrc.h" diff --git a/tests/heap_cmd/main.c b/tests/heap_cmd/main.c index 7e7fd50d0b..7aa4c54013 100644 --- a/tests/heap_cmd/main.c +++ b/tests/heap_cmd/main.c @@ -18,7 +18,6 @@ #include #include -#include "shell_commands.h" #include "shell.h" static int malloc_cmd(int argc, char **argv) diff --git a/tests/ieee802154_hal/main.c b/tests/ieee802154_hal/main.c index bc7e5f95ae..2460098b95 100644 --- a/tests/ieee802154_hal/main.c +++ b/tests/ieee802154_hal/main.c @@ -32,7 +32,6 @@ #include "net/ieee802154/radio.h" #include "shell.h" -#include "shell_commands.h" #include "test_utils/expect.h" #include "xtimer.h" diff --git a/tests/ieee802154_security/main.c b/tests/ieee802154_security/main.c index 8eb383999b..87900036a8 100644 --- a/tests/ieee802154_security/main.c +++ b/tests/ieee802154_security/main.c @@ -19,7 +19,6 @@ #include "thread.h" #include "shell.h" -#include "shell_commands.h" #include "net/gnrc/pktdump.h" #include "net/gnrc.h" diff --git a/tests/ieee802154_submac/main.c b/tests/ieee802154_submac/main.c index 77a36ee26f..2c275222a6 100644 --- a/tests/ieee802154_submac/main.c +++ b/tests/ieee802154_submac/main.c @@ -27,7 +27,6 @@ #include "net/netdev.h" #include "shell.h" -#include "shell_commands.h" #include "net/ieee802154/submac.h" #include "net/ieee802154.h" #include "net/netdev/ieee802154_submac.h" diff --git a/tests/netstats_l2/main.c b/tests/netstats_l2/main.c index 268d499293..c25641e0c3 100644 --- a/tests/netstats_l2/main.c +++ b/tests/netstats_l2/main.c @@ -21,7 +21,6 @@ #include #include "shell.h" -#include "shell_commands.h" int main(void) { diff --git a/tests/nimble_ext_adv/main.c b/tests/nimble_ext_adv/main.c index 0b3e94c6df..3c5cb3c2b1 100644 --- a/tests/nimble_ext_adv/main.c +++ b/tests/nimble_ext_adv/main.c @@ -25,7 +25,6 @@ #include "timex.h" #include "ztimer.h" #include "shell.h" -#include "shell_commands.h" #include "nimble_scanner.h" #include "nimble_scanlist.h" diff --git a/tests/sched_change_priority/main.c b/tests/sched_change_priority/main.c index 68a9dd7a6e..57294e613f 100644 --- a/tests/sched_change_priority/main.c +++ b/tests/sched_change_priority/main.c @@ -24,7 +24,6 @@ #include "architecture.h" #include "sched.h" #include "shell.h" -#include "shell_commands.h" #include "thread.h" static int sc_hint(int argc, char **argv); diff --git a/tests/shell/main.c b/tests/shell/main.c index 4556873f2a..29aef11b12 100644 --- a/tests/shell/main.c +++ b/tests/shell/main.c @@ -21,7 +21,6 @@ #include #include -#include "shell_commands.h" #include "shell.h" #if MODULE_STDIO_RTT diff --git a/tests/slip/main.c b/tests/slip/main.c index 89fbaf88c0..969b3f916d 100644 --- a/tests/slip/main.c +++ b/tests/slip/main.c @@ -21,7 +21,6 @@ #include #include "shell.h" -#include "shell_commands.h" #include "net/gnrc.h" #include "net/gnrc/pktdump.h" diff --git a/tests/sock_udp_aux/main.c b/tests/sock_udp_aux/main.c index bd0f48e031..fc59420a96 100644 --- a/tests/sock_udp_aux/main.c +++ b/tests/sock_udp_aux/main.c @@ -25,7 +25,6 @@ #include "fmt.h" #include "net/sock/udp.h" #include "shell.h" -#include "shell_commands.h" #include "net/ipv6/addr.h" #define MAIN_QUEUE_SIZE (8) diff --git a/tests/stm32_bootloader/main.c b/tests/stm32_bootloader/main.c index f61f9fc6b5..c322297acf 100644 --- a/tests/stm32_bootloader/main.c +++ b/tests/stm32_bootloader/main.c @@ -22,7 +22,6 @@ #include #include "shell.h" -#include "shell_commands.h" int main(void) { diff --git a/tests/sys_stdio_semihosting/main.c b/tests/sys_stdio_semihosting/main.c index 5a8518c3aa..b5bebd10d7 100644 --- a/tests/sys_stdio_semihosting/main.c +++ b/tests/sys_stdio_semihosting/main.c @@ -22,7 +22,6 @@ #include #include "shell.h" -#include "shell_commands.h" int main(void) { diff --git a/tests/test_tools/main.c b/tests/test_tools/main.c index cb1259a408..88a481533e 100644 --- a/tests/test_tools/main.c +++ b/tests/test_tools/main.c @@ -19,7 +19,6 @@ #include #include "kernel_defines.h" -#include "shell_commands.h" #include "shell.h" #if !IS_ACTIVE(CONFIG_SHELL_NO_ECHO) || !IS_ACTIVE(CONFIG_SHELL_NO_PROMPT) diff --git a/tests/usbus_cdc_acm_stdio/main.c b/tests/usbus_cdc_acm_stdio/main.c index b1f637727d..c603882121 100644 --- a/tests/usbus_cdc_acm_stdio/main.c +++ b/tests/usbus_cdc_acm_stdio/main.c @@ -21,7 +21,6 @@ #include #include "shell.h" -#include "shell_commands.h" static int cmd_text(int argc, char **argv) { diff --git a/tests/vfs_default/main.c b/tests/vfs_default/main.c index 3cf3746e4b..48515670f3 100644 --- a/tests/vfs_default/main.c +++ b/tests/vfs_default/main.c @@ -20,7 +20,6 @@ #include #include "shell.h" -#include "shell_commands.h" #include "vfs_default.h" int main(void)