summaryrefslogtreecommitdiff
path: root/apps/nshlib/nsh_console.h
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/nshlib/nsh_console.h
parent52cc0b12520c403609e3e32e3e5e07e12c5f9e3b (diff)
downloadpx4-nuttx-6029fd4a574baaaf8baef4fefa4d1ca5c082729f.tar.gz
px4-nuttx-6029fd4a574baaaf8baef4fefa4d1ca5c082729f.tar.bz2
px4-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/nshlib/nsh_console.h')
-rw-r--r--apps/nshlib/nsh_console.h16
1 files changed, 12 insertions, 4 deletions
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 */