Several patches from Petteri Aimonen (mostly NxWidgets)
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5324 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
d4799a459f
commit
b60be3682d
@ -411,4 +411,7 @@
|
||||
* apps/examples/ostest/roundrobin.c: Replace large tables with
|
||||
algorithmic prime number generation. This allows the roundrobin
|
||||
test to run on platforms with minimal SRAM (Freddie Chopin).
|
||||
* apps/nshlib/nsh_dbgcmds.c: Add hexdump command to dump the contents
|
||||
of a file (or character device) to the console Contributed by Petteri
|
||||
Aimonen.
|
||||
|
||||
|
@ -308,6 +308,14 @@ config NXWM_TASKBAR_WIDTH
|
||||
---help---
|
||||
Task bar thickness (either vertical or horizontal). Default: 25 + 2*spacing
|
||||
|
||||
config NXWM_DISABLE_MINIMIZE
|
||||
bool "Disable Minimize Button"
|
||||
default n
|
||||
---help---
|
||||
If the "desktop" is empty, users have no need to minimize any windows. If the buttons
|
||||
are small, it's easy to hit minimize button accidentally when trying to close an
|
||||
application.
|
||||
|
||||
comment "Tool Bar Configuration"
|
||||
|
||||
config NXWM_TOOLBAR_HEIGHT
|
||||
@ -319,8 +327,16 @@ config NXWM_TOOLBAR_HEIGHT
|
||||
|
||||
comment "Background Image"
|
||||
|
||||
config NXWM_DISABLE_BACKGROUND_IMAGE
|
||||
bool "Disable Background Image"
|
||||
default n if !NXWM_DISABLE_MINIMIZE
|
||||
default y if NXWM_DISABLE_MINIMIZE
|
||||
---help---
|
||||
Disable support for the "Desktop" background image.
|
||||
|
||||
config NXWM_BACKGROUND_IMAGE
|
||||
string "Background Image"
|
||||
depends on !NXWM_DISABLE_BACKGROUND_IMAGE
|
||||
---help---
|
||||
The name of the image to use in the background window. Default:
|
||||
NXWidgets::g_nuttxBitmap
|
||||
|
@ -74,6 +74,10 @@ 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
|
||||
|
@ -385,6 +385,10 @@ o help [-v] [<cmd>]
|
||||
<cmd>
|
||||
Show full command usage only for this command
|
||||
|
||||
o hexdump <file or device>
|
||||
|
||||
Dump data in hexadecimal format from a file or character device.
|
||||
|
||||
o ifconfig [nic_name [ip]] [dr|gw|gateway <dr-address>] [netmask <net-mask>] [dns <dns-address>] [hw <hw-mac>]
|
||||
|
||||
Show the current configuration of the network, for example:
|
||||
@ -865,6 +869,7 @@ Command Dependencies on Configuration Settings
|
||||
free --
|
||||
get CONFIG_NET && CONFIG_NET_UDP && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NET_BUFSIZE >= 558 (see note 1)
|
||||
help --
|
||||
hexdump CONFIG_NFILE_DESCRIPTORS > 0
|
||||
ifconfig CONFIG_NET
|
||||
ifdown CONFIG_NET
|
||||
ifup CONFIG_NET
|
||||
@ -917,18 +922,18 @@ also allow it to squeeze into very small memory footprints.
|
||||
CONFIG_NSH_DISABLE_CD, CONFIG_NSH_DISABLE_CP, CONFIG_NSH_DISABLE_DD,
|
||||
CONFIG_NSH_DISABLE_DF, CONFIG_NSH_DISABLE_ECHO, CONFIG_NSH_DISABLE_EXEC,
|
||||
CONFIG_NSH_DISABLE_EXIT, CONFIG_NSH_DISABLE_FREE, CONFIG_NSH_DISABLE_GET,
|
||||
CONFIG_NSH_DISABLE_HELP, CONFIG_NSH_DISABLE_IFCONFIG, CONFIG_NSH_DISABLE_IFUPDOWN,
|
||||
CONFIG_NSH_DISABLE_KILL, CONFIG_NSH_DISABLE_LOSETUP, CONFIG_NSH_DISABLE_LS,
|
||||
CONFIG_NSH_DISABLE_MD5 CONFIG_NSH_DISABLE_MB, CONFIG_NSH_DISABLE_MKDIR,
|
||||
CONFIG_NSH_DISABLE_MKFATFS, CONFIG_NSH_DISABLE_MKFIFO, CONFIG_NSH_DISABLE_MKRD,
|
||||
CONFIG_NSH_DISABLE_MH, CONFIG_NSH_DISABLE_MOUNT, CONFIG_NSH_DISABLE_MW,
|
||||
CONFIG_NSH_DISABLE_MV, CONFIG_NSH_DISABLE_NFSMOUNT, CONFIG_NSH_DISABLE_PS,
|
||||
CONFIG_NSH_DISABLE_PING, CONFIG_NSH_DISABLE_PUT, CONFIG_NSH_DISABLE_PWD,
|
||||
CONFIG_NSH_DISABLE_RM, CONFIG_NSH_DISABLE_RMDIR, CONFIG_NSH_DISABLE_SET,
|
||||
CONFIG_NSH_DISABLE_SH, CONFIG_NSH_DISABLE_SLEEP, CONFIG_NSH_DISABLE_TEST,
|
||||
CONFIG_NSH_DISABLE_UMOUNT, CONFIG_NSH_DISABLE_UNSET, CONFIG_NSH_DISABLE_URLDECODE,
|
||||
CONFIG_NSH_DISABLE_URLENCODE, CONFIG_NSH_DISABLE_USLEEP, CONFIG_NSH_DISABLE_WGET,
|
||||
CONFIG_NSH_DISABLE_XD
|
||||
CONFIG_NSH_DISABLE_HELP, CONFIG_NSH_DISABLE_HEXDUMP, CONFIG_NSH_DISABLE_IFCONFIG,
|
||||
CONFIG_NSH_DISABLE_IFUPDOWN, CONFIG_NSH_DISABLE_KILL, CONFIG_NSH_DISABLE_LOSETUP,
|
||||
CONFIG_NSH_DISABLE_LS, CONFIG_NSH_DISABLE_MD5 CONFIG_NSH_DISABLE_MB,
|
||||
CONFIG_NSH_DISABLE_MKDIR, CONFIG_NSH_DISABLE_MKFATFS, CONFIG_NSH_DISABLE_MKFIFO,
|
||||
CONFIG_NSH_DISABLE_MKRD, CONFIG_NSH_DISABLE_MH, CONFIG_NSH_DISABLE_MOUNT,
|
||||
CONFIG_NSH_DISABLE_MW, CONFIG_NSH_DISABLE_MV, CONFIG_NSH_DISABLE_NFSMOUNT,
|
||||
CONFIG_NSH_DISABLE_PS, CONFIG_NSH_DISABLE_PING, CONFIG_NSH_DISABLE_PUT,
|
||||
CONFIG_NSH_DISABLE_PWD, CONFIG_NSH_DISABLE_RM, CONFIG_NSH_DISABLE_RMDIR,
|
||||
CONFIG_NSH_DISABLE_SET, CONFIG_NSH_DISABLE_SH, CONFIG_NSH_DISABLE_SLEEP,
|
||||
CONFIG_NSH_DISABLE_TEST, CONFIG_NSH_DISABLE_UMOUNT, CONFIG_NSH_DISABLE_UNSET,
|
||||
CONFIG_NSH_DISABLE_URLDECODE, CONFIG_NSH_DISABLE_URLENCODE, CONFIG_NSH_DISABLE_USLEEP,
|
||||
CONFIG_NSH_DISABLE_WGET, CONFIG_NSH_DISABLE_XD
|
||||
|
||||
Verbose help output can be suppressed by defining CONFIG_NSH_HELP_TERSE. In that
|
||||
case, the help command is still available but will be slightly smaller.
|
||||
|
@ -47,6 +47,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/usb/usbdev_trace.h>
|
||||
@ -540,7 +541,7 @@ void nsh_usbtrace(void);
|
||||
#ifndef CONFIG_NSH_DISABLE_XD
|
||||
int cmd_xd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(CONFIG_NSH_DISABLESCRIPT) && !defined(CONFIG_NSH_DISABLE_TEST)
|
||||
int cmd_test(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
int cmd_lbracket(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
@ -562,6 +563,9 @@ void nsh_usbtrace(void);
|
||||
# ifndef CONFIG_NSH_DISABLE_DD
|
||||
int cmd_dd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
# endif
|
||||
# ifndef CONFIG_NSH_DISABLE_HEXDUMP
|
||||
int cmd_hexdump(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
# endif
|
||||
# ifndef CONFIG_NSH_DISABLE_LS
|
||||
int cmd_ls(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
# endif
|
||||
|
@ -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"
|
||||
|
||||
@ -327,7 +331,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
|
||||
@ -353,3 +357,57 @@ 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];
|
||||
int fd;
|
||||
int ret = OK;
|
||||
char msg[32];
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
int 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
|
||||
|
@ -226,6 +226,12 @@ static const struct cmdmap_s g_cmdmap[] =
|
||||
{ "help", cmd_help, 1, 3, "[-v] [<cmd>]" },
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
#ifndef CONFIG_NSH_DISABLE_HEXDUMP
|
||||
{ "hexdump", cmd_hexdump, 2, 2, "<file or device>" },
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NET
|
||||
# ifndef CONFIG_NSH_DISABLE_IFCONFIG
|
||||
|
Loading…
Reference in New Issue
Block a user