summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-05-05 08:52:02 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-05-05 08:52:02 -0600
commit6029fd4a574baaaf8baef4fefa4d1ca5c082729f (patch)
tree5d9f3349abfe1fc99c96523cbb77d0ba9140d4bf /apps
parent52cc0b12520c403609e3e32e3e5e07e12c5f9e3b (diff)
downloadnuttx-6029fd4a574baaaf8baef4fefa4d1ca5c082729f.tar.gz
nuttx-6029fd4a574baaaf8baef4fefa4d1ca5c082729f.tar.bz2
nuttx-6029fd4a574baaaf8baef4fefa4d1ca5c082729f.zip
The alternate console device CONFIG_NSH_CONDEV must not be defined unconditionally. This causes errors when using Telnet sessions. This was solved by adding CONFIG_NSH_ALTCONDEV: CONFIG_NSH_ALTCONDEV enables or disables the feature then, if enabled, CONFIG_NSH_CONDEV provides the alternative console device name
Diffstat (limited to 'apps')
-rw-r--r--apps/ChangeLog.txt5
-rw-r--r--apps/include/nsh.h2
-rw-r--r--apps/nshlib/Kconfig63
-rw-r--r--apps/nshlib/README.txt36
-rw-r--r--apps/nshlib/nsh.h2
-rw-r--r--apps/nshlib/nsh_console.c4
-rw-r--r--apps/nshlib/nsh_console.h16
7 files changed, 92 insertions, 36 deletions
diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt
index 80acd6d39..5ece3b225 100644
--- a/apps/ChangeLog.txt
+++ b/apps/ChangeLog.txt
@@ -903,3 +903,8 @@
* apps/examples/serialblaster: Update configuration an make logic in
order to select that the serial blaster task priority and stack size.
From Bob Doiron (2014-4-30).
+ * apps/nshlib/Kconfig and other NSH files: The alternate console device
+ CONFIG_NSH_CONDEV must not be defined unconditionally. This causes errors
+ when using Telnet sessions. This was solved by adding CONFIG_NSH_ALTCONDEV:
+ CONFIG_NSH_ALTCONDEV enables or disables the feature then, if enabled,
+ CONFIG_NSH_CONDEV provides the alternative console device name (2014-5-5).
diff --git a/apps/include/nsh.h b/apps/include/nsh.h
index ff9eb22dd..e16c85924 100644
--- a/apps/include/nsh.h
+++ b/apps/include/nsh.h
@@ -63,7 +63,7 @@
# define HAVE_USB_CONSOLE 1
/* Check for a generic USB console. In this case, the USB console device
- * must be provided in CONFIG_NSH_CONDEV.
+ * must be provided in CONFIG_NSH_USBCONDEV.
*/
# elif defined(CONFIG_NSH_USBCONSOLE)
diff --git a/apps/nshlib/Kconfig b/apps/nshlib/Kconfig
index 3f48f76db..4440fcaca 100644
--- a/apps/nshlib/Kconfig
+++ b/apps/nshlib/Kconfig
@@ -675,26 +675,63 @@ config NSH_USBDEV_TRACEINTERRUPTS
endif # NSH_USBDEV_TRACE
+config NSH_ALTCONDEV
+ bool "Alternative console device"
+ default n
+ depends on NSH_CONSOLE && !NSH_USBCONSOLE && !NSH_TELNET
+ ---help---
+ If CONFIG_NSH_CONSOLE is set to y, then CONFIG_NSH_ALTCONDEV may
+ also be selected to enable use of an alternate character device
+ to support the NSH console. If CONFIG_NSH_ALTCONDEV is selected,
+ then NSH_CONDEV must be set to select the serial device used to
+ support the NSH console. This may be useful, for example, to
+ separate the NSH command line from the system console when the
+ system console is used to provide debug output. Default: stdin
+ and stdout (probably "/dev/console")
+
+ NOTE 1: When any other device other than /dev/console is used
+ for a user interface, (1) linefeeds (\n) will not be expanded to
+ carriage return / linefeeds (\r\n). You will need to set
+ your terminal program to account for this. And (2) input is
+ not automatically echoed so you will have to turn local echo on.
+
+ NOTE 2: This option forces the console of all sessions to use
+ NSH_CONDEV. Hence, this option only makes sense for a system
+ that supports only a single session. This option is, in
+ particular, incompatible with Telnet sessions because each Telnet
+ session must use a different console device.
+
+if NSH_ALTCONDEV
+
config NSH_CONDEV
- string "Default console device"
+ string "Alternative console device name"
default "/dev/console"
- depends on NSH_CONSOLE && !NSH_USBCONSOLE
- ---help---
- If NSH_CONSOLE is set to 'y', then NSH_CONDEV
- may also be set to select the serial device used to support
- the NSH console. This should be set to the quoted name of a
- readable/write-able character driver such as:
- NSH_CONDEV="/dev/ttyS1". This is useful, for example,
- to separate the NSH command line from the system console when
- the system console is used to provide debug output. Default:
- stdin and stdout (probably "/dev/console")
-
- NOTE: When any other device other than /dev/console is used
+ ---help---
+ If CONFIG_NSH_CONSOLE is set to y, then CONFIG_NSH_ALTCONDEV may
+ also be selected to enable use of an alternate character device
+ to support the NSH console. If CONFIG_NSH_ALTCONDEV is selected,
+ then NSH_CONDEV must be set to select the serial device used to
+ support the NSH console. This should be set to the quoted name
+ of a readable/write-able character driver such as:
+ NSH_CONDEV="/dev/ttyS1". This is useful, for example, to separate
+ the NSH command line from the system console when the system console
+ is used to provide debug output. Default: stdin and stdout
+ (probably "/dev/console")
+
+ NOTE 1: When any other device other than /dev/console is used
for a user interface, (1) linefeeds (\n) will not be expanded to
carriage return / linefeeds (\r\n). You will need to set
your terminal program to account for this. And (2) input is
not automatically echoed so you will have to turn local echo on.
+ NOTE 2: This option forces the console of all sessions to use
+ NSH_CONDEV. Hence, this option only makes sense for a system
+ that supports only a single session. This option is, in
+ particular, incompatible with Telnet sessions because each Telnet
+ session must use a different console device.
+
+endif # NSH_ALTCONDEV
+
config NSH_ARCHINIT
bool "Have architecture-specific initialization"
default n
diff --git a/apps/nshlib/README.txt b/apps/nshlib/README.txt
index b7a01beb9..7a59e7c06 100644
--- a/apps/nshlib/README.txt
+++ b/apps/nshlib/README.txt
@@ -1211,21 +1211,27 @@ NSH-Specific Configuration Settings
CONFIG_NSH_USBDEV_TRACEINTERRUPTS
Show interrupt-related events.
- * CONFIG_NSH_CONDEV
- If CONFIG_NSH_CONSOLE is set to 'y', then CONFIG_NSH_CONDEV
- may also be set to select the serial device used to support
- the NSH console. This should be set to the quoted name of a
- readable/write-able character driver such as:
- CONFIG_NSH_CONDEV="/dev/ttyS1". This is useful, for example,
- to separate the NSH command line from the system console when
- the system console is used to provide debug output. Default:
- stdin and stdout (probably "/dev/console")
-
- NOTE: When any other device other than /dev/console is used
- for a user interface, (1) linefeeds (\n) will not be expanded to
- carriage return / linefeeds (\r\n). You will need to set
- your terminal program to account for this. And (2) input is
- not automatically echoed so you will have to turn local echo on.
+ * CONFIG_NSH_ALTCONDEV and CONFIG_NSH_CONDEV
+ If CONFIG_NSH_CONSOLE is set to 'y', then CONFIG_NSH_ALTCONDEV may also
+ be selected to enable use of an alternate character device to support
+ the NSH console. If CONFIG_NSH_ALTCONDEV is selected, then
+ CONFIG_NSH_CONDEV holds the quoted name of a readable/write-able
+ character driver such as: CONFIG_NSH_CONDEV="/dev/ttyS1". This is
+ useful, for example, to separate the NSH command line from the system
+ console when the system console is used to provide debug output.
+ Default: stdin and stdout (probably "/dev/console")
+
+ NOTE 1: When any other device other than /dev/console is used for a
+ user interface, (1) linefeeds (\n) will not be expanded to carriage
+ return / linefeeds (\r\n). You will need to configure your terminal
+ program to account for this. And (2) input is not automatically
+ echoed so you will have to turn local echo on.
+
+ NOTE 2: This option forces the console of all sessions to use
+ NSH_CONDEV. Hence, this option only makes sense for a system that
+ supports only a single session. This option is, in particular,
+ incompatible with Telnet sessions because each Telnet session must
+ use a different console device.
* CONFIG_NSH_TELNET
If CONFIG_NSH_TELNET is set to 'y', then a TELENET
diff --git a/apps/nshlib/nsh.h b/apps/nshlib/nsh.h
index 059513e77..9546155cd 100644
--- a/apps/nshlib/nsh.h
+++ b/apps/nshlib/nsh.h
@@ -134,7 +134,7 @@
# define HAVE_USB_CONSOLE 1
/* Check for a generic USB console. In this case, the USB console device
- * must be provided in CONFIG_NSH_CONDEV.
+ * must be provided in CONFIG_NSH_USBCONDEV.
*/
# elif defined(CONFIG_NSH_USBCONSOLE)
diff --git a/apps/nshlib/nsh_console.c b/apps/nshlib/nsh_console.c
index ba7dbe760..9b78258c4 100644
--- a/apps/nshlib/nsh_console.c
+++ b/apps/nshlib/nsh_console.c
@@ -312,7 +312,7 @@ static void nsh_consolerelease(FAR struct nsh_vtbl_s *vtbl)
/* Close the console stream */
-#ifdef CONFIG_NSH_CONDEV
+#ifdef CONFIG_NSH_ALTCONDEV
(void)fclose(pstate->cn_constream);
#endif
#endif
@@ -462,7 +462,7 @@ FAR struct console_stdio_s *nsh_newconsole(void)
/* (Re-) open the console input device */
-#ifdef CONFIG_NSH_CONDEV
+#ifdef CONFIG_NSH_ALTCONDEV
pstate->cn_confd = open(CONFIG_NSH_CONDEV, O_RDWR);
if (pstate->cn_confd < 0)
{
diff --git a/apps/nshlib/nsh_console.h b/apps/nshlib/nsh_console.h
index c78362f94..b02c59dc6 100644
--- a/apps/nshlib/nsh_console.h
+++ b/apps/nshlib/nsh_console.h
@@ -50,7 +50,7 @@
#include <errno.h>
/****************************************************************************
- * Definitions
+ * Pre-processor Definitions
****************************************************************************/
/* Method access macros */
@@ -75,16 +75,24 @@
/* Are we using the NuttX console for I/O? Or some other character device? */
#if CONFIG_NFILE_STREAMS > 0
-# ifdef CONFIG_NSH_CONDEV
+# ifdef CONFIG_NSH_ALTCONDEV
+
+# ifndef CONFIG_NSH_CONDEV
+# error CONFIG_NSH_ALTCONDEV selected but CONFIG_NSH_CONDEV not provided
+# endif
+
# define INFD(p) ((p)->cn_confd)
# define INSTREAM(p) ((p)->cn_constream)
# define OUTFD(p) ((p)->cn_confd)
# define OUTSTREAM(p) ((p)->cn_constream)
+
# else
+
# define INFD(p) 0
# define INSTREAM(p) stdin
# define OUTFD(p) 1
# define OUTSTREAM(p) stdout
+
# endif
#endif
@@ -133,11 +141,11 @@ struct console_stdio_s
/* NSH input/output streams */
#if CONFIG_NFILE_STREAMS > 0
-#ifdef CONFIG_NSH_CONDEV
+#ifdef CONFIG_NSH_ALTCONDEV
int cn_confd; /* Console I/O file descriptor */
#endif
int cn_outfd; /* Output file descriptor (possibly redirected) */
-#ifdef CONFIG_NSH_CONDEV
+#ifdef CONFIG_NSH_ALTCONDEV
FILE *cn_constream; /* Console I/O stream (possibly redirected) */
#endif
FILE *cn_outstream; /* Output stream */