aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2012-03-26 19:02:30 +0100
committerMichael Brown <mcb30@ipxe.org>2012-03-26 19:02:30 +0100
commit64d17dbd509d15ddf41bfc5d5b88d53b5af98155 (patch)
tree11cedaa6c5bb817f4094c71eb397bda266736b97
parente024cd39a877ea1b37b9004dbd8f33448418cb36 (diff)
downloadipxe-64d17dbd509d15ddf41bfc5d5b88d53b5af98155.zip
ipxe-64d17dbd509d15ddf41bfc5d5b88d53b5af98155.tar.gz
ipxe-64d17dbd509d15ddf41bfc5d5b88d53b5af98155.tar.bz2
[console] Exclude text-based UI output from logfile-based consoles
The output from text-based user interfaces such as the "config" command is not generally meaningful for logfile-based consoles such as syslog and vmconsole. Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r--src/arch/i386/interface/vmware/vmconsole.c2
-rw-r--r--src/hci/mucurses/ansi_screen.c16
-rw-r--r--src/include/ipxe/console.h6
-rw-r--r--src/net/udp/syslog.c2
4 files changed, 21 insertions, 5 deletions
diff --git a/src/arch/i386/interface/vmware/vmconsole.c b/src/arch/i386/interface/vmware/vmconsole.c
index 3096e5b..096b1af 100644
--- a/src/arch/i386/interface/vmware/vmconsole.c
+++ b/src/arch/i386/interface/vmware/vmconsole.c
@@ -37,7 +37,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
/* Set default console usage if applicable */
#if ! ( defined ( CONSOLE_VMWARE ) && CONSOLE_EXPLICIT ( CONSOLE_VMWARE ) )
#undef CONSOLE_VMWARE
-#define CONSOLE_VMWARE CONSOLE_USAGE_ALL
+#define CONSOLE_VMWARE ( CONSOLE_USAGE_ALL & ~CONSOLE_USAGE_TUI )
#endif
/** VMware logfile console GuestRPC channel */
diff --git a/src/hci/mucurses/ansi_screen.c b/src/hci/mucurses/ansi_screen.c
index cc342f7..d952e5f 100644
--- a/src/hci/mucurses/ansi_screen.c
+++ b/src/hci/mucurses/ansi_screen.c
@@ -12,6 +12,8 @@ static void ansiscr_putc(struct _curses_screen *scr, chtype c) __nonnull;
unsigned short _COLS = 80;
unsigned short _LINES = 24;
+static unsigned int saved_usage;
+
static void ansiscr_reset ( struct _curses_screen *scr ) {
/* Reset terminal attributes and clear screen */
scr->attrs = 0;
@@ -20,6 +22,16 @@ static void ansiscr_reset ( struct _curses_screen *scr ) {
printf ( "\033[0m" );
}
+static void ansiscr_init ( struct _curses_screen *scr ) {
+ saved_usage = console_set_usage ( CONSOLE_USAGE_TUI );
+ ansiscr_reset ( scr );
+}
+
+static void ansiscr_exit ( struct _curses_screen *scr ) {
+ ansiscr_reset ( scr );
+ console_set_usage ( saved_usage );
+}
+
static void ansiscr_movetoyx ( struct _curses_screen *scr,
unsigned int y, unsigned int x ) {
if ( ( x != scr->curs_x ) || ( y != scr->curs_y ) ) {
@@ -65,8 +77,8 @@ static bool ansiscr_peek ( struct _curses_screen *scr __unused ) {
}
SCREEN _ansi_screen = {
- .init = ansiscr_reset,
- .exit = ansiscr_reset,
+ .init = ansiscr_init,
+ .exit = ansiscr_exit,
.movetoyx = ansiscr_movetoyx,
.putc = ansiscr_putc,
.getc = ansiscr_getc,
diff --git a/src/include/ipxe/console.h b/src/include/ipxe/console.h
index f70dd71..5ff9388 100644
--- a/src/include/ipxe/console.h
+++ b/src/include/ipxe/console.h
@@ -117,8 +117,12 @@ struct console_driver {
/** Debug messages */
#define CONSOLE_USAGE_DEBUG 0x0002
+/** Text-based user interface */
+#define CONSOLE_USAGE_TUI 0x0004
+
/** All console usages */
-#define CONSOLE_USAGE_ALL ( CONSOLE_USAGE_STDOUT | CONSOLE_USAGE_DEBUG )
+#define CONSOLE_USAGE_ALL \
+ ( CONSOLE_USAGE_STDOUT | CONSOLE_USAGE_DEBUG | CONSOLE_USAGE_TUI )
/** @} */
diff --git a/src/net/udp/syslog.c b/src/net/udp/syslog.c
index 8788e1c..abf5135 100644
--- a/src/net/udp/syslog.c
+++ b/src/net/udp/syslog.c
@@ -39,7 +39,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
/* Set default console usage if applicable */
#if ! ( defined ( CONSOLE_SYSLOG ) && CONSOLE_EXPLICIT ( CONSOLE_SYSLOG ) )
#undef CONSOLE_SYSLOG
-#define CONSOLE_SYSLOG CONSOLE_USAGE_ALL
+#define CONSOLE_SYSLOG ( CONSOLE_USAGE_ALL & ~CONSOLE_USAGE_TUI )
#endif
/** The syslog server */