2002-12-27 08:53:07 +00:00
|
|
|
/*
|
2004-04-04 13:46:03 +00:00
|
|
|
* GRUB -- GRand Unified Bootloader
|
2010-01-09 22:42:17 +00:00
|
|
|
* Copyright (C) 2002,2003,2005,2007,2008,2009,2010 Free Software Foundation, Inc.
|
2002-12-27 08:53:07 +00:00
|
|
|
*
|
2007-07-21 23:32:33 +00:00
|
|
|
* GRUB is free software: you can redistribute it and/or modify
|
2002-12-27 08:53:07 +00:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2007-07-21 23:32:33 +00:00
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
2002-12-27 08:53:07 +00:00
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
2007-07-21 23:32:33 +00:00
|
|
|
* GRUB is distributed in the hope that it will be useful,
|
2002-12-27 08:53:07 +00:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2007-07-21 23:32:33 +00:00
|
|
|
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
2002-12-27 08:53:07 +00:00
|
|
|
*/
|
|
|
|
|
2004-04-04 13:46:03 +00:00
|
|
|
#ifndef GRUB_TERM_HEADER
|
|
|
|
#define GRUB_TERM_HEADER 1
|
2002-12-27 08:53:07 +00:00
|
|
|
|
2010-08-23 11:21:53 +00:00
|
|
|
#define GRUB_TERM_NO_KEY 0
|
2010-08-23 10:53:42 +00:00
|
|
|
|
2008-02-05 Robert Millan <rmh@aybabtu.com>
* include/grub/term.h (GRUB_TERM_LEFT, GRUB_TERM_RIGHT)
(GRUB_TERM_UP, GRUB_TERM_DOWN, GRUB_TERM_HOME, GRUB_TERM_END)
(GRUB_TERM_DC, GRUB_TERM_PPAGE, GRUB_TERM_NPAGE, GRUB_TERM_ESC)
(GRUB_TERM_TAB, GRUB_TERM_BACKSPACE): New macros.
* kern/i386/pc/startup.S: Include `<grub/term.h>'.
(translation_table): Replace hardcoded values with macros
provided by `<grub/term.h>'.
* term/i386/pc/at_keyboard.c: Include `<grub/term.h>'.
(keyboard_map): Correct/add a few values, with macros provided
by `<grub/term.h>'.
(keyboard_map_shift): Zero values that don't differ from their
`keyboard_map' equivalents.
(grub_console_checkkey): Optimize KEYBOARD_STATUS_CAPS_LOCK toggling.
Discard the second scan code that is always sent by Caps lock.
Only use `keyboard_map_shift' when it provides a non-zero value,
otherwise fallback to `keyboard_map'.
2008-02-05 10:23:24 +00:00
|
|
|
/* Internal codes used by GRUB to represent terminal input. */
|
2010-08-19 00:21:36 +00:00
|
|
|
/* Only for keys otherwise not having shifted modification. */
|
|
|
|
#define GRUB_TERM_SHIFT 0x01000000
|
2010-05-10 12:54:51 +00:00
|
|
|
#define GRUB_TERM_CTRL 0x02000000
|
|
|
|
#define GRUB_TERM_ALT 0x04000000
|
|
|
|
|
|
|
|
/* Keys without associated character. */
|
2010-08-19 00:21:36 +00:00
|
|
|
#define GRUB_TERM_EXTENDED 0x00800000
|
|
|
|
#define GRUB_TERM_KEY_MASK 0x00ffffff
|
2010-08-19 11:32:36 +00:00
|
|
|
|
|
|
|
#define GRUB_TERM_KEY_LEFT (GRUB_TERM_EXTENDED | 0x4b)
|
|
|
|
#define GRUB_TERM_KEY_RIGHT (GRUB_TERM_EXTENDED | 0x4d)
|
|
|
|
#define GRUB_TERM_KEY_UP (GRUB_TERM_EXTENDED | 0x48)
|
|
|
|
#define GRUB_TERM_KEY_DOWN (GRUB_TERM_EXTENDED | 0x50)
|
|
|
|
#define GRUB_TERM_KEY_HOME (GRUB_TERM_EXTENDED | 0x47)
|
|
|
|
#define GRUB_TERM_KEY_END (GRUB_TERM_EXTENDED | 0x4f)
|
|
|
|
#define GRUB_TERM_KEY_DC (GRUB_TERM_EXTENDED | 0x53)
|
|
|
|
#define GRUB_TERM_KEY_PPAGE (GRUB_TERM_EXTENDED | 0x49)
|
|
|
|
#define GRUB_TERM_KEY_NPAGE (GRUB_TERM_EXTENDED | 0x51)
|
|
|
|
#define GRUB_TERM_KEY_F1 (GRUB_TERM_EXTENDED | 0x3b)
|
|
|
|
#define GRUB_TERM_KEY_F2 (GRUB_TERM_EXTENDED | 0x3c)
|
|
|
|
#define GRUB_TERM_KEY_F3 (GRUB_TERM_EXTENDED | 0x3d)
|
|
|
|
#define GRUB_TERM_KEY_F4 (GRUB_TERM_EXTENDED | 0x3e)
|
|
|
|
#define GRUB_TERM_KEY_F5 (GRUB_TERM_EXTENDED | 0x3f)
|
|
|
|
#define GRUB_TERM_KEY_F6 (GRUB_TERM_EXTENDED | 0x40)
|
|
|
|
#define GRUB_TERM_KEY_F7 (GRUB_TERM_EXTENDED | 0x41)
|
|
|
|
#define GRUB_TERM_KEY_F8 (GRUB_TERM_EXTENDED | 0x42)
|
|
|
|
#define GRUB_TERM_KEY_F9 (GRUB_TERM_EXTENDED | 0x43)
|
|
|
|
#define GRUB_TERM_KEY_F10 (GRUB_TERM_EXTENDED | 0x44)
|
|
|
|
#define GRUB_TERM_KEY_F11 (GRUB_TERM_EXTENDED | 0x57)
|
|
|
|
#define GRUB_TERM_KEY_F12 (GRUB_TERM_EXTENDED | 0x58)
|
|
|
|
#define GRUB_TERM_KEY_INSERT (GRUB_TERM_EXTENDED | 0x52)
|
|
|
|
#define GRUB_TERM_KEY_CENTER (GRUB_TERM_EXTENDED | 0x4c)
|
2010-05-10 12:54:51 +00:00
|
|
|
|
2017-08-07 15:20:30 +00:00
|
|
|
/* Hex value is used for ESC, since '\e' is nonstandard */
|
|
|
|
#define GRUB_TERM_ESC 0x1b
|
2008-02-05 Robert Millan <rmh@aybabtu.com>
* include/grub/term.h (GRUB_TERM_LEFT, GRUB_TERM_RIGHT)
(GRUB_TERM_UP, GRUB_TERM_DOWN, GRUB_TERM_HOME, GRUB_TERM_END)
(GRUB_TERM_DC, GRUB_TERM_PPAGE, GRUB_TERM_NPAGE, GRUB_TERM_ESC)
(GRUB_TERM_TAB, GRUB_TERM_BACKSPACE): New macros.
* kern/i386/pc/startup.S: Include `<grub/term.h>'.
(translation_table): Replace hardcoded values with macros
provided by `<grub/term.h>'.
* term/i386/pc/at_keyboard.c: Include `<grub/term.h>'.
(keyboard_map): Correct/add a few values, with macros provided
by `<grub/term.h>'.
(keyboard_map_shift): Zero values that don't differ from their
`keyboard_map' equivalents.
(grub_console_checkkey): Optimize KEYBOARD_STATUS_CAPS_LOCK toggling.
Discard the second scan code that is always sent by Caps lock.
Only use `keyboard_map_shift' when it provides a non-zero value,
otherwise fallback to `keyboard_map'.
2008-02-05 10:23:24 +00:00
|
|
|
#define GRUB_TERM_TAB '\t'
|
2010-05-10 12:54:51 +00:00
|
|
|
#define GRUB_TERM_BACKSPACE '\b'
|
2008-02-05 Robert Millan <rmh@aybabtu.com>
* include/grub/term.h (GRUB_TERM_LEFT, GRUB_TERM_RIGHT)
(GRUB_TERM_UP, GRUB_TERM_DOWN, GRUB_TERM_HOME, GRUB_TERM_END)
(GRUB_TERM_DC, GRUB_TERM_PPAGE, GRUB_TERM_NPAGE, GRUB_TERM_ESC)
(GRUB_TERM_TAB, GRUB_TERM_BACKSPACE): New macros.
* kern/i386/pc/startup.S: Include `<grub/term.h>'.
(translation_table): Replace hardcoded values with macros
provided by `<grub/term.h>'.
* term/i386/pc/at_keyboard.c: Include `<grub/term.h>'.
(keyboard_map): Correct/add a few values, with macros provided
by `<grub/term.h>'.
(keyboard_map_shift): Zero values that don't differ from their
`keyboard_map' equivalents.
(grub_console_checkkey): Optimize KEYBOARD_STATUS_CAPS_LOCK toggling.
Discard the second scan code that is always sent by Caps lock.
Only use `keyboard_map_shift' when it provides a non-zero value,
otherwise fallback to `keyboard_map'.
2008-02-05 10:23:24 +00:00
|
|
|
|
2013-10-22 18:42:20 +00:00
|
|
|
#define GRUB_PROGRESS_NO_UPDATE -1
|
|
|
|
#define GRUB_PROGRESS_FAST 0
|
|
|
|
#define GRUB_PROGRESS_SLOW 2
|
|
|
|
|
2008-02-05 Robert Millan <rmh@aybabtu.com>
* include/grub/term.h (GRUB_TERM_LEFT, GRUB_TERM_RIGHT)
(GRUB_TERM_UP, GRUB_TERM_DOWN, GRUB_TERM_HOME, GRUB_TERM_END)
(GRUB_TERM_DC, GRUB_TERM_PPAGE, GRUB_TERM_NPAGE, GRUB_TERM_ESC)
(GRUB_TERM_TAB, GRUB_TERM_BACKSPACE): New macros.
* kern/i386/pc/startup.S: Include `<grub/term.h>'.
(translation_table): Replace hardcoded values with macros
provided by `<grub/term.h>'.
* term/i386/pc/at_keyboard.c: Include `<grub/term.h>'.
(keyboard_map): Correct/add a few values, with macros provided
by `<grub/term.h>'.
(keyboard_map_shift): Zero values that don't differ from their
`keyboard_map' equivalents.
(grub_console_checkkey): Optimize KEYBOARD_STATUS_CAPS_LOCK toggling.
Discard the second scan code that is always sent by Caps lock.
Only use `keyboard_map_shift' when it provides a non-zero value,
otherwise fallback to `keyboard_map'.
2008-02-05 10:23:24 +00:00
|
|
|
#ifndef ASM_FILE
|
|
|
|
|
2004-04-04 13:46:03 +00:00
|
|
|
#include <grub/err.h>
|
|
|
|
#include <grub/symbol.h>
|
|
|
|
#include <grub/types.h>
|
2010-03-15 20:14:11 +00:00
|
|
|
#include <grub/unicode.h>
|
2010-03-26 23:19:42 +00:00
|
|
|
#include <grub/list.h>
|
2002-12-27 08:53:07 +00:00
|
|
|
|
|
|
|
/* These are used to represent the various color states we use. */
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
/* The color used to display all text that does not use the
|
|
|
|
user defined colors below. */
|
2004-04-04 13:46:03 +00:00
|
|
|
GRUB_TERM_COLOR_STANDARD,
|
2002-12-27 08:53:07 +00:00
|
|
|
/* The user defined colors for normal text. */
|
2004-04-04 13:46:03 +00:00
|
|
|
GRUB_TERM_COLOR_NORMAL,
|
2002-12-27 08:53:07 +00:00
|
|
|
/* The user defined colors for highlighted text. */
|
2004-04-04 13:46:03 +00:00
|
|
|
GRUB_TERM_COLOR_HIGHLIGHT
|
2002-12-27 08:53:07 +00:00
|
|
|
}
|
2004-04-04 13:46:03 +00:00
|
|
|
grub_term_color_state;
|
2002-12-27 08:53:07 +00:00
|
|
|
|
|
|
|
/* Flags for representing the capabilities of a terminal. */
|
|
|
|
/* Some notes about the flags:
|
|
|
|
- These flags are used by higher-level functions but not terminals
|
|
|
|
themselves.
|
|
|
|
- If a terminal is dumb, you may assume that only putchar, getkey and
|
|
|
|
checkkey are called.
|
|
|
|
- Some fancy features (setcolorstate, setcolor and setcursor) can be set
|
|
|
|
to NULL. */
|
|
|
|
|
|
|
|
/* Set when input characters shouldn't be echoed back. */
|
2010-03-15 10:49:27 +00:00
|
|
|
#define GRUB_TERM_NO_ECHO (1 << 0)
|
2002-12-27 08:53:07 +00:00
|
|
|
/* Set when the editing feature should be disabled. */
|
2010-03-15 10:49:27 +00:00
|
|
|
#define GRUB_TERM_NO_EDIT (1 << 1)
|
2002-12-27 08:53:07 +00:00
|
|
|
/* Set when the terminal cannot do fancy things. */
|
2010-03-15 10:49:27 +00:00
|
|
|
#define GRUB_TERM_DUMB (1 << 2)
|
|
|
|
/* Which encoding does terminal expect stream to be. */
|
2010-05-07 22:17:23 +00:00
|
|
|
#define GRUB_TERM_CODE_TYPE_SHIFT 3
|
|
|
|
#define GRUB_TERM_CODE_TYPE_MASK (7 << GRUB_TERM_CODE_TYPE_SHIFT)
|
2010-03-15 10:49:27 +00:00
|
|
|
/* Only ASCII characters accepted. */
|
2010-05-07 22:17:23 +00:00
|
|
|
#define GRUB_TERM_CODE_TYPE_ASCII (0 << GRUB_TERM_CODE_TYPE_SHIFT)
|
2010-05-09 11:26:52 +00:00
|
|
|
/* Expects CP-437 characters (ASCII + pseudographics). */
|
|
|
|
#define GRUB_TERM_CODE_TYPE_CP437 (1 << GRUB_TERM_CODE_TYPE_SHIFT)
|
2010-03-15 10:49:27 +00:00
|
|
|
/* UTF-8 stream in logical order. Usually used for terminals
|
|
|
|
which just forward the stream to another computer. */
|
2013-01-16 12:41:16 +00:00
|
|
|
#define GRUB_TERM_CODE_TYPE_UTF8_LOGICAL (2 << GRUB_TERM_CODE_TYPE_SHIFT)
|
2010-03-16 18:23:21 +00:00
|
|
|
/* UTF-8 in visual order. Like UTF-8 logical but for buggy endpoints. */
|
2010-05-07 22:17:23 +00:00
|
|
|
#define GRUB_TERM_CODE_TYPE_UTF8_VISUAL (3 << GRUB_TERM_CODE_TYPE_SHIFT)
|
2010-03-16 18:23:21 +00:00
|
|
|
/* Glyph description in visual order. */
|
2010-05-07 22:17:23 +00:00
|
|
|
#define GRUB_TERM_CODE_TYPE_VISUAL_GLYPHS (4 << GRUB_TERM_CODE_TYPE_SHIFT)
|
2002-12-27 08:53:07 +00:00
|
|
|
|
2005-02-19 20:56:07 +00:00
|
|
|
|
2009-08-28 13:20:34 +00:00
|
|
|
/* Bitmasks for modifier keys returned by grub_getkeystatus. */
|
2010-08-19 13:00:31 +00:00
|
|
|
#define GRUB_TERM_STATUS_RSHIFT (1 << 0)
|
|
|
|
#define GRUB_TERM_STATUS_LSHIFT (1 << 1)
|
|
|
|
#define GRUB_TERM_STATUS_RCTRL (1 << 2)
|
|
|
|
#define GRUB_TERM_STATUS_RALT (1 << 3)
|
|
|
|
#define GRUB_TERM_STATUS_SCROLL (1 << 4)
|
|
|
|
#define GRUB_TERM_STATUS_NUM (1 << 5)
|
|
|
|
#define GRUB_TERM_STATUS_CAPS (1 << 6)
|
|
|
|
#define GRUB_TERM_STATUS_LCTRL (1 << 8)
|
|
|
|
#define GRUB_TERM_STATUS_LALT (1 << 9)
|
2009-08-28 13:20:34 +00:00
|
|
|
|
2005-02-19 20:56:07 +00:00
|
|
|
/* Menu-related geometrical constants. */
|
|
|
|
|
|
|
|
/* The number of columns/lines between messages/borders/etc. */
|
|
|
|
#define GRUB_TERM_MARGIN 1
|
|
|
|
|
|
|
|
/* The number of columns of scroll information. */
|
|
|
|
#define GRUB_TERM_SCROLL_WIDTH 1
|
|
|
|
|
2008-11-07 Robert Millan <rmh@aybabtu.com>
Modularize at_keyboard.mod:
* conf/i386.rmk (pkglib_MODULES): Add `at_keyboard.mod'.
(at_keyboard_mod_SOURCES, at_keyboard_mod_CFLAGS)
(at_keyboard_mod_LDFLAGS): New variables.
Actual terminal split:
* include/grub/term.h (struct grub_term): Split in ...
(struct grub_term_input): ... this, and ...
(struct grub_term_output): ... this. Update all users.
(grub_term_set_current): Split in ...
(grub_term_set_current_input): ... this, and ...
(grub_term_set_current_output): ... this.
(grub_term_get_current): Split in ...
(grub_term_get_current_input): ... this, and ...
(grub_term_get_current_output): ... this.
(grub_term_register): Split in ...
(grub_term_register_input): ... this, and ...
(grub_term_register_output): ... this.
(grub_term_unregister): Split in ...
(grub_term_unregister_input): ... this, and ...
(grub_term_unregister_output): ... this.
(grub_term_iterate): Split in ...
(grub_term_iterate_input): ... this, and ...
(grub_term_iterate_output): ... this.
* kern/term.c (grub_term_list): Split in ...
(grub_term_list_input): ... this, and ...
(grub_term_list_output): ... this. Update all users.
(grub_cur_term): Split in ...
(grub_cur_term_input): ... this, and ...
(grub_cur_term_output): ... this. Update all users.
(grub_term_set_current): Split in ...
(grub_term_set_current_input): ... this, and ...
(grub_term_set_current_output): ... this.
(grub_term_get_current): Split in ...
(grub_term_get_current_input): ... this, and ...
(grub_term_get_current_output): ... this.
(grub_term_register): Split in ...
(grub_term_register_input): ... this, and ...
(grub_term_register_output): ... this.
(grub_term_unregister): Split in ...
(grub_term_unregister_input): ... this, and ...
(grub_term_unregister_output): ... this.
(grub_term_iterate): Split in ...
(grub_term_iterate_input): ... this, and ...
(grub_term_iterate_output): ... this.
* kern/misc.c (grub_abort): Split use of grub_term_get_current() into
a check for input and one for output (and only attempt to get keys
from user when input works).
* util/grub-probe.c (grub_term_get_current): Split in ...
(grub_term_get_current_input): ... this, and ...
(grub_term_get_current_output): ... this.
* util/grub-fstest.c: Likewise.
* util/i386/pc/grub-setup.c: Likewise.
* util/grub-editenv.c: Likewise.
Portability adjustments:
* conf/i386-ieee1275.rmk (kernel_elf_SOURCES): Remove
`term/i386/pc/at_keyboard.c'.
* kern/ieee1275/init.c [__i386__] (grub_machine_init): Remove call to
grub_keyboard_controller_init() (now handled by terminal .init).
* kern/i386/coreboot/init.c (grub_machine_init): Add call to
grub_at_keyboard_init().
* include/grub/i386/ieee1275/console.h (grub_keyboard_controller_init)
(grub_console_checkkey, grub_console_getkey): Remove (now provided by
at_keyboard.mod via input terminal interface).
* include/grub/i386/coreboot/console.h: Convert into a stub for
`<grub/i386/pc/console.h>'.
Migrate full terminals to new API:
* term/efi/console.c (grub_console_term): Split into ...
(grub_console_term_input): ... this, and ...
(grub_console_term_output): ... this. Update all users.
* term/ieee1275/ofconsole.c: Remove __i386__ hack.
(grub_ofconsole_init): Split into ...
(grub_ofconsole_init_input): ... this, and ...
(grub_ofconsole_init_output): ... this.
(grub_ofconsole_term): Split into ...
(grub_ofconsole_term_input): ... this, and ...
(grub_ofconsole_term_output): ... this. Update all users.
* term/i386/pc/serial.c (grub_serial_term): Split into ...
(grub_serial_term_input): ... this, and ...
(grub_serial_term_output): ... this. Update all users.
* term/i386/pc/console.c (grub_console_term): Split into ...
(grub_console_term_input): ... this, and ...
(grub_console_term_output): ... this. Update all users.
(grub_console_term_input): Only enable it on PC/BIOS platform.
(grub_console_init): Remove grub_keyboard_controller_init() call.
Migrate input terminals to new API:
* term/i386/pc/at_keyboard.c: Replace `cpu' and `machine' with
`i386' and `i386/pc' to enable build on x86_64 (this driver is
i386-specific anyway).
(grub_console_checkkey): Rename to ...
(grub_at_keyboard_checkkey): ... this. Static-ize. Update all
users.
(grub_keyboard_controller_orig): New variable.
(grub_console_getkey): Rename to ...
(grub_at_keyboard_getkey): ... this. Static-ize. Update all
users.
(grub_keyboard_controller_init): Static-ize. Save original
controller value so that it can be restored ...
(grub_keyboard_controller_fini): ... here (new function).
(grub_at_keyboard_term): New structure.
(GRUB_MOD_INIT(at_keyboard), GRUB_MOD_FINI(at_keyboard)): New
functions.
Migrate output terminals to new API:
* term/i386/pc/vga.c (grub_vga_term): Change type to
`struct grub_term_output'. Remove `.checkkey' and `.getkey'
members. Update all users.
* term/gfxterm.c (grub_video_term): Change type to
`struct grub_term_output'. Remove `.checkkey' and `.getkey'
members. Update all users.
* include/grub/i386/pc/console.h (grub_console_checkkey)
(grub_console_getkey): Do not export (no longer needed by gfxterm,
etc).
Migrate `terminal' command and userland tools to new API:
* commands/terminal.c (grub_cmd_terminal): Split into ...
(grub_cmd_terminal_input): ... this, and ...
(grub_cmd_terminal_output): ... this.
(GRUB_MOD_INIT(terminal)): Split `terminal' command in two commands:
`terminal_input' and `terminal_output'.
* util/grub.d/00_header.in: Adjust `terminal' calls to new
`terminal_input' / `terminal_output' API.
* util/grub-mkconfig.in: Export ${GRUB_TERMINAL_INPUT} and
${GRUB_TERMINAL_OUTPUT} instead of ${GRUB_TERMINAL} (and if user
provided ${GRUB_TERMINAL}, convert it).
2008-11-07 19:11:39 +00:00
|
|
|
struct grub_term_input
|
|
|
|
{
|
2009-03-01 17:51:44 +00:00
|
|
|
/* The next terminal. */
|
|
|
|
struct grub_term_input *next;
|
2012-01-24 12:31:12 +00:00
|
|
|
struct grub_term_input **prev;
|
2009-03-01 17:51:44 +00:00
|
|
|
|
2008-11-07 Robert Millan <rmh@aybabtu.com>
Modularize at_keyboard.mod:
* conf/i386.rmk (pkglib_MODULES): Add `at_keyboard.mod'.
(at_keyboard_mod_SOURCES, at_keyboard_mod_CFLAGS)
(at_keyboard_mod_LDFLAGS): New variables.
Actual terminal split:
* include/grub/term.h (struct grub_term): Split in ...
(struct grub_term_input): ... this, and ...
(struct grub_term_output): ... this. Update all users.
(grub_term_set_current): Split in ...
(grub_term_set_current_input): ... this, and ...
(grub_term_set_current_output): ... this.
(grub_term_get_current): Split in ...
(grub_term_get_current_input): ... this, and ...
(grub_term_get_current_output): ... this.
(grub_term_register): Split in ...
(grub_term_register_input): ... this, and ...
(grub_term_register_output): ... this.
(grub_term_unregister): Split in ...
(grub_term_unregister_input): ... this, and ...
(grub_term_unregister_output): ... this.
(grub_term_iterate): Split in ...
(grub_term_iterate_input): ... this, and ...
(grub_term_iterate_output): ... this.
* kern/term.c (grub_term_list): Split in ...
(grub_term_list_input): ... this, and ...
(grub_term_list_output): ... this. Update all users.
(grub_cur_term): Split in ...
(grub_cur_term_input): ... this, and ...
(grub_cur_term_output): ... this. Update all users.
(grub_term_set_current): Split in ...
(grub_term_set_current_input): ... this, and ...
(grub_term_set_current_output): ... this.
(grub_term_get_current): Split in ...
(grub_term_get_current_input): ... this, and ...
(grub_term_get_current_output): ... this.
(grub_term_register): Split in ...
(grub_term_register_input): ... this, and ...
(grub_term_register_output): ... this.
(grub_term_unregister): Split in ...
(grub_term_unregister_input): ... this, and ...
(grub_term_unregister_output): ... this.
(grub_term_iterate): Split in ...
(grub_term_iterate_input): ... this, and ...
(grub_term_iterate_output): ... this.
* kern/misc.c (grub_abort): Split use of grub_term_get_current() into
a check for input and one for output (and only attempt to get keys
from user when input works).
* util/grub-probe.c (grub_term_get_current): Split in ...
(grub_term_get_current_input): ... this, and ...
(grub_term_get_current_output): ... this.
* util/grub-fstest.c: Likewise.
* util/i386/pc/grub-setup.c: Likewise.
* util/grub-editenv.c: Likewise.
Portability adjustments:
* conf/i386-ieee1275.rmk (kernel_elf_SOURCES): Remove
`term/i386/pc/at_keyboard.c'.
* kern/ieee1275/init.c [__i386__] (grub_machine_init): Remove call to
grub_keyboard_controller_init() (now handled by terminal .init).
* kern/i386/coreboot/init.c (grub_machine_init): Add call to
grub_at_keyboard_init().
* include/grub/i386/ieee1275/console.h (grub_keyboard_controller_init)
(grub_console_checkkey, grub_console_getkey): Remove (now provided by
at_keyboard.mod via input terminal interface).
* include/grub/i386/coreboot/console.h: Convert into a stub for
`<grub/i386/pc/console.h>'.
Migrate full terminals to new API:
* term/efi/console.c (grub_console_term): Split into ...
(grub_console_term_input): ... this, and ...
(grub_console_term_output): ... this. Update all users.
* term/ieee1275/ofconsole.c: Remove __i386__ hack.
(grub_ofconsole_init): Split into ...
(grub_ofconsole_init_input): ... this, and ...
(grub_ofconsole_init_output): ... this.
(grub_ofconsole_term): Split into ...
(grub_ofconsole_term_input): ... this, and ...
(grub_ofconsole_term_output): ... this. Update all users.
* term/i386/pc/serial.c (grub_serial_term): Split into ...
(grub_serial_term_input): ... this, and ...
(grub_serial_term_output): ... this. Update all users.
* term/i386/pc/console.c (grub_console_term): Split into ...
(grub_console_term_input): ... this, and ...
(grub_console_term_output): ... this. Update all users.
(grub_console_term_input): Only enable it on PC/BIOS platform.
(grub_console_init): Remove grub_keyboard_controller_init() call.
Migrate input terminals to new API:
* term/i386/pc/at_keyboard.c: Replace `cpu' and `machine' with
`i386' and `i386/pc' to enable build on x86_64 (this driver is
i386-specific anyway).
(grub_console_checkkey): Rename to ...
(grub_at_keyboard_checkkey): ... this. Static-ize. Update all
users.
(grub_keyboard_controller_orig): New variable.
(grub_console_getkey): Rename to ...
(grub_at_keyboard_getkey): ... this. Static-ize. Update all
users.
(grub_keyboard_controller_init): Static-ize. Save original
controller value so that it can be restored ...
(grub_keyboard_controller_fini): ... here (new function).
(grub_at_keyboard_term): New structure.
(GRUB_MOD_INIT(at_keyboard), GRUB_MOD_FINI(at_keyboard)): New
functions.
Migrate output terminals to new API:
* term/i386/pc/vga.c (grub_vga_term): Change type to
`struct grub_term_output'. Remove `.checkkey' and `.getkey'
members. Update all users.
* term/gfxterm.c (grub_video_term): Change type to
`struct grub_term_output'. Remove `.checkkey' and `.getkey'
members. Update all users.
* include/grub/i386/pc/console.h (grub_console_checkkey)
(grub_console_getkey): Do not export (no longer needed by gfxterm,
etc).
Migrate `terminal' command and userland tools to new API:
* commands/terminal.c (grub_cmd_terminal): Split into ...
(grub_cmd_terminal_input): ... this, and ...
(grub_cmd_terminal_output): ... this.
(GRUB_MOD_INIT(terminal)): Split `terminal' command in two commands:
`terminal_input' and `terminal_output'.
* util/grub.d/00_header.in: Adjust `terminal' calls to new
`terminal_input' / `terminal_output' API.
* util/grub-mkconfig.in: Export ${GRUB_TERMINAL_INPUT} and
${GRUB_TERMINAL_OUTPUT} instead of ${GRUB_TERMINAL} (and if user
provided ${GRUB_TERMINAL}, convert it).
2008-11-07 19:11:39 +00:00
|
|
|
/* The terminal name. */
|
|
|
|
const char *name;
|
|
|
|
|
|
|
|
/* Initialize the terminal. */
|
2010-05-07 00:30:44 +00:00
|
|
|
grub_err_t (*init) (struct grub_term_input *term);
|
2008-11-07 Robert Millan <rmh@aybabtu.com>
Modularize at_keyboard.mod:
* conf/i386.rmk (pkglib_MODULES): Add `at_keyboard.mod'.
(at_keyboard_mod_SOURCES, at_keyboard_mod_CFLAGS)
(at_keyboard_mod_LDFLAGS): New variables.
Actual terminal split:
* include/grub/term.h (struct grub_term): Split in ...
(struct grub_term_input): ... this, and ...
(struct grub_term_output): ... this. Update all users.
(grub_term_set_current): Split in ...
(grub_term_set_current_input): ... this, and ...
(grub_term_set_current_output): ... this.
(grub_term_get_current): Split in ...
(grub_term_get_current_input): ... this, and ...
(grub_term_get_current_output): ... this.
(grub_term_register): Split in ...
(grub_term_register_input): ... this, and ...
(grub_term_register_output): ... this.
(grub_term_unregister): Split in ...
(grub_term_unregister_input): ... this, and ...
(grub_term_unregister_output): ... this.
(grub_term_iterate): Split in ...
(grub_term_iterate_input): ... this, and ...
(grub_term_iterate_output): ... this.
* kern/term.c (grub_term_list): Split in ...
(grub_term_list_input): ... this, and ...
(grub_term_list_output): ... this. Update all users.
(grub_cur_term): Split in ...
(grub_cur_term_input): ... this, and ...
(grub_cur_term_output): ... this. Update all users.
(grub_term_set_current): Split in ...
(grub_term_set_current_input): ... this, and ...
(grub_term_set_current_output): ... this.
(grub_term_get_current): Split in ...
(grub_term_get_current_input): ... this, and ...
(grub_term_get_current_output): ... this.
(grub_term_register): Split in ...
(grub_term_register_input): ... this, and ...
(grub_term_register_output): ... this.
(grub_term_unregister): Split in ...
(grub_term_unregister_input): ... this, and ...
(grub_term_unregister_output): ... this.
(grub_term_iterate): Split in ...
(grub_term_iterate_input): ... this, and ...
(grub_term_iterate_output): ... this.
* kern/misc.c (grub_abort): Split use of grub_term_get_current() into
a check for input and one for output (and only attempt to get keys
from user when input works).
* util/grub-probe.c (grub_term_get_current): Split in ...
(grub_term_get_current_input): ... this, and ...
(grub_term_get_current_output): ... this.
* util/grub-fstest.c: Likewise.
* util/i386/pc/grub-setup.c: Likewise.
* util/grub-editenv.c: Likewise.
Portability adjustments:
* conf/i386-ieee1275.rmk (kernel_elf_SOURCES): Remove
`term/i386/pc/at_keyboard.c'.
* kern/ieee1275/init.c [__i386__] (grub_machine_init): Remove call to
grub_keyboard_controller_init() (now handled by terminal .init).
* kern/i386/coreboot/init.c (grub_machine_init): Add call to
grub_at_keyboard_init().
* include/grub/i386/ieee1275/console.h (grub_keyboard_controller_init)
(grub_console_checkkey, grub_console_getkey): Remove (now provided by
at_keyboard.mod via input terminal interface).
* include/grub/i386/coreboot/console.h: Convert into a stub for
`<grub/i386/pc/console.h>'.
Migrate full terminals to new API:
* term/efi/console.c (grub_console_term): Split into ...
(grub_console_term_input): ... this, and ...
(grub_console_term_output): ... this. Update all users.
* term/ieee1275/ofconsole.c: Remove __i386__ hack.
(grub_ofconsole_init): Split into ...
(grub_ofconsole_init_input): ... this, and ...
(grub_ofconsole_init_output): ... this.
(grub_ofconsole_term): Split into ...
(grub_ofconsole_term_input): ... this, and ...
(grub_ofconsole_term_output): ... this. Update all users.
* term/i386/pc/serial.c (grub_serial_term): Split into ...
(grub_serial_term_input): ... this, and ...
(grub_serial_term_output): ... this. Update all users.
* term/i386/pc/console.c (grub_console_term): Split into ...
(grub_console_term_input): ... this, and ...
(grub_console_term_output): ... this. Update all users.
(grub_console_term_input): Only enable it on PC/BIOS platform.
(grub_console_init): Remove grub_keyboard_controller_init() call.
Migrate input terminals to new API:
* term/i386/pc/at_keyboard.c: Replace `cpu' and `machine' with
`i386' and `i386/pc' to enable build on x86_64 (this driver is
i386-specific anyway).
(grub_console_checkkey): Rename to ...
(grub_at_keyboard_checkkey): ... this. Static-ize. Update all
users.
(grub_keyboard_controller_orig): New variable.
(grub_console_getkey): Rename to ...
(grub_at_keyboard_getkey): ... this. Static-ize. Update all
users.
(grub_keyboard_controller_init): Static-ize. Save original
controller value so that it can be restored ...
(grub_keyboard_controller_fini): ... here (new function).
(grub_at_keyboard_term): New structure.
(GRUB_MOD_INIT(at_keyboard), GRUB_MOD_FINI(at_keyboard)): New
functions.
Migrate output terminals to new API:
* term/i386/pc/vga.c (grub_vga_term): Change type to
`struct grub_term_output'. Remove `.checkkey' and `.getkey'
members. Update all users.
* term/gfxterm.c (grub_video_term): Change type to
`struct grub_term_output'. Remove `.checkkey' and `.getkey'
members. Update all users.
* include/grub/i386/pc/console.h (grub_console_checkkey)
(grub_console_getkey): Do not export (no longer needed by gfxterm,
etc).
Migrate `terminal' command and userland tools to new API:
* commands/terminal.c (grub_cmd_terminal): Split into ...
(grub_cmd_terminal_input): ... this, and ...
(grub_cmd_terminal_output): ... this.
(GRUB_MOD_INIT(terminal)): Split `terminal' command in two commands:
`terminal_input' and `terminal_output'.
* util/grub.d/00_header.in: Adjust `terminal' calls to new
`terminal_input' / `terminal_output' API.
* util/grub-mkconfig.in: Export ${GRUB_TERMINAL_INPUT} and
${GRUB_TERMINAL_OUTPUT} instead of ${GRUB_TERMINAL} (and if user
provided ${GRUB_TERMINAL}, convert it).
2008-11-07 19:11:39 +00:00
|
|
|
|
|
|
|
/* Clean up the terminal. */
|
2010-05-07 00:30:44 +00:00
|
|
|
grub_err_t (*fini) (struct grub_term_input *term);
|
2009-06-10 21:04:23 +00:00
|
|
|
|
2010-08-23 10:07:49 +00:00
|
|
|
/* Get a character if any input character is available. Otherwise return -1 */
|
2010-05-07 00:30:44 +00:00
|
|
|
int (*getkey) (struct grub_term_input *term);
|
2009-08-28 13:20:34 +00:00
|
|
|
|
|
|
|
/* Get keyboard modifier status. */
|
2010-05-07 00:30:44 +00:00
|
|
|
int (*getkeystatus) (struct grub_term_input *term);
|
2010-05-10 12:54:51 +00:00
|
|
|
|
2010-05-07 00:30:44 +00:00
|
|
|
void *data;
|
2008-11-07 Robert Millan <rmh@aybabtu.com>
Modularize at_keyboard.mod:
* conf/i386.rmk (pkglib_MODULES): Add `at_keyboard.mod'.
(at_keyboard_mod_SOURCES, at_keyboard_mod_CFLAGS)
(at_keyboard_mod_LDFLAGS): New variables.
Actual terminal split:
* include/grub/term.h (struct grub_term): Split in ...
(struct grub_term_input): ... this, and ...
(struct grub_term_output): ... this. Update all users.
(grub_term_set_current): Split in ...
(grub_term_set_current_input): ... this, and ...
(grub_term_set_current_output): ... this.
(grub_term_get_current): Split in ...
(grub_term_get_current_input): ... this, and ...
(grub_term_get_current_output): ... this.
(grub_term_register): Split in ...
(grub_term_register_input): ... this, and ...
(grub_term_register_output): ... this.
(grub_term_unregister): Split in ...
(grub_term_unregister_input): ... this, and ...
(grub_term_unregister_output): ... this.
(grub_term_iterate): Split in ...
(grub_term_iterate_input): ... this, and ...
(grub_term_iterate_output): ... this.
* kern/term.c (grub_term_list): Split in ...
(grub_term_list_input): ... this, and ...
(grub_term_list_output): ... this. Update all users.
(grub_cur_term): Split in ...
(grub_cur_term_input): ... this, and ...
(grub_cur_term_output): ... this. Update all users.
(grub_term_set_current): Split in ...
(grub_term_set_current_input): ... this, and ...
(grub_term_set_current_output): ... this.
(grub_term_get_current): Split in ...
(grub_term_get_current_input): ... this, and ...
(grub_term_get_current_output): ... this.
(grub_term_register): Split in ...
(grub_term_register_input): ... this, and ...
(grub_term_register_output): ... this.
(grub_term_unregister): Split in ...
(grub_term_unregister_input): ... this, and ...
(grub_term_unregister_output): ... this.
(grub_term_iterate): Split in ...
(grub_term_iterate_input): ... this, and ...
(grub_term_iterate_output): ... this.
* kern/misc.c (grub_abort): Split use of grub_term_get_current() into
a check for input and one for output (and only attempt to get keys
from user when input works).
* util/grub-probe.c (grub_term_get_current): Split in ...
(grub_term_get_current_input): ... this, and ...
(grub_term_get_current_output): ... this.
* util/grub-fstest.c: Likewise.
* util/i386/pc/grub-setup.c: Likewise.
* util/grub-editenv.c: Likewise.
Portability adjustments:
* conf/i386-ieee1275.rmk (kernel_elf_SOURCES): Remove
`term/i386/pc/at_keyboard.c'.
* kern/ieee1275/init.c [__i386__] (grub_machine_init): Remove call to
grub_keyboard_controller_init() (now handled by terminal .init).
* kern/i386/coreboot/init.c (grub_machine_init): Add call to
grub_at_keyboard_init().
* include/grub/i386/ieee1275/console.h (grub_keyboard_controller_init)
(grub_console_checkkey, grub_console_getkey): Remove (now provided by
at_keyboard.mod via input terminal interface).
* include/grub/i386/coreboot/console.h: Convert into a stub for
`<grub/i386/pc/console.h>'.
Migrate full terminals to new API:
* term/efi/console.c (grub_console_term): Split into ...
(grub_console_term_input): ... this, and ...
(grub_console_term_output): ... this. Update all users.
* term/ieee1275/ofconsole.c: Remove __i386__ hack.
(grub_ofconsole_init): Split into ...
(grub_ofconsole_init_input): ... this, and ...
(grub_ofconsole_init_output): ... this.
(grub_ofconsole_term): Split into ...
(grub_ofconsole_term_input): ... this, and ...
(grub_ofconsole_term_output): ... this. Update all users.
* term/i386/pc/serial.c (grub_serial_term): Split into ...
(grub_serial_term_input): ... this, and ...
(grub_serial_term_output): ... this. Update all users.
* term/i386/pc/console.c (grub_console_term): Split into ...
(grub_console_term_input): ... this, and ...
(grub_console_term_output): ... this. Update all users.
(grub_console_term_input): Only enable it on PC/BIOS platform.
(grub_console_init): Remove grub_keyboard_controller_init() call.
Migrate input terminals to new API:
* term/i386/pc/at_keyboard.c: Replace `cpu' and `machine' with
`i386' and `i386/pc' to enable build on x86_64 (this driver is
i386-specific anyway).
(grub_console_checkkey): Rename to ...
(grub_at_keyboard_checkkey): ... this. Static-ize. Update all
users.
(grub_keyboard_controller_orig): New variable.
(grub_console_getkey): Rename to ...
(grub_at_keyboard_getkey): ... this. Static-ize. Update all
users.
(grub_keyboard_controller_init): Static-ize. Save original
controller value so that it can be restored ...
(grub_keyboard_controller_fini): ... here (new function).
(grub_at_keyboard_term): New structure.
(GRUB_MOD_INIT(at_keyboard), GRUB_MOD_FINI(at_keyboard)): New
functions.
Migrate output terminals to new API:
* term/i386/pc/vga.c (grub_vga_term): Change type to
`struct grub_term_output'. Remove `.checkkey' and `.getkey'
members. Update all users.
* term/gfxterm.c (grub_video_term): Change type to
`struct grub_term_output'. Remove `.checkkey' and `.getkey'
members. Update all users.
* include/grub/i386/pc/console.h (grub_console_checkkey)
(grub_console_getkey): Do not export (no longer needed by gfxterm,
etc).
Migrate `terminal' command and userland tools to new API:
* commands/terminal.c (grub_cmd_terminal): Split into ...
(grub_cmd_terminal_input): ... this, and ...
(grub_cmd_terminal_output): ... this.
(GRUB_MOD_INIT(terminal)): Split `terminal' command in two commands:
`terminal_input' and `terminal_output'.
* util/grub.d/00_header.in: Adjust `terminal' calls to new
`terminal_input' / `terminal_output' API.
* util/grub-mkconfig.in: Export ${GRUB_TERMINAL_INPUT} and
${GRUB_TERMINAL_OUTPUT} instead of ${GRUB_TERMINAL} (and if user
provided ${GRUB_TERMINAL}, convert it).
2008-11-07 19:11:39 +00:00
|
|
|
};
|
|
|
|
typedef struct grub_term_input *grub_term_input_t;
|
|
|
|
|
2013-10-19 21:59:32 +00:00
|
|
|
/* Made in a way to fit into uint32_t and so be passed in a register. */
|
|
|
|
struct grub_term_coordinate
|
|
|
|
{
|
2013-11-03 23:39:13 +00:00
|
|
|
grub_uint16_t x;
|
|
|
|
grub_uint16_t y;
|
2013-10-19 21:59:32 +00:00
|
|
|
};
|
|
|
|
|
2008-11-07 Robert Millan <rmh@aybabtu.com>
Modularize at_keyboard.mod:
* conf/i386.rmk (pkglib_MODULES): Add `at_keyboard.mod'.
(at_keyboard_mod_SOURCES, at_keyboard_mod_CFLAGS)
(at_keyboard_mod_LDFLAGS): New variables.
Actual terminal split:
* include/grub/term.h (struct grub_term): Split in ...
(struct grub_term_input): ... this, and ...
(struct grub_term_output): ... this. Update all users.
(grub_term_set_current): Split in ...
(grub_term_set_current_input): ... this, and ...
(grub_term_set_current_output): ... this.
(grub_term_get_current): Split in ...
(grub_term_get_current_input): ... this, and ...
(grub_term_get_current_output): ... this.
(grub_term_register): Split in ...
(grub_term_register_input): ... this, and ...
(grub_term_register_output): ... this.
(grub_term_unregister): Split in ...
(grub_term_unregister_input): ... this, and ...
(grub_term_unregister_output): ... this.
(grub_term_iterate): Split in ...
(grub_term_iterate_input): ... this, and ...
(grub_term_iterate_output): ... this.
* kern/term.c (grub_term_list): Split in ...
(grub_term_list_input): ... this, and ...
(grub_term_list_output): ... this. Update all users.
(grub_cur_term): Split in ...
(grub_cur_term_input): ... this, and ...
(grub_cur_term_output): ... this. Update all users.
(grub_term_set_current): Split in ...
(grub_term_set_current_input): ... this, and ...
(grub_term_set_current_output): ... this.
(grub_term_get_current): Split in ...
(grub_term_get_current_input): ... this, and ...
(grub_term_get_current_output): ... this.
(grub_term_register): Split in ...
(grub_term_register_input): ... this, and ...
(grub_term_register_output): ... this.
(grub_term_unregister): Split in ...
(grub_term_unregister_input): ... this, and ...
(grub_term_unregister_output): ... this.
(grub_term_iterate): Split in ...
(grub_term_iterate_input): ... this, and ...
(grub_term_iterate_output): ... this.
* kern/misc.c (grub_abort): Split use of grub_term_get_current() into
a check for input and one for output (and only attempt to get keys
from user when input works).
* util/grub-probe.c (grub_term_get_current): Split in ...
(grub_term_get_current_input): ... this, and ...
(grub_term_get_current_output): ... this.
* util/grub-fstest.c: Likewise.
* util/i386/pc/grub-setup.c: Likewise.
* util/grub-editenv.c: Likewise.
Portability adjustments:
* conf/i386-ieee1275.rmk (kernel_elf_SOURCES): Remove
`term/i386/pc/at_keyboard.c'.
* kern/ieee1275/init.c [__i386__] (grub_machine_init): Remove call to
grub_keyboard_controller_init() (now handled by terminal .init).
* kern/i386/coreboot/init.c (grub_machine_init): Add call to
grub_at_keyboard_init().
* include/grub/i386/ieee1275/console.h (grub_keyboard_controller_init)
(grub_console_checkkey, grub_console_getkey): Remove (now provided by
at_keyboard.mod via input terminal interface).
* include/grub/i386/coreboot/console.h: Convert into a stub for
`<grub/i386/pc/console.h>'.
Migrate full terminals to new API:
* term/efi/console.c (grub_console_term): Split into ...
(grub_console_term_input): ... this, and ...
(grub_console_term_output): ... this. Update all users.
* term/ieee1275/ofconsole.c: Remove __i386__ hack.
(grub_ofconsole_init): Split into ...
(grub_ofconsole_init_input): ... this, and ...
(grub_ofconsole_init_output): ... this.
(grub_ofconsole_term): Split into ...
(grub_ofconsole_term_input): ... this, and ...
(grub_ofconsole_term_output): ... this. Update all users.
* term/i386/pc/serial.c (grub_serial_term): Split into ...
(grub_serial_term_input): ... this, and ...
(grub_serial_term_output): ... this. Update all users.
* term/i386/pc/console.c (grub_console_term): Split into ...
(grub_console_term_input): ... this, and ...
(grub_console_term_output): ... this. Update all users.
(grub_console_term_input): Only enable it on PC/BIOS platform.
(grub_console_init): Remove grub_keyboard_controller_init() call.
Migrate input terminals to new API:
* term/i386/pc/at_keyboard.c: Replace `cpu' and `machine' with
`i386' and `i386/pc' to enable build on x86_64 (this driver is
i386-specific anyway).
(grub_console_checkkey): Rename to ...
(grub_at_keyboard_checkkey): ... this. Static-ize. Update all
users.
(grub_keyboard_controller_orig): New variable.
(grub_console_getkey): Rename to ...
(grub_at_keyboard_getkey): ... this. Static-ize. Update all
users.
(grub_keyboard_controller_init): Static-ize. Save original
controller value so that it can be restored ...
(grub_keyboard_controller_fini): ... here (new function).
(grub_at_keyboard_term): New structure.
(GRUB_MOD_INIT(at_keyboard), GRUB_MOD_FINI(at_keyboard)): New
functions.
Migrate output terminals to new API:
* term/i386/pc/vga.c (grub_vga_term): Change type to
`struct grub_term_output'. Remove `.checkkey' and `.getkey'
members. Update all users.
* term/gfxterm.c (grub_video_term): Change type to
`struct grub_term_output'. Remove `.checkkey' and `.getkey'
members. Update all users.
* include/grub/i386/pc/console.h (grub_console_checkkey)
(grub_console_getkey): Do not export (no longer needed by gfxterm,
etc).
Migrate `terminal' command and userland tools to new API:
* commands/terminal.c (grub_cmd_terminal): Split into ...
(grub_cmd_terminal_input): ... this, and ...
(grub_cmd_terminal_output): ... this.
(GRUB_MOD_INIT(terminal)): Split `terminal' command in two commands:
`terminal_input' and `terminal_output'.
* util/grub.d/00_header.in: Adjust `terminal' calls to new
`terminal_input' / `terminal_output' API.
* util/grub-mkconfig.in: Export ${GRUB_TERMINAL_INPUT} and
${GRUB_TERMINAL_OUTPUT} instead of ${GRUB_TERMINAL} (and if user
provided ${GRUB_TERMINAL}, convert it).
2008-11-07 19:11:39 +00:00
|
|
|
struct grub_term_output
|
2002-12-27 08:53:07 +00:00
|
|
|
{
|
2009-03-01 17:51:44 +00:00
|
|
|
/* The next terminal. */
|
|
|
|
struct grub_term_output *next;
|
2012-01-24 12:31:12 +00:00
|
|
|
struct grub_term_output **prev;
|
2009-03-01 17:51:44 +00:00
|
|
|
|
2002-12-27 08:53:07 +00:00
|
|
|
/* The terminal name. */
|
|
|
|
const char *name;
|
2003-09-25 20:15:53 +00:00
|
|
|
|
|
|
|
/* Initialize the terminal. */
|
2010-05-07 00:30:44 +00:00
|
|
|
grub_err_t (*init) (struct grub_term_output *term);
|
2003-09-25 20:15:53 +00:00
|
|
|
|
|
|
|
/* Clean up the terminal. */
|
2010-05-07 00:30:44 +00:00
|
|
|
grub_err_t (*fini) (struct grub_term_output *term);
|
2009-06-10 21:04:23 +00:00
|
|
|
|
2003-09-25 20:15:53 +00:00
|
|
|
/* Put a character. C is encoded in Unicode. */
|
2010-05-07 00:30:44 +00:00
|
|
|
void (*putchar) (struct grub_term_output *term,
|
|
|
|
const struct grub_unicode_glyph *c);
|
2005-08-20 05:26:51 +00:00
|
|
|
|
|
|
|
/* Get the number of columns occupied by a given character C. C is
|
|
|
|
encoded in Unicode. */
|
2013-10-25 21:58:24 +00:00
|
|
|
grub_size_t (*getcharwidth) (struct grub_term_output *term,
|
|
|
|
const struct grub_unicode_glyph *c);
|
2009-06-10 21:04:23 +00:00
|
|
|
|
2013-10-19 21:59:32 +00:00
|
|
|
/* Get the screen size. */
|
|
|
|
struct grub_term_coordinate (*getwh) (struct grub_term_output *term);
|
2005-08-04 18:10:51 +00:00
|
|
|
|
2002-12-27 08:53:07 +00:00
|
|
|
/* Get the cursor position. The return value is ((X << 8) | Y). */
|
2013-10-19 21:59:32 +00:00
|
|
|
struct grub_term_coordinate (*getxy) (struct grub_term_output *term);
|
2009-06-10 21:04:23 +00:00
|
|
|
|
2002-12-27 08:53:07 +00:00
|
|
|
/* Go to the position (X, Y). */
|
2010-05-07 00:30:44 +00:00
|
|
|
void (*gotoxy) (struct grub_term_output *term,
|
2013-10-19 21:59:32 +00:00
|
|
|
struct grub_term_coordinate pos);
|
2009-06-10 21:04:23 +00:00
|
|
|
|
2002-12-27 08:53:07 +00:00
|
|
|
/* Clear the screen. */
|
2010-05-07 00:30:44 +00:00
|
|
|
void (*cls) (struct grub_term_output *term);
|
2009-06-10 21:04:23 +00:00
|
|
|
|
2002-12-27 08:53:07 +00:00
|
|
|
/* Set the current color to be used */
|
2010-05-07 00:30:44 +00:00
|
|
|
void (*setcolorstate) (struct grub_term_output *term,
|
|
|
|
grub_term_color_state state);
|
2009-06-10 21:04:23 +00:00
|
|
|
|
2002-12-27 08:53:07 +00:00
|
|
|
/* Turn on/off the cursor. */
|
2010-05-07 00:30:44 +00:00
|
|
|
void (*setcursor) (struct grub_term_output *term, int on);
|
2002-12-27 08:53:07 +00:00
|
|
|
|
2003-11-17 18:07:09 +00:00
|
|
|
/* Update the screen. */
|
2010-05-07 00:30:44 +00:00
|
|
|
void (*refresh) (struct grub_term_output *term);
|
2003-11-17 18:07:09 +00:00
|
|
|
|
2012-05-21 20:17:11 +00:00
|
|
|
/* gfxterm only: put in fullscreen mode. */
|
|
|
|
grub_err_t (*fullscreen) (void);
|
|
|
|
|
2002-12-27 08:53:07 +00:00
|
|
|
/* The feature flags defined above. */
|
2004-04-04 13:46:03 +00:00
|
|
|
grub_uint32_t flags;
|
2010-05-07 00:30:44 +00:00
|
|
|
|
2013-10-22 18:42:20 +00:00
|
|
|
/* Progress data. */
|
|
|
|
grub_uint32_t progress_update_divisor;
|
|
|
|
grub_uint32_t progress_update_counter;
|
|
|
|
|
2010-05-07 00:30:44 +00:00
|
|
|
void *data;
|
2002-12-27 08:53:07 +00:00
|
|
|
};
|
2008-11-07 Robert Millan <rmh@aybabtu.com>
Modularize at_keyboard.mod:
* conf/i386.rmk (pkglib_MODULES): Add `at_keyboard.mod'.
(at_keyboard_mod_SOURCES, at_keyboard_mod_CFLAGS)
(at_keyboard_mod_LDFLAGS): New variables.
Actual terminal split:
* include/grub/term.h (struct grub_term): Split in ...
(struct grub_term_input): ... this, and ...
(struct grub_term_output): ... this. Update all users.
(grub_term_set_current): Split in ...
(grub_term_set_current_input): ... this, and ...
(grub_term_set_current_output): ... this.
(grub_term_get_current): Split in ...
(grub_term_get_current_input): ... this, and ...
(grub_term_get_current_output): ... this.
(grub_term_register): Split in ...
(grub_term_register_input): ... this, and ...
(grub_term_register_output): ... this.
(grub_term_unregister): Split in ...
(grub_term_unregister_input): ... this, and ...
(grub_term_unregister_output): ... this.
(grub_term_iterate): Split in ...
(grub_term_iterate_input): ... this, and ...
(grub_term_iterate_output): ... this.
* kern/term.c (grub_term_list): Split in ...
(grub_term_list_input): ... this, and ...
(grub_term_list_output): ... this. Update all users.
(grub_cur_term): Split in ...
(grub_cur_term_input): ... this, and ...
(grub_cur_term_output): ... this. Update all users.
(grub_term_set_current): Split in ...
(grub_term_set_current_input): ... this, and ...
(grub_term_set_current_output): ... this.
(grub_term_get_current): Split in ...
(grub_term_get_current_input): ... this, and ...
(grub_term_get_current_output): ... this.
(grub_term_register): Split in ...
(grub_term_register_input): ... this, and ...
(grub_term_register_output): ... this.
(grub_term_unregister): Split in ...
(grub_term_unregister_input): ... this, and ...
(grub_term_unregister_output): ... this.
(grub_term_iterate): Split in ...
(grub_term_iterate_input): ... this, and ...
(grub_term_iterate_output): ... this.
* kern/misc.c (grub_abort): Split use of grub_term_get_current() into
a check for input and one for output (and only attempt to get keys
from user when input works).
* util/grub-probe.c (grub_term_get_current): Split in ...
(grub_term_get_current_input): ... this, and ...
(grub_term_get_current_output): ... this.
* util/grub-fstest.c: Likewise.
* util/i386/pc/grub-setup.c: Likewise.
* util/grub-editenv.c: Likewise.
Portability adjustments:
* conf/i386-ieee1275.rmk (kernel_elf_SOURCES): Remove
`term/i386/pc/at_keyboard.c'.
* kern/ieee1275/init.c [__i386__] (grub_machine_init): Remove call to
grub_keyboard_controller_init() (now handled by terminal .init).
* kern/i386/coreboot/init.c (grub_machine_init): Add call to
grub_at_keyboard_init().
* include/grub/i386/ieee1275/console.h (grub_keyboard_controller_init)
(grub_console_checkkey, grub_console_getkey): Remove (now provided by
at_keyboard.mod via input terminal interface).
* include/grub/i386/coreboot/console.h: Convert into a stub for
`<grub/i386/pc/console.h>'.
Migrate full terminals to new API:
* term/efi/console.c (grub_console_term): Split into ...
(grub_console_term_input): ... this, and ...
(grub_console_term_output): ... this. Update all users.
* term/ieee1275/ofconsole.c: Remove __i386__ hack.
(grub_ofconsole_init): Split into ...
(grub_ofconsole_init_input): ... this, and ...
(grub_ofconsole_init_output): ... this.
(grub_ofconsole_term): Split into ...
(grub_ofconsole_term_input): ... this, and ...
(grub_ofconsole_term_output): ... this. Update all users.
* term/i386/pc/serial.c (grub_serial_term): Split into ...
(grub_serial_term_input): ... this, and ...
(grub_serial_term_output): ... this. Update all users.
* term/i386/pc/console.c (grub_console_term): Split into ...
(grub_console_term_input): ... this, and ...
(grub_console_term_output): ... this. Update all users.
(grub_console_term_input): Only enable it on PC/BIOS platform.
(grub_console_init): Remove grub_keyboard_controller_init() call.
Migrate input terminals to new API:
* term/i386/pc/at_keyboard.c: Replace `cpu' and `machine' with
`i386' and `i386/pc' to enable build on x86_64 (this driver is
i386-specific anyway).
(grub_console_checkkey): Rename to ...
(grub_at_keyboard_checkkey): ... this. Static-ize. Update all
users.
(grub_keyboard_controller_orig): New variable.
(grub_console_getkey): Rename to ...
(grub_at_keyboard_getkey): ... this. Static-ize. Update all
users.
(grub_keyboard_controller_init): Static-ize. Save original
controller value so that it can be restored ...
(grub_keyboard_controller_fini): ... here (new function).
(grub_at_keyboard_term): New structure.
(GRUB_MOD_INIT(at_keyboard), GRUB_MOD_FINI(at_keyboard)): New
functions.
Migrate output terminals to new API:
* term/i386/pc/vga.c (grub_vga_term): Change type to
`struct grub_term_output'. Remove `.checkkey' and `.getkey'
members. Update all users.
* term/gfxterm.c (grub_video_term): Change type to
`struct grub_term_output'. Remove `.checkkey' and `.getkey'
members. Update all users.
* include/grub/i386/pc/console.h (grub_console_checkkey)
(grub_console_getkey): Do not export (no longer needed by gfxterm,
etc).
Migrate `terminal' command and userland tools to new API:
* commands/terminal.c (grub_cmd_terminal): Split into ...
(grub_cmd_terminal_input): ... this, and ...
(grub_cmd_terminal_output): ... this.
(GRUB_MOD_INIT(terminal)): Split `terminal' command in two commands:
`terminal_input' and `terminal_output'.
* util/grub.d/00_header.in: Adjust `terminal' calls to new
`terminal_input' / `terminal_output' API.
* util/grub-mkconfig.in: Export ${GRUB_TERMINAL_INPUT} and
${GRUB_TERMINAL_OUTPUT} instead of ${GRUB_TERMINAL} (and if user
provided ${GRUB_TERMINAL}, convert it).
2008-11-07 19:11:39 +00:00
|
|
|
typedef struct grub_term_output *grub_term_output_t;
|
|
|
|
|
2010-05-07 23:06:22 +00:00
|
|
|
#define GRUB_TERM_DEFAULT_NORMAL_COLOR 0x07
|
|
|
|
#define GRUB_TERM_DEFAULT_HIGHLIGHT_COLOR 0x70
|
|
|
|
#define GRUB_TERM_DEFAULT_STANDARD_COLOR 0x07
|
|
|
|
|
2013-01-21 16:53:41 +00:00
|
|
|
/* Current color state. */
|
|
|
|
extern grub_uint8_t EXPORT_VAR(grub_term_normal_color);
|
|
|
|
extern grub_uint8_t EXPORT_VAR(grub_term_highlight_color);
|
|
|
|
|
2009-12-24 20:54:37 +00:00
|
|
|
extern struct grub_term_output *EXPORT_VAR(grub_term_outputs_disabled);
|
|
|
|
extern struct grub_term_input *EXPORT_VAR(grub_term_inputs_disabled);
|
2009-12-23 23:37:11 +00:00
|
|
|
extern struct grub_term_output *EXPORT_VAR(grub_term_outputs);
|
2009-12-24 16:08:14 +00:00
|
|
|
extern struct grub_term_input *EXPORT_VAR(grub_term_inputs);
|
2009-03-01 17:51:44 +00:00
|
|
|
|
|
|
|
static inline void
|
2009-04-14 18:12:14 +00:00
|
|
|
grub_term_register_input (const char *name __attribute__ ((unused)),
|
|
|
|
grub_term_input_t term)
|
2009-03-01 17:51:44 +00:00
|
|
|
{
|
2010-01-09 22:42:17 +00:00
|
|
|
if (grub_term_inputs)
|
|
|
|
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs_disabled),
|
|
|
|
GRUB_AS_LIST (term));
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* If this is the first terminal, enable automatically. */
|
2010-05-07 00:30:44 +00:00
|
|
|
if (! term->init || term->init (term) == GRUB_ERR_NONE)
|
2010-01-18 19:43:39 +00:00
|
|
|
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs), GRUB_AS_LIST (term));
|
2010-01-09 22:42:17 +00:00
|
|
|
}
|
2009-03-01 17:51:44 +00:00
|
|
|
}
|
|
|
|
|
2011-01-18 14:28:44 +00:00
|
|
|
static inline void
|
|
|
|
grub_term_register_input_inactive (const char *name __attribute__ ((unused)),
|
|
|
|
grub_term_input_t term)
|
|
|
|
{
|
|
|
|
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs_disabled),
|
|
|
|
GRUB_AS_LIST (term));
|
|
|
|
}
|
|
|
|
|
2010-05-22 22:09:39 +00:00
|
|
|
static inline void
|
|
|
|
grub_term_register_input_active (const char *name __attribute__ ((unused)),
|
|
|
|
grub_term_input_t term)
|
|
|
|
{
|
2010-07-02 17:35:07 +00:00
|
|
|
if (! term->init || term->init (term) == GRUB_ERR_NONE)
|
2010-05-22 22:09:39 +00:00
|
|
|
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs), GRUB_AS_LIST (term));
|
|
|
|
}
|
|
|
|
|
2009-03-01 17:51:44 +00:00
|
|
|
static inline void
|
2009-04-14 18:12:14 +00:00
|
|
|
grub_term_register_output (const char *name __attribute__ ((unused)),
|
|
|
|
grub_term_output_t term)
|
2009-03-01 17:51:44 +00:00
|
|
|
{
|
2010-01-09 22:42:17 +00:00
|
|
|
if (grub_term_outputs)
|
|
|
|
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs_disabled),
|
|
|
|
GRUB_AS_LIST (term));
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* If this is the first terminal, enable automatically. */
|
2010-05-07 00:30:44 +00:00
|
|
|
if (! term->init || term->init (term) == GRUB_ERR_NONE)
|
2010-01-18 19:43:39 +00:00
|
|
|
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs),
|
|
|
|
GRUB_AS_LIST (term));
|
2010-01-09 22:42:17 +00:00
|
|
|
}
|
2009-03-01 17:51:44 +00:00
|
|
|
}
|
|
|
|
|
2011-01-18 14:28:44 +00:00
|
|
|
static inline void
|
|
|
|
grub_term_register_output_inactive (const char *name __attribute__ ((unused)),
|
|
|
|
grub_term_output_t term)
|
|
|
|
{
|
|
|
|
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs_disabled),
|
|
|
|
GRUB_AS_LIST (term));
|
|
|
|
}
|
|
|
|
|
2010-05-22 22:09:39 +00:00
|
|
|
static inline void
|
|
|
|
grub_term_register_output_active (const char *name __attribute__ ((unused)),
|
|
|
|
grub_term_output_t term)
|
|
|
|
{
|
2010-07-02 17:35:07 +00:00
|
|
|
if (! term->init || term->init (term) == GRUB_ERR_NONE)
|
2010-05-22 22:09:39 +00:00
|
|
|
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs),
|
|
|
|
GRUB_AS_LIST (term));
|
|
|
|
}
|
|
|
|
|
2009-03-01 17:51:44 +00:00
|
|
|
static inline void
|
|
|
|
grub_term_unregister_input (grub_term_input_t term)
|
|
|
|
{
|
2012-01-24 12:31:12 +00:00
|
|
|
grub_list_remove (GRUB_AS_LIST (term));
|
|
|
|
grub_list_remove (GRUB_AS_LIST (term));
|
2009-03-01 17:51:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
grub_term_unregister_output (grub_term_output_t term)
|
|
|
|
{
|
2012-01-24 12:31:12 +00:00
|
|
|
grub_list_remove (GRUB_AS_LIST (term));
|
|
|
|
grub_list_remove (GRUB_AS_LIST (term));
|
2009-03-01 17:51:44 +00:00
|
|
|
}
|
|
|
|
|
2010-03-26 18:32:21 +00:00
|
|
|
#define FOR_ACTIVE_TERM_INPUTS(var) FOR_LIST_ELEMENTS((var), (grub_term_inputs))
|
|
|
|
#define FOR_DISABLED_TERM_INPUTS(var) FOR_LIST_ELEMENTS((var), (grub_term_inputs_disabled))
|
|
|
|
#define FOR_ACTIVE_TERM_OUTPUTS(var) FOR_LIST_ELEMENTS((var), (grub_term_outputs))
|
|
|
|
#define FOR_DISABLED_TERM_OUTPUTS(var) FOR_LIST_ELEMENTS((var), (grub_term_outputs_disabled))
|
2009-03-01 17:51:44 +00:00
|
|
|
|
2010-03-15 20:14:11 +00:00
|
|
|
void grub_putcode (grub_uint32_t code, struct grub_term_output *term);
|
2010-08-19 11:32:36 +00:00
|
|
|
int EXPORT_FUNC(grub_getkey) (void);
|
2012-02-18 18:59:01 +00:00
|
|
|
int EXPORT_FUNC(grub_getkey_noblock) (void);
|
2010-07-02 16:20:48 +00:00
|
|
|
void grub_cls (void);
|
2004-04-04 13:46:03 +00:00
|
|
|
void EXPORT_FUNC(grub_refresh) (void);
|
2009-12-23 23:37:11 +00:00
|
|
|
void grub_puts_terminal (const char *str, struct grub_term_output *term);
|
2013-10-19 21:59:32 +00:00
|
|
|
struct grub_term_coordinate *grub_term_save_pos (void);
|
|
|
|
void grub_term_restore_pos (struct grub_term_coordinate *pos);
|
2009-12-23 23:37:11 +00:00
|
|
|
|
2009-12-24 14:34:33 +00:00
|
|
|
static inline unsigned grub_term_width (struct grub_term_output *term)
|
2009-12-23 23:37:11 +00:00
|
|
|
{
|
2015-01-20 16:55:41 +00:00
|
|
|
return term->getwh(term).x ? : 80;
|
2009-12-23 23:37:11 +00:00
|
|
|
}
|
|
|
|
|
2009-12-24 14:34:33 +00:00
|
|
|
static inline unsigned grub_term_height (struct grub_term_output *term)
|
2009-12-23 23:37:11 +00:00
|
|
|
{
|
2015-01-20 16:55:41 +00:00
|
|
|
return term->getwh(term).y ? : 24;
|
2009-12-23 23:37:11 +00:00
|
|
|
}
|
2002-12-27 08:53:07 +00:00
|
|
|
|
2013-10-19 21:59:32 +00:00
|
|
|
static inline struct grub_term_coordinate
|
2009-12-24 14:34:33 +00:00
|
|
|
grub_term_getxy (struct grub_term_output *term)
|
|
|
|
{
|
2010-05-07 00:30:44 +00:00
|
|
|
return term->getxy (term);
|
2009-12-24 14:34:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
grub_term_refresh (struct grub_term_output *term)
|
|
|
|
{
|
|
|
|
if (term->refresh)
|
2010-05-07 00:30:44 +00:00
|
|
|
term->refresh (term);
|
2009-12-24 14:34:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
2013-10-19 21:59:32 +00:00
|
|
|
grub_term_gotoxy (struct grub_term_output *term, struct grub_term_coordinate pos)
|
2009-12-24 14:34:33 +00:00
|
|
|
{
|
2013-10-19 21:59:32 +00:00
|
|
|
term->gotoxy (term, pos);
|
2009-12-24 14:34:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
grub_term_setcolorstate (struct grub_term_output *term,
|
|
|
|
grub_term_color_state state)
|
|
|
|
{
|
|
|
|
if (term->setcolorstate)
|
2010-05-07 00:30:44 +00:00
|
|
|
term->setcolorstate (term, state);
|
2009-12-24 14:34:33 +00:00
|
|
|
}
|
|
|
|
|
2010-07-02 16:20:48 +00:00
|
|
|
static inline void
|
|
|
|
grub_setcolorstate (grub_term_color_state state)
|
|
|
|
{
|
|
|
|
struct grub_term_output *term;
|
|
|
|
|
|
|
|
FOR_ACTIVE_TERM_OUTPUTS(term)
|
|
|
|
grub_term_setcolorstate (term, state);
|
|
|
|
}
|
|
|
|
|
2009-12-24 14:34:33 +00:00
|
|
|
/* Turn on/off the cursor. */
|
|
|
|
static inline void
|
|
|
|
grub_term_setcursor (struct grub_term_output *term, int on)
|
|
|
|
{
|
|
|
|
if (term->setcursor)
|
2010-05-07 00:30:44 +00:00
|
|
|
term->setcursor (term, on);
|
2009-12-24 14:34:33 +00:00
|
|
|
}
|
|
|
|
|
2009-12-25 00:13:21 +00:00
|
|
|
static inline void
|
|
|
|
grub_term_cls (struct grub_term_output *term)
|
|
|
|
{
|
|
|
|
if (term->cls)
|
2010-05-07 00:30:44 +00:00
|
|
|
(term->cls) (term);
|
2009-12-25 00:13:21 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
grub_putcode ('\n', term);
|
|
|
|
grub_term_refresh (term);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-04 09:25:53 +00:00
|
|
|
#if HAVE_FONT_SOURCE
|
2010-03-16 20:29:15 +00:00
|
|
|
|
2013-10-25 21:58:24 +00:00
|
|
|
grub_size_t
|
2010-03-16 20:29:15 +00:00
|
|
|
grub_unicode_estimate_width (const struct grub_unicode_glyph *c);
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
2013-12-21 13:33:36 +00:00
|
|
|
static inline grub_size_t
|
2010-03-16 20:29:15 +00:00
|
|
|
grub_unicode_estimate_width (const struct grub_unicode_glyph *c __attribute__ ((unused)))
|
|
|
|
{
|
|
|
|
if (grub_unicode_get_comb_type (c->base))
|
|
|
|
return 0;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2012-03-27 15:07:26 +00:00
|
|
|
#define GRUB_TERM_TAB_WIDTH 8
|
|
|
|
|
2013-10-25 21:58:24 +00:00
|
|
|
static inline grub_size_t
|
2010-03-15 20:14:11 +00:00
|
|
|
grub_term_getcharwidth (struct grub_term_output *term,
|
|
|
|
const struct grub_unicode_glyph *c)
|
2009-12-24 14:34:33 +00:00
|
|
|
{
|
2012-03-27 15:07:26 +00:00
|
|
|
if (c->base == '\t')
|
|
|
|
return GRUB_TERM_TAB_WIDTH;
|
|
|
|
|
2009-12-24 14:34:33 +00:00
|
|
|
if (term->getcharwidth)
|
2010-05-07 00:30:44 +00:00
|
|
|
return term->getcharwidth (term, c);
|
2010-03-16 20:29:15 +00:00
|
|
|
else if (((term->flags & GRUB_TERM_CODE_TYPE_MASK)
|
|
|
|
== GRUB_TERM_CODE_TYPE_UTF8_LOGICAL)
|
|
|
|
|| ((term->flags & GRUB_TERM_CODE_TYPE_MASK)
|
|
|
|
== GRUB_TERM_CODE_TYPE_UTF8_VISUAL)
|
|
|
|
|| ((term->flags & GRUB_TERM_CODE_TYPE_MASK)
|
|
|
|
== GRUB_TERM_CODE_TYPE_VISUAL_GLYPHS))
|
|
|
|
return grub_unicode_estimate_width (c);
|
2009-12-24 14:34:33 +00:00
|
|
|
else
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2009-12-25 02:37:20 +00:00
|
|
|
struct grub_term_autoload
|
|
|
|
{
|
|
|
|
struct grub_term_autoload *next;
|
|
|
|
char *name;
|
|
|
|
char *modname;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern struct grub_term_autoload *grub_term_input_autoload;
|
|
|
|
extern struct grub_term_autoload *grub_term_output_autoload;
|
|
|
|
|
2010-01-01 17:58:00 +00:00
|
|
|
static inline void
|
2010-01-05 15:27:41 +00:00
|
|
|
grub_print_spaces (struct grub_term_output *term, int number_spaces)
|
2010-01-01 17:58:00 +00:00
|
|
|
{
|
|
|
|
while (--number_spaces >= 0)
|
2010-01-05 15:27:41 +00:00
|
|
|
grub_putcode (' ', term);
|
2010-01-01 17:58:00 +00:00
|
|
|
}
|
|
|
|
|
2013-03-19 19:35:21 +00:00
|
|
|
extern void (*EXPORT_VAR (grub_term_poll_usb)) (int wait_for_completion);
|
2010-01-01 17:58:00 +00:00
|
|
|
|
2010-08-21 23:01:31 +00:00
|
|
|
#define GRUB_TERM_REPEAT_PRE_INTERVAL 400
|
2010-08-21 22:29:34 +00:00
|
|
|
#define GRUB_TERM_REPEAT_INTERVAL 50
|
|
|
|
|
2008-02-05 Robert Millan <rmh@aybabtu.com>
* include/grub/term.h (GRUB_TERM_LEFT, GRUB_TERM_RIGHT)
(GRUB_TERM_UP, GRUB_TERM_DOWN, GRUB_TERM_HOME, GRUB_TERM_END)
(GRUB_TERM_DC, GRUB_TERM_PPAGE, GRUB_TERM_NPAGE, GRUB_TERM_ESC)
(GRUB_TERM_TAB, GRUB_TERM_BACKSPACE): New macros.
* kern/i386/pc/startup.S: Include `<grub/term.h>'.
(translation_table): Replace hardcoded values with macros
provided by `<grub/term.h>'.
* term/i386/pc/at_keyboard.c: Include `<grub/term.h>'.
(keyboard_map): Correct/add a few values, with macros provided
by `<grub/term.h>'.
(keyboard_map_shift): Zero values that don't differ from their
`keyboard_map' equivalents.
(grub_console_checkkey): Optimize KEYBOARD_STATUS_CAPS_LOCK toggling.
Discard the second scan code that is always sent by Caps lock.
Only use `keyboard_map_shift' when it provides a non-zero value,
otherwise fallback to `keyboard_map'.
2008-02-05 10:23:24 +00:00
|
|
|
#endif /* ! ASM_FILE */
|
|
|
|
|
2004-04-04 13:46:03 +00:00
|
|
|
#endif /* ! GRUB_TERM_HEADER */
|