iPXE
|
User interaction. More...
Go to the source code of this file.
Data Structures | |
struct | console_configuration |
A console configuration. More... | |
struct | console_driver |
A console driver. More... | |
Macros | |
#define | CONSOLE_DISABLED_INPUT 0x0001 |
Console is disabled for input. More... | |
#define | CONSOLE_DISABLED_OUTPUT 0x0002 |
Console is disabled for output. More... | |
#define | CONSOLE_DISABLED ( CONSOLE_DISABLED_INPUT | CONSOLE_DISABLED_OUTPUT ) |
Console is disabled for all uses. More... | |
#define | CONSOLES __table ( struct console_driver, "consoles" ) |
Console driver table. More... | |
#define | __console_driver __table_entry ( CONSOLES, 01 ) |
Mark a struct console_driver as being part of the console drivers table. More... | |
#define | CONSOLE_USAGE_STDOUT 0x0001 |
Standard output. More... | |
#define | CONSOLE_USAGE_DEBUG 0x0002 |
Debug messages. More... | |
#define | CONSOLE_USAGE_TUI 0x0004 |
Text-based user interface. More... | |
#define | CONSOLE_USAGE_LOG 0x0008 |
Log messages. More... | |
#define | CONSOLE_USAGE_ALL |
All console usages. More... | |
#define | CONSOLE_EXPLICIT(console) ( ( 2 * console + 1 ) != 2 ) |
Test to see if console has an explicit usage. More... | |
#define | CONSOLE_DEFAULT_WIDTH 80 |
Default console width. More... | |
#define | CONSOLE_DEFAULT_HEIGHT 25 |
Default console height. More... | |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
static int | console_set_usage (int usage) |
Set console usage. More... | |
static void | console_set_size (unsigned int width, unsigned int height) |
Set console size. More... | |
int | iskey (void) |
Check for available input on any console. More... | |
int | getkey (unsigned long timeout) |
Get single keypress. More... | |
int | console_configure (struct console_configuration *config) |
Configure console. More... | |
static void | console_reset (void) |
Reset console. More... | |
Variables | |
int | console_usage |
Current console usage. More... | |
unsigned int | console_width |
Console width. More... | |
unsigned int | console_height |
Console height. More... | |
User interaction.
Various console devices can be selected via the build options CONSOLE_FIRMWARE, CONSOLE_SERIAL etc. The console functions putchar(), getchar() and iskey() delegate to the individual console drivers.
Definition in file console.h.
#define CONSOLE_DISABLED_INPUT 0x0001 |
#define CONSOLE_DISABLED_OUTPUT 0x0002 |
#define CONSOLE_DISABLED ( CONSOLE_DISABLED_INPUT | CONSOLE_DISABLED_OUTPUT ) |
#define CONSOLES __table ( struct console_driver, "consoles" ) |
struct console_driver vesafb_console __console_driver __table_entry ( CONSOLES, 01 ) |
Mark a struct console_driver
as being part of the console drivers table.
VESA frame buffer console driver.
INT13 console driver.
EFI graphics output protocol console driver.
Encrypted syslog console driver.
Use as e.g.
#define CONSOLE_EXPLICIT | ( | console | ) | ( ( 2 * console + 1 ) != 2 ) |
Test to see if console has an explicit usage.
console | Console definition (e.g. CONSOLE_PCBIOS) |
explicit | Console has an explicit usage |
This relies upon the trick that the expression ( 2 * N + 1 ) will be valid even if N is defined to be empty, since it will then evaluate to give ( 2 * + 1 ) == ( 2 * +1 ) == 2.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
inlinestatic |
Set console usage.
usage | New console usage |
old_usage | Previous console usage |
Definition at line 187 of file console.h.
References console_usage.
Referenced by ansiscr_exit(), ansiscr_init(), dbg_printf(), and log_vprintf().
|
inlinestatic |
Set console size.
width | Width, in characters |
height | Height, in characters |
Definition at line 201 of file console.h.
References console_height, console_width, console_configuration::height, and console_configuration::width.
Referenced by console_configure(), and fbcon_init().
int iskey | ( | void | ) |
Check for available input on any console.
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 blocking.
Definition at line 130 of file console.c.
References has_input().
Referenced by ansiscr_peek(), bios_inject(), getchar_timeout(), int21(), keypress_interrupted(), loopback_wait(), monojob_wait(), and pxe_menu_prompt_and_select().
int getkey | ( | unsigned long | timeout | ) |
Get single keypress.
timeout | Timeout period, in ticks (0=indefinite) |
key | Key pressed |
The returned key will be an ASCII value or a KEY_XXX special constant. This function differs from getchar() in that getchar() will return "special" keys (e.g. cursor keys) as a series of characters forming an ANSI escape sequence.
Definition at line 71 of file getkey.c.
References ESC, getchar_timeout(), GETKEY_TIMEOUT, isalpha(), isdigit(), KEY_ANSI, timeout(), and toupper().
Referenced by bios_inject(), form_loop(), main_loop(), menu_loop(), prompt(), pxe_menu_prompt_and_select(), pxe_menu_select(), and readline_history().
int console_configure | ( | struct console_configuration * | config | ) |
Configure console.
config | Console configuration |
rc | Return status code |
The configuration is passed to all configurable consoles, including those which are currently disabled. Consoles may choose to enable or disable themselves depending upon the configuration.
If configuration fails, then all consoles will be reset.
Definition at line 146 of file console.c.
References console_driver::configure, CONSOLE_DEFAULT_HEIGHT, CONSOLE_DEFAULT_WIDTH, console_reset(), console_set_size(), CONSOLES, for_each_table_entry, and rc.
Referenced by console_exec(), and console_reset().
|
inlinestatic |
Reset console.
Definition at line 214 of file console.h.
References console_configure(), and NULL.
Referenced by call_bootsector(), com32_exec(), comboot_exec(), console_configure(), efi_image_exec(), efi_snp_load_file(), pxe_exec(), and shutdown().
int console_usage |
Current console usage.
Definition at line 11 of file console.c.
Referenced by console_set_usage(), and putchar().
unsigned int console_width |
Console width.
Definition at line 14 of file console.c.
Referenced by bios_handle_ed(), and console_set_size().
unsigned int console_height |
Console height.
Definition at line 17 of file console.c.
Referenced by bios_handle_ed(), and console_set_size().