mirror of
https://github.com/apache/nuttx-apps.git
synced 2025-10-17 07:12:06 +08:00
rptun: add rptun ping support
Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
@@ -348,6 +348,7 @@ int cmd_reset_cause(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
static int cmd_rptun_once(FAR struct nsh_vtbl_s *vtbl, char *path,
|
||||
int argc, char **argv)
|
||||
{
|
||||
struct rptun_ping_s ping;
|
||||
unsigned long val = 0;
|
||||
int cmd;
|
||||
int fd;
|
||||
@@ -377,6 +378,21 @@ static int cmd_rptun_once(FAR struct nsh_vtbl_s *vtbl, char *path,
|
||||
{
|
||||
cmd = RPTUNIOC_DUMP;
|
||||
}
|
||||
else if (strcmp(argv[1], "ping") == 0)
|
||||
{
|
||||
if (argc != 6)
|
||||
{
|
||||
nsh_output(vtbl, g_fmtarginvalid, path);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
ping.times = atoi(argv[3]);
|
||||
ping.len = atoi(argv[4]);
|
||||
ping.ack = atoi(argv[5]);
|
||||
|
||||
cmd = RPTUNIOC_PING;
|
||||
val = (unsigned long)&ping;
|
||||
}
|
||||
else
|
||||
{
|
||||
nsh_output(vtbl, g_fmtarginvalid, argv[1]);
|
||||
@@ -386,7 +402,7 @@ static int cmd_rptun_once(FAR struct nsh_vtbl_s *vtbl, char *path,
|
||||
fd = open(path, 0);
|
||||
if (fd < 0)
|
||||
{
|
||||
nsh_output(vtbl, g_fmtarginvalid, argv[2]);
|
||||
nsh_output(vtbl, g_fmtarginvalid, path);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user