From 6029fd4a574baaaf8baef4fefa4d1ca5c082729f Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 5 May 2014 08:52:02 -0600 Subject: 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 --- apps/nshlib/nsh_console.h | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'apps/nshlib/nsh_console.h') 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 /**************************************************************************** - * 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 */ -- cgit v1.2.3