diff options
author | Michael Brown | 2013-11-28 06:41:45 +0100 |
---|---|---|
committer | Michael Brown | 2013-11-28 06:54:53 +0100 |
commit | b2251743d80f94445f40f64b75b63d33fe1d8725 (patch) | |
tree | 9c1424242dc2a1a6508bf3e7a723cadf4632f1de /src/core/console.c | |
parent | [mucurses] Use "<ESC>[2J" ANSI escape sequence to clear screen (diff) | |
download | ipxe-b2251743d80f94445f40f64b75b63d33fe1d8725.tar.gz ipxe-b2251743d80f94445f40f64b75b63d33fe1d8725.tar.xz ipxe-b2251743d80f94445f40f64b75b63d33fe1d8725.zip |
[console] Allow console input and output to be disabled independently
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/core/console.c')
-rw-r--r-- | src/core/console.c | 36 |
1 files changed, 12 insertions, 24 deletions
diff --git a/src/core/console.c b/src/core/console.c index a26a3ef6..73baf7f6 100644 --- a/src/core/console.c +++ b/src/core/console.c @@ -11,15 +11,12 @@ FILE_LICENCE ( GPL2_OR_LATER ); int console_usage = CONSOLE_USAGE_STDOUT; /** - * Write a single character to each console device. + * Write a single character to each console device * * @v character Character to be written - * @ret None - - * @err None - * * The character is written out to all enabled console devices, using * each device's console_driver::putchar() method. - * */ void putchar ( int character ) { struct console_driver *console; @@ -29,7 +26,7 @@ void putchar ( int character ) { putchar ( '\r' ); for_each_table_entry ( console, CONSOLES ) { - if ( ( ! console->disabled ) && + if ( ( ! ( console->disabled & CONSOLE_DISABLED_OUTPUT ) ) && ( console_usage & console->usage ) && console->putchar ) console->putchar ( character ); @@ -37,23 +34,20 @@ void putchar ( int character ) { } /** - * Check to see if any input is available on any console. + * Check to see if any input is available on any console * - * @v None - - * @ret console Console device that has input available, if any. - * @ret NULL No console device has input available. - * @err None - + * @ret console Console device that has input available, or NULL * * All enabled console devices are checked once for available input * using each device's console_driver::iskey() method. The first * console device that has available input will be returned, if any. - * */ static struct console_driver * has_input ( void ) { struct console_driver *console; for_each_table_entry ( console, CONSOLES ) { - if ( ( ! console->disabled ) && console->iskey ) { + if ( ( ! ( console->disabled & CONSOLE_DISABLED_INPUT ) ) && + console->iskey ) { if ( console->iskey () ) return console; } @@ -62,11 +56,9 @@ static struct console_driver * has_input ( void ) { } /** - * Read a single character from any console. + * Read a single character from any console * - * @v None - * @ret character Character read from a console. - * @err None - * * A character will be read from the first enabled console device that * has input available using that console's console_driver::getchar() @@ -80,7 +72,6 @@ static struct console_driver * has_input ( void ) { * @endcode * * The character read will not be echoed back to any console. - * */ int getchar ( void ) { struct console_driver *console; @@ -116,19 +107,16 @@ int getchar ( void ) { return character; } -/** Check for available input on any console. +/** + * Check for available input on any console * - * @v None - - * @ret True Input is available on a console - * @ret False Input is not available on any console - * @err None - + * @ret is_available Input is available on a console * * All enabled console devices are checked once for available input * using each device's console_driver::iskey() method. If any console - * device has input available, this call will return True. If this - * call returns True, you can then safely call getchar() without + * device has input available, this call will return true. If this + * call returns true, you can then safely call getchar() without * blocking. - * */ int iskey ( void ) { return has_input() ? 1 : 0; |