From 51762a89587e82fc7318f5ed270106a62aa269c4 Mon Sep 17 00:00:00 2001 From: wangyongrong Date: Fri, 3 Nov 2023 18:10:07 +0800 Subject: [PATCH] nsh cmd rptun: add rptun ping useage description Signed-off-by: wangyongrong --- nshlib/nsh_command.c | 2 +- nshlib/nsh_syscmds.c | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/nshlib/nsh_command.c b/nshlib/nsh_command.c index 4320aabfb..cb0420af5 100644 --- a/nshlib/nsh_command.c +++ b/nshlib/nsh_command.c @@ -514,7 +514,7 @@ static const struct cmdmap_s g_cmdmap[] = #endif #if defined(CONFIG_RPTUN) && !defined(CONFIG_NSH_DISABLE_RPTUN) - CMD_MAP("rptun", cmd_rptun, 3, 7, + CMD_MAP("rptun", cmd_rptun, 2, 7, " " " [value|times length ack sleep]"), #endif diff --git a/nshlib/nsh_syscmds.c b/nshlib/nsh_syscmds.c index eb81fbb1b..82bc405d2 100644 --- a/nshlib/nsh_syscmds.c +++ b/nshlib/nsh_syscmds.c @@ -605,6 +605,27 @@ static int cmd_rptun_recursive(FAR struct nsh_vtbl_s *vtbl, int cmd_rptun(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv) { + if (argc >= 2 && strcmp(argv[1], "-h") == 0) + { + nsh_output(vtbl, "usage:\n"); + nsh_output(vtbl, " rptun " + "\n"); + nsh_output(vtbl, " rptun \n"); + nsh_output(vtbl, " rptun ping " + "\n\n"); + nsh_output(vtbl, " Rptun device path.\n"); + nsh_output(vtbl, " Times of rptun ping.\n"); + nsh_output(vtbl, " The length of each ping packet.\n"); + nsh_output(vtbl, " Whether the peer acknowlege or " + "check data.\n"); + nsh_output(vtbl, " 0 - No acknowledge and check.\n"); + nsh_output(vtbl, " 1 - Acknowledge, no data check.\n"); + nsh_output(vtbl, " 2 - Acknowledge and data check.\n"); + nsh_output(vtbl, " ping period (ms) \n\n"); + + return OK; + } + if (argc < 3) { nsh_output(vtbl, g_fmtargrequired, argv[0]);