mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-28 19:13:33 +08:00
Recover changes lost to bad merging.
This commit is contained in:
+98
-2
@@ -23,122 +23,194 @@ config NSH_BUILTIN_APPS
|
||||
(NAMEDAPP).
|
||||
|
||||
menu "Disable Individual commands"
|
||||
|
||||
config NSH_DISABLE_BASE64DEC
|
||||
bool "Disable base64dec"
|
||||
default n
|
||||
depends on NETUTILS_CODECS && CODECS_BASE64
|
||||
|
||||
config NSH_DISABLE_BASE64ENC
|
||||
bool "Disable base64enc"
|
||||
default n
|
||||
depends on NETUTILS_CODECS && CODECS_BASE64
|
||||
|
||||
config NSH_DISABLE_CAT
|
||||
bool "Disable cat"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_CD
|
||||
bool "Disable cd"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_CP
|
||||
bool "Disable cp"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_DD
|
||||
bool "Disable dd"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_ECHO
|
||||
bool "Disable echo"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_EXEC
|
||||
bool "Disable exec"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_EXIT
|
||||
bool "Disable exit"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_FREE
|
||||
bool "Disable free"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_GET
|
||||
bool "Disable get"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_HELP
|
||||
bool "Disable help"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_HEXDUMP
|
||||
bool "Disable hexdump"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_IFCONFIG
|
||||
bool "Disable ifconfig"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_KILL
|
||||
bool "Disable kill"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_LOSETUP
|
||||
bool "Disable losetup"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_LS
|
||||
bool "Disable ls"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_MB
|
||||
bool "Disable mb"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_MD5
|
||||
bool "Disable md5"
|
||||
default n
|
||||
depends on NETUTILS_CODECS && CODECS_HASH_MD5
|
||||
|
||||
config NSH_DISABLE_MKDIR
|
||||
bool "Disable mkdir"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_MKFATFS
|
||||
bool "Disable mkfatfs"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_MKFIFO
|
||||
bool "Disable mkfifo"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_MKRD
|
||||
bool "Disable mkrd"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_MH
|
||||
bool "Disable mh"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_MOUNT
|
||||
bool "Disable mount"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_MW
|
||||
bool "Disable mw"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_NSFMOUNT
|
||||
bool "Disable nfsmount"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_PS
|
||||
bool "Disable ps"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_PING
|
||||
bool "Disable ping"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_PUT
|
||||
bool "Disable put"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_PWD
|
||||
bool "Disable pwd"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_RM
|
||||
bool "Disable rm"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_RMDIR
|
||||
bool "Disable rmdir"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_SET
|
||||
bool "Disable set"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_SH
|
||||
bool "Disable sh"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_SLEEP
|
||||
bool "Disable sleep"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_TEST
|
||||
bool "Disable test"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_UMOUNT
|
||||
bool "Disable umount"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_UNSET
|
||||
bool "Disable unset"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_URLDECODE
|
||||
bool "Disable urldecode"
|
||||
default n
|
||||
depends on NETUTILS_CODECS && CODECS_URLCODE
|
||||
|
||||
config NSH_DISABLE_URLENCODE
|
||||
bool "Disable urlencode"
|
||||
default n
|
||||
depends on NETUTILS_CODECS && CODECS_URLCODE
|
||||
|
||||
config NSH_DISABLE_USLEEP
|
||||
bool "Disable usleep"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_WGET
|
||||
bool "Disable wget"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_XD
|
||||
bool "Disable xd"
|
||||
default n
|
||||
|
||||
endmenu
|
||||
|
||||
config NSH_CODECS_BUFSIZE
|
||||
int "File buffer size used by CODEC commands"
|
||||
default 128
|
||||
|
||||
config NSH_FILEIOSIZE
|
||||
int "NSH I/O buffer size"
|
||||
default 1024
|
||||
@@ -490,7 +562,7 @@ config NSH_DHCPC
|
||||
|
||||
config NSH_IPADDR
|
||||
hex "Target IP address"
|
||||
default 0x10000002
|
||||
default 0xa0000002
|
||||
depends on NSH_LIBRARY && NET && !NSH_DHCPC
|
||||
---help---
|
||||
If NSH_DHCPC is NOT set, then the static IP address must be provided.
|
||||
@@ -499,7 +571,7 @@ config NSH_IPADDR
|
||||
|
||||
config NSH_DRIPADDR
|
||||
hex "Router IP address"
|
||||
default 0x10000001
|
||||
default 0xa0000001
|
||||
depends on NSH_LIBRARY && NET && !NSH_DHCPC
|
||||
---help---
|
||||
Default router IP address (aka, Gateway). This is a 32-bit integer
|
||||
@@ -513,6 +585,21 @@ config NSH_NETMASK
|
||||
Network mask. This is a 32-bit integer value in host order. So, as
|
||||
an example, 0xffffff00 would be 255.255.255.0.
|
||||
|
||||
config NSH_DNS
|
||||
bool "Use DNS"
|
||||
default n
|
||||
depends on NSH_LIBRARY && NET && NET_UDP && NET_BROADCAST
|
||||
---help---
|
||||
Configure to use a DNS.
|
||||
|
||||
config NSH_DNSIPADDR
|
||||
hex "DNS IP address"
|
||||
default 0xa0000001
|
||||
depends on NSH_DNS
|
||||
---help---
|
||||
Configure the DNS address. This is a 32-bit integer value in host
|
||||
order. So, as an example, 0xa0000001 would be 10.0.0.1.
|
||||
|
||||
config NSH_NOMAC
|
||||
bool "Hardware has no MAC address"
|
||||
default n
|
||||
@@ -520,3 +607,12 @@ config NSH_NOMAC
|
||||
---help---
|
||||
Set if your ethernet hardware has no built-in MAC address.
|
||||
If set, a bogus MAC will be assigned.
|
||||
|
||||
config NSH_MAX_ROUNDTRIP
|
||||
int "Max Ping Round-Trip (DSEC)"
|
||||
default 20
|
||||
depends on NSH_LIBRARY && NET && !NSH_DISABLE_PING
|
||||
---help---
|
||||
This is the maximum round trip for a response to a ICMP ECHO request.
|
||||
It is in units of deciseconds. The default is 20 (2 seconds).
|
||||
|
||||
|
||||
+35
-28
@@ -39,64 +39,72 @@ include $(APPDIR)/Make.defs
|
||||
|
||||
# NSH Library
|
||||
|
||||
ASRCS =
|
||||
CSRCS = nsh_init.c nsh_parse.c nsh_console.c nsh_fscmds.c nsh_ddcmd.c \
|
||||
ASRCS =
|
||||
CSRCS = nsh_init.c nsh_parse.c nsh_console.c nsh_fscmds.c nsh_ddcmd.c \
|
||||
nsh_proccmds.c nsh_mmcmds.c nsh_envcmds.c nsh_dbgcmds.c
|
||||
|
||||
ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
|
||||
CSRCS += nsh_apps.c
|
||||
CSRCS += nsh_apps.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_NSH_ROMFSETC),y)
|
||||
CSRCS += nsh_romfsetc.c
|
||||
CSRCS += nsh_romfsetc.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_NET),y)
|
||||
CSRCS += nsh_netinit.c nsh_netcmds.c
|
||||
CSRCS += nsh_netinit.c nsh_netcmds.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_RTC),y)
|
||||
CSRCS += nsh_timcmds.c
|
||||
CSRCS += nsh_timcmds.c
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_DISABLE_MOUNTPOINT),y)
|
||||
CSRCS += nsh_mntcmds.c
|
||||
CSRCS += nsh_mntcmds.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_NSH_CONSOLE),y)
|
||||
CSRCS += nsh_consolemain.c
|
||||
CSRCS += nsh_consolemain.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_NSH_TELNET),y)
|
||||
CSRCS += nsh_telnetd.c
|
||||
CSRCS += nsh_telnetd.c
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_NSH_DISABLESCRIPT),y)
|
||||
CSRCS += nsh_test.c
|
||||
CSRCS += nsh_test.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_USBDEV),y)
|
||||
CSRCS += nsh_usbdev.c
|
||||
CSRCS += nsh_usbdev.c
|
||||
endif
|
||||
|
||||
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
||||
COBJS = $(CSRCS:.c=$(OBJEXT))
|
||||
ifeq ($(CONFIG_NETUTILS_CODECS),y)
|
||||
CSRCS += nsh_codeccmd.c
|
||||
endif
|
||||
|
||||
SRCS = $(ASRCS) $(CSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS)
|
||||
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
||||
COBJS = $(CSRCS:.c=$(OBJEXT))
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
|
||||
SRCS = $(ASRCS) $(CSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS)
|
||||
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
BIN = ..\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = "$(APPDIR)/libapps$(LIBEXT)"
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = ..\\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = ../libapps$(LIBEXT)
|
||||
endif
|
||||
endif
|
||||
|
||||
ROOTDEPPATH = --dep-path .
|
||||
VPATH =
|
||||
ROOTDEPPATH = --dep-path .
|
||||
VPATH =
|
||||
|
||||
# Build targets
|
||||
|
||||
all: .built
|
||||
all: .built
|
||||
.PHONY: context .depend depend clean distclean
|
||||
|
||||
$(AOBJS): %$(OBJEXT): %.S
|
||||
@@ -106,26 +114,25 @@ $(COBJS): %$(OBJEXT): %.c
|
||||
$(call COMPILE, $<, $@)
|
||||
|
||||
.built: $(OBJS)
|
||||
@( for obj in $(OBJS) ; do \
|
||||
$(call ARCHIVE, $(BIN), $${obj}); \
|
||||
done ; )
|
||||
$(call ARCHIVE, $(BIN), $(OBJS))
|
||||
@touch .built
|
||||
|
||||
context:
|
||||
|
||||
.depend: Makefile $(SRCS)
|
||||
@$(MKDEP) $(ROOTDEPPATH) \
|
||||
$(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@touch $@
|
||||
|
||||
depend: .depend
|
||||
|
||||
clean:
|
||||
@rm -f *.o *~ .*.swp .built
|
||||
$(call DELFILE, .built)
|
||||
$(call CLEAN)
|
||||
|
||||
distclean: clean
|
||||
@rm -f Make.dep .depend
|
||||
$(call DELFILE, .context)
|
||||
$(call DELFILE, Make.dep)
|
||||
$(call DELFILE, .depend)
|
||||
|
||||
-include Make.dep
|
||||
|
||||
|
||||
@@ -46,6 +46,10 @@
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
# include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#include "nsh.h"
|
||||
#include "nsh_console.h"
|
||||
|
||||
@@ -328,7 +332,7 @@ void nsh_dumpbuffer(FAR struct nsh_vtbl_s *vtbl, const char *msg,
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: cmd_xd
|
||||
* Name: cmd_xd, hex dump of memory
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_NSH_DISABLE_XD
|
||||
@@ -354,3 +358,58 @@ int cmd_xd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: cmd_hexdump, hex dump of files
|
||||
****************************************************************************/
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
#ifndef CONFIG_NSH_DISABLE_HEXDUMP
|
||||
int cmd_hexdump(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
uint8_t buffer[IOBUFFERSIZE];
|
||||
char msg[32];
|
||||
int position;
|
||||
int fd;
|
||||
int ret = OK;
|
||||
|
||||
/* Open the file for reading */
|
||||
|
||||
fd = open(argv[1], O_RDONLY);
|
||||
if (fd < 0)
|
||||
{
|
||||
nsh_output(vtbl, g_fmtcmdfailed, "hexdump", "open", NSH_ERRNO);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
position = 0;
|
||||
for (;;)
|
||||
{
|
||||
int nbytesread = read(fd, buffer, IOBUFFERSIZE);
|
||||
|
||||
/* Check for read errors */
|
||||
|
||||
if (nbytesread < 0)
|
||||
{
|
||||
int errval = errno;
|
||||
nsh_output(vtbl, g_fmtcmdfailed, "hexdump", "read", NSH_ERRNO_OF(errval));
|
||||
ret = ERROR;
|
||||
break;
|
||||
}
|
||||
else if (nbytesread > 0)
|
||||
{
|
||||
snprintf(msg, sizeof(msg), "%s at %08x", argv[1], position);
|
||||
nsh_dumpbuffer(vtbl, msg, buffer, nbytesread);
|
||||
position += nbytesread;
|
||||
}
|
||||
else
|
||||
{
|
||||
break; // EOF
|
||||
}
|
||||
}
|
||||
|
||||
(void)close(fd);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
#include <net/if.h>
|
||||
|
||||
#include <apps/netutils/uiplib.h>
|
||||
#if defined(CONFIG_NSH_DHCPC)
|
||||
#if defined(CONFIG_NSH_DHCPC) || defined(CONFIG_NSH_DNS)
|
||||
# include <apps/netutils/resolv.h>
|
||||
# include <apps/netutils/dhcpc.h>
|
||||
#endif
|
||||
@@ -60,6 +60,10 @@
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_NSH_DRIPADDR) && !defined(CONFIG_NSH_DNSIPADDR)
|
||||
# define CONFIG_NSH_DNSIPADDR CONFIG_NSH_DRIPADDR
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
@@ -125,10 +129,14 @@ int nsh_netinit(void)
|
||||
addr.s_addr = HTONL(CONFIG_NSH_NETMASK);
|
||||
uip_setnetmask("eth0", &addr);
|
||||
|
||||
#if defined(CONFIG_NSH_DHCPC)
|
||||
#if defined(CONFIG_NSH_DHCPC) || defined(CONFIG_NSH_DNS)
|
||||
/* Set up the resolver */
|
||||
|
||||
resolv_init();
|
||||
#if defined(CONFIG_NSH_DNS)
|
||||
addr.s_addr = HTONL(CONFIG_NSH_DNSIPADDR);
|
||||
resolv_conf(&addr);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NSH_DHCPC)
|
||||
|
||||
Reference in New Issue
Block a user