terminal split
PATCH 1/1 terminal split
Hi,
This patch splits terminal handling in input and output. While at it, it resolves/removes some of the kludges we had to work around this limitation.
For example, gfxterm/vga no longer need to assume the input is bios console, at_keyboard can be used in combination with any output terminal, etc.
It will also be possible to turn vga_text.c into a standalone output term, but this needs more work since it is currently sharing much code with the bios console in console.c.
Signature · 5 lines
Robert Millan The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."
i386.rmk +5 -2
@@ -1,8 +1,11 @@ # -*- makefile -*- pkglib_MODULES += cpuid.mod - -# For cpuid.mod. cpuid_mod_SOURCES = commands/i386/cpuid.c cpuid_mod_CFLAGS = $(COMMON_CFLAGS) cpuid_mod_LDFLAGS = $(COMMON_LDFLAGS) + +pkglib_MODULES += at_keyboard.mod +at_keyboard_mod_SOURCES = term/i386/pc/at_keyboard.c +at_keyboard_mod_CFLAGS = $(COMMON_CFLAGS) +at_keyboard_mod_LDFLAGS = $(COMMON_LDFLAGS)
i386-ieee1275.rmk +1 -1
@@ -22,7 +22,7 @@ kern/time.c \ kern/generic/millisleep.c \ kern/ieee1275/ieee1275.c \ - term/ieee1275/ofconsole.c term/i386/pc/at_keyboard.c \ + term/ieee1275/ofconsole.c \ disk/ieee1275/ofdisk.c \ symlist.c kernel_elf_HEADERS = arg.h cache.h device.h disk.h dl.h elf.h elfload.h \
ieee1275/init.c +0 -1
@@ -217,7 +217,6 @@grub_console_init ();#ifdef __i386__grub_get_extended_memory (); -grub_keyboard_controller_init ();#endif grub_claim_heap ();grub_ofdisk_init ();
term.c +91 -40
258 lines not on this page · raw message
i386/coreboot/init.c +1 -0
@@ -138,6 +138,7 @@ grub_upper_mem -=GRUB_MEMORY_MACHINE_UPPER_START ;grub_tsc_init (); +grub_at_keyboard_init (); }void
misc.c +5 -2
@@ -1026,9 +1026,12 @@void grub_abort (void ) { -if (grub_term_get_current ()) +if (grub_term_get_current_output ()) +grub_printf ("\nAborted." ); + +if (grub_term_get_current_input ()) { -grub_printf ("\nAborted. Press any key to exit." ); +grub_printf (" Press any key to exit." );grub_getkey (); }
grub/term.h +35 -14
76 lines not on this page · raw message
grub/i386/ieee1275/console.h +0 -4
@@ -21,10 +21,6 @@#include <grub/symbol.h> -void EXPORT_FUNC (grub_keyboard_controller_init ) (void ); -int EXPORT_FUNC (grub_console_checkkey ) (void ); -int EXPORT_FUNC (grub_console_getkey ) (void ); -/* Initialize the console system. */ void grub_console_init (void );
grub/i386/pc/console.h +2 -2
@@ -40,8 +40,8 @@/* These are global to share code between C and asm. */ extern grub_uint8_t grub_console_cur_color;void grub_console_real_putchar (int c); -int EXPORT_FUNC (grub_console_checkkey ) (void ); -int EXPORT_FUNC (grub_console_getkey ) (void ); +int grub_console_checkkey (void ); +int grub_console_getkey (void );grub_uint16_t grub_console_getxy (void );void grub_console_gotoxy (grub_uint8_t x,grub_uint8_t y);void grub_console_cls (void );
grub/i386/coreboot/console.h +0 -24
@@ -1,25 +1 @@ -/* -* GRUB -- GRand Unified Bootloader -* Copyright (C) 2008 Free Software Foundation, Inc. -* -* GRUB is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* GRUB is distributed in the hope that it will be useful, -* 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 -* along with GRUB. If not, see <http://www.gnu.org/licenses/>. -*/ - -#ifndef _GRUB_CONSOLE_MACHINE_LB_HEADER -#define _GRUB_CONSOLE_MACHINE_LB_HEADER 1#include <grub/i386/pc/console.h> - -void grub_keyboard_controller_init (void ); - -#endif /* ! _GRUB_CONSOLE_MACHINE_LB_HEADER */
terminal.c +63 -15
114 lines not on this page · raw message
efi/console.c +14 -9
@@ -332,15 +332,18 @@efi_call_2 (o->enable_cursor, o, on); } -static struct grub_term grub_console_term = +static struct grub_term_input grub_console_term_input = { .name ="console" , - .init =0 , - .fini =0 , + .checkkey = grub_console_checkkey, + .getkey = grub_console_getkey, + }; + +static struct grub_term_output grub_console_term_output = + { + .name ="console" , .putchar = grub_console_putchar, .getcharwidth = grub_console_getcharwidth, - .checkkey = grub_console_checkkey, - .getkey = grub_console_getkey, .getwh = grub_console_getwh, .getxy = grub_console_getxy, .gotoxy = grub_console_gotoxy,
@@ -350,7 +353,6 @@ .getcolor = grub_console_getcolor, .setcursor = grub_console_setcursor, .flags = 0, - .next = 0 };void
@@ -364,12 +366,15 @@return ; } -grub_term_register (&grub_console_term); -grub_term_set_current (&grub_console_term); +grub_term_register_input (&grub_console_term_input); +grub_term_register_output (&grub_console_term_output); +grub_term_set_current_output (&grub_console_term_output); +grub_term_set_current_input (&grub_console_term_input); }void grub_console_fini (void ) { -grub_term_unregister (&grub_console_term); +grub_term_unregister_input (&grub_console_term_input); +grub_term_unregister_output (&grub_console_term_output); }
ieee1275/ofconsole.c +31 -22
106 lines not on this page · raw message
i386/pc/serial.c +16 -9
@@ -467,15 +467,18 @@grub_terminfo_cursor_off (); } -static struct grub_term grub_serial_term = +static struct grub_term_input grub_serial_term_input = { .name ="serial" , - .init =0 , - .fini =0 , + .checkkey = grub_serial_checkkey, + .getkey = grub_serial_getkey, +}; + +static struct grub_term_output grub_serial_term_output = +{ + .name ="serial" , .putchar = grub_serial_putchar, .getcharwidth = grub_serial_getcharwidth, - .checkkey = grub_serial_checkkey, - .getkey = grub_serial_getkey, .getwh = grub_serial_getwh, .getxy = grub_serial_getxy, .gotoxy = grub_serial_gotoxy,
@@ -483,7 +486,6 @@ .setcolorstate = grub_serial_setcolorstate, .setcursor = grub_serial_setcursor, .flags = 0, - .next = 0 };
@@ -575,7 +577,8 @@/* Register terminal if not yet registered. */ if (registered ==0 ) { -grub_term_register (&grub_serial_term); +grub_term_register_input (&grub_serial_term_input); +grub_term_register_output (&grub_serial_term_output); registered =1 ; } }
@@ -590,7 +593,8 @@if (serial_hw_init () !=GRUB_ERR_NONE ) {/* If unable to restore settings, unregister terminal. */ -grub_term_unregister (&grub_serial_term); +grub_term_unregister_input (&grub_serial_term_input); +grub_term_unregister_output (&grub_serial_term_output); registered =0 ; } }
@@ -616,5 +620,8 @@ {grub_unregister_command ("serial" );if (registered ==1 )/* Unregister terminal only if registered. */ -grub_term_unregister (&grub_serial_term); + { +grub_term_unregister_input (&grub_serial_term_input); +grub_term_unregister_output (&grub_serial_term_output); + } }
i386/pc/console.c +23 -13
@@ -125,15 +125,22 @@ *highlight_color = grub_console_highlight_color; } -static struct grub_term grub_console_term = +/* On non-BIOS platforms, console.c is used in combination with vga_text.c +(only to handle output). */ +#ifdef GRUB_MACHINE_PCBIOS +static struct grub_term_input grub_console_term_input = { .name ="console" , - .init =0 , - .fini =0 , + .checkkey = grub_console_checkkey, + .getkey = grub_console_getkey, + }; +#endif + +static struct grub_term_output grub_console_term_output = + { + .name ="console" , .putchar = grub_console_putchar, .getcharwidth = grub_console_getcharwidth, - .checkkey = grub_console_checkkey, - .getkey = grub_console_getkey, .getwh = grub_console_getwh, .getxy = grub_console_getxy, .gotoxy = grub_console_gotoxy,
@@ -143,23 +150,26 @@ .getcolor = grub_console_getcolor, .setcursor = grub_console_setcursor, .flags = 0, - .next = 0 };void grub_console_init (void ) { -grub_term_register (&grub_console_term); -grub_term_set_current (&grub_console_term); - -#ifdef GRUB_MACHINE_LINUXBIOS -grub_keyboard_controller_init (); +grub_term_register_output (&grub_console_term_output); +grub_term_set_current_output (&grub_console_term_output); +#ifdef GRUB_MACHINE_PCBIOS +grub_term_register_input (&grub_console_term_input); +grub_term_set_current_input (&grub_console_term_input);#endif }void grub_console_fini (void ) { -grub_term_set_current (&grub_console_term); -grub_term_unregister (&grub_console_term); +grub_term_set_current_output (&grub_console_term_output); +#ifdef GRUB_MACHINE_PCBIOS +grub_term_set_current_input (&grub_console_term_input); +grub_term_unregister_input (&grub_console_term_input); +#endif +grub_term_unregister_output (&grub_console_term_output); }
i386/pc/at_keyboard.c +45 -14
93 lines not on this page · raw message
i386/pc/vga.c +3 -6
@@ -473,15 +473,13 @@ } } -static struct grub_term grub_vga_term = +static struct grub_term_output grub_vga_term = { .name ="vga" , .init = grub_vga_mod_init, .fini = grub_vga_mod_fini, .putchar = grub_vga_putchar, .getcharwidth = grub_vga_getcharwidth, - .checkkey = grub_console_checkkey, - .getkey = grub_console_getkey, .getwh = grub_vga_getwh, .getxy = grub_vga_getxy, .gotoxy = grub_vga_gotoxy,
@@ -489,7 +487,6 @@ .setcolorstate = grub_vga_setcolorstate, .setcursor = grub_vga_setcursor, .flags = 0, - .next = 0 };GRUB_MOD_INIT (vga)
@@ -497,10 +494,10 @@#ifndef GRUB_UTIL my_mod = mod;#endif -grub_term_register (&grub_vga_term); +grub_term_register_output (&grub_vga_term); }GRUB_MOD_FINI (vga) { -grub_term_unregister (&grub_vga_term); +grub_term_unregister_output (&grub_vga_term); }
gfxterm.c +3 -5
@@ -1056,15 +1056,13 @@return grub_errno; } -static struct grub_term grub_video_term = +static struct grub_term_output grub_video_term = { .name ="gfxterm" , .init = grub_gfxterm_init, .fini = grub_gfxterm_fini, .putchar = grub_gfxterm_putchar, .getcharwidth = grub_gfxterm_getcharwidth, - .checkkey = grub_console_checkkey, - .getkey = grub_console_getkey, .getwh = grub_virtual_screen_getwh, .getxy = grub_virtual_screen_getxy, .gotoxy = grub_gfxterm_gotoxy,
@@ -1081,7 +1079,7 @@GRUB_MOD_INIT (term_gfxterm) { my_mod = mod; -grub_term_register (&grub_video_term); +grub_term_register_output (&grub_video_term); grub_register_command ("background_image", grub_gfxterm_background_image_cmd,
@@ -1094,5 +1092,5 @@GRUB_MOD_FINI (term_gfxterm) {grub_unregister_command ("bgimage" ); -grub_term_unregister (&grub_video_term); +grub_term_unregister_output (&grub_video_term); }
grub.d/00_header.in +27 -16
61 lines not on this page · raw message
console.c +2 -1
@@ -371,7 +371,8 @@grub_console_init (void) {grub_term_register (&grub_ncurses_term); -grub_term_set_current (&grub_ncurses_term); +grub_term_set_current_input (&grub_ncurses_term); +grub_term_set_current_output (&grub_ncurses_term); }void
grub-probe.c +8 -2
@@ -66,12 +66,18 @@return -1 ; } -grub_term_t -grub_term_get_current (void ) +grub_term_input_t +grub_term_get_current_input (void ) {return 0 ; } +grub_term_output_t +grub_term_get_current_output (void ) +{ +return 0 ; +} +void grub_refresh (void ) {
grub-fstest.c +7 -1
@@ -54,11 +54,17 @@ }grub_term_t -grub_term_get_current (void ) +grub_term_get_current_input (void ) {return 0 ; } +grub_term_t +grub_term_get_current_output (void ) +{ +return 0 ; +} +void grub_refresh (void ) {
i386/pc/grub-setup.c +8 -2
@@ -74,12 +74,18 @@return -1 ; } -grub_term_t -grub_term_get_current (void ) +grub_term_input_t +grub_term_get_current_input (void ) {return 0 ; } +grub_term_output_t +grub_term_get_current_output (void ) +{ +return 0 ; +} +void grub_refresh (void ) {
grub-mkconfig.in +13 -7
@@ -130,31 +130,37 @@ . ${sysconfdir}/default/grub fi -case x${GRUB_TERMINAL} in +# XXX: should this be deprecated at some point? +if [ "x${GRUB_TERMINAL}" != "x" ] ; then + GRUB_TERMINAL_INPUT="${GRUB_TERMINAL}" + GRUB_TERMINAL_OUTPUT="${GRUB_TERMINAL}" +fi + +case x${GRUB_TERMINAL_OUTPUT} in x) # If this platform supports gfxterm, try to use it. if test -e ${grub_prefix}/gfxterm.mod ; then - GRUB_TERMINAL=gfxterm + GRUB_TERMINAL_OUTPUT=gfxterm fi ;; xconsole | xserial | xofconsole | xgfxterm) ;; - *) echo "Invalid terminal \"${GRUB_TERMINAL}\"" >&2 ; exit 1 ;; + *) echo "Invalid output terminal \"${GRUB_TERMINAL_OUTPUT}\"" >&2 ; exit 1 ;; esac # check for terminals that require fonts -case ${GRUB_TERMINAL} in +case ${GRUB_TERMINAL_OUTPUT} in gfxterm) if path=`font_path` ; then GRUB_FONT_PATH="${path}" else # fallback to the native terminal for this platform - unset GRUB_TERMINAL + unset GRUB_TERMINAL_OUTPUT fi ;; esac # does our terminal support utf-8 ? -case ${GRUB_TERMINAL} in +case ${GRUB_TERMINAL_OUTPUT} in gfxterm) ;; *) # make sure all our children behave in conformance with ascii..
@@ -167,7 +173,7 @@ export GRUB_DEVICE GRUB_DEVICE_UUID GRUB_DEVICE_BOOT GRUB_DEVICE_BOOT_UUID GRUB_FS GRUB_FONT_PATH GRUB_PRELOAD_MODULES # These are optional, user-defined variables. -export GRUB_DEFAULT GRUB_TIMEOUT GRUB_DISTRIBUTOR GRUB_CMDLINE_LINUX GRUB_CMDLINE_LINUX_DEFAULT GRUB_TERMINAL GRUB_SERIAL_COMMAND GRUB_DISABLE_LINUX_UUID GRUB_GFXMODE +export GRUB_DEFAULT GRUB_TIMEOUT GRUB_DISTRIBUTOR GRUB_CMDLINE_LINUX GRUB_CMDLINE_LINUX_DEFAULT GRUB_TERMINAL_OUTPUT GRUB_SERIAL_COMMAND GRUB_DISABLE_LINUX_UUID GRUB_GFXMODE if test "x${grub_cfg}" != "x"; then rm -f ${grub_cfg}.new
grub-editenv.c +7 -1
@@ -41,11 +41,17 @@ }void * -grub_term_get_current (void ) +grub_term_get_current_input (void ) {return 0 ; } +void * +grub_term_get_current_output (void ) +{ +return 0 ; +} +int grub_getkey (void ) {
Quoted 5 lines · On Sunday 02 November 2008 19:11:32 Robert Millan wrote:
Hi,
This patch splits terminal handling in input and output. While at it, it resolves/removes some of the kludges we had to work around this limitation.
Quoted 7 lines
For example, gfxterm/vga no longer need to assume the input is bios console,
at_keyboardcan be used in combination with any output terminal, etc.It will also be possible to turn
vga_text.cinto a standalone output term, but this needs more work since it is currently sharing much code with the bios console inconsole.c.
No ChangeLog?
The idea is good. I agree with your patch, basically. I can review it more seriously, once you write up ChangeLog entries.
BTW, I would like to obtain the capability of handling pipes, so that we can, say, "help | more". I guess you have the same idea in your mind. This should be trivial, once the input and output are separate, right?
Regards,
Okuji
Quoted 2 lines · Yoshinori K. Okuji
No ChangeLog?
Here. I ommitted it because I wanted to see if it would need big adjustments first.
Quoted 2 lines
BTW, I would like to obtain the capability of handling pipes, so that we can, say, "help | more". I guess you have the same idea in your mind.
Actually, I didn't think about this possibility. My goal was to simplify things on the backend side, so many of the quirks we have can be removed (some examples in my previous mail), and we can integrate USB keyboard support cleanly.
Quoted 2 lines
This should
be trivial, once the input and output are separate, right?
Well, I suppose one could write a "pipe" output terminal that stores output in a buffer, and then a "pipe" input terminal that reads from it. My code probably makes pipes easier, but I don't know how much is left (I assume you don't want real pipes since that implies multi-threading).
Signature · 5 lines
Robert Millan The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."
2008-11-04 Robert Millan <[email protected]>
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).
i386.rmk +5 -2
@@ -1,8 +1,11 @@ # -*- makefile -*- pkglib_MODULES += cpuid.mod - -# For cpuid.mod. cpuid_mod_SOURCES = commands/i386/cpuid.c cpuid_mod_CFLAGS = $(COMMON_CFLAGS) cpuid_mod_LDFLAGS = $(COMMON_LDFLAGS) + +pkglib_MODULES += at_keyboard.mod +at_keyboard_mod_SOURCES = term/i386/pc/at_keyboard.c +at_keyboard_mod_CFLAGS = $(COMMON_CFLAGS) +at_keyboard_mod_LDFLAGS = $(COMMON_LDFLAGS)
i386-ieee1275.rmk +1 -1
@@ -22,7 +22,7 @@ kernel_elf_SOURCES = kern/i386/ieee1275/ kern/time.c \ kern/generic/millisleep.c \ kern/ieee1275/ieee1275.c \ - term/ieee1275/ofconsole.c term/i386/pc/at_keyboard.c \ + term/ieee1275/ofconsole.c \ disk/ieee1275/ofdisk.c \ symlist.c kernel_elf_HEADERS = arg.h cache.h device.h disk.h dl.h elf.h elfload.h \
ieee1275/init.c +0 -1
@@ -217,7 +217,6 @@ grub_machine_init (void)grub_console_init ();#ifdef __i386__grub_get_extended_memory (); -grub_keyboard_controller_init ();#endif grub_claim_heap ();grub_ofdisk_init ();
term.c +91 -40
256 lines not on this page · raw message
i386/coreboot/init.c +1 -0
@@ -138,6 +138,7 @@ grub_machine_init (void) grub_upper_mem -=GRUB_MEMORY_MACHINE_UPPER_START ;grub_tsc_init (); +grub_at_keyboard_init (); }void
misc.c +8 -3
@@ -1026,10 +1026,15 @@ grub_utf8_to_ucs4 (grub_uint32_t *dest,void grub_abort (void ) { -if (grub_term_get_current ()) +if (grub_term_get_current_output ()) { -grub_printf ("\nAborted. Press any key to exit." ); -grub_getkey (); +grub_printf ("\nAborted." ); + +if (grub_term_get_current_input ()) + { +grub_printf (" Press any key to exit." ); +grub_getkey (); + } }grub_exit ();
grub/term.h +36 -15
71 lines not on this page · raw message
grub/i386/ieee1275/console.h +0 -4
@@ -21,10 +21,6 @@#include <grub/symbol.h> -void EXPORT_FUNC (grub_keyboard_controller_init ) (void ); -int EXPORT_FUNC (grub_console_checkkey ) (void ); -int EXPORT_FUNC (grub_console_getkey ) (void ); -/* Initialize the console system. */ void grub_console_init (void );
grub/i386/pc/console.h +2 -2
@@ -40,8 +40,8 @@/* These are global to share code between C and asm. */ extern grub_uint8_t grub_console_cur_color;void grub_console_real_putchar (int c); -int EXPORT_FUNC (grub_console_checkkey ) (void ); -int EXPORT_FUNC (grub_console_getkey ) (void ); +int grub_console_checkkey (void ); +int grub_console_getkey (void );grub_uint16_t grub_console_getxy (void );void grub_console_gotoxy (grub_uint8_t x,grub_uint8_t y);void grub_console_cls (void );
grub/i386/coreboot/console.h +0 -24
@@ -1,25 +1 @@ -/* -* GRUB -- GRand Unified Bootloader -* Copyright (C) 2008 Free Software Foundation, Inc. -* -* GRUB is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* GRUB is distributed in the hope that it will be useful, -* 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 -* along with GRUB. If not, see <http://www.gnu.org/licenses/>. -*/ - -#ifndef _GRUB_CONSOLE_MACHINE_LB_HEADER -#define _GRUB_CONSOLE_MACHINE_LB_HEADER 1#include <grub/i386/pc/console.h> - -void grub_keyboard_controller_init (void ); - -#endif /* ! _GRUB_CONSOLE_MACHINE_LB_HEADER */
terminal.c +63 -15
111 lines not on this page · raw message
efi/console.c +14 -9
@@ -332,15 +332,18 @@ grub_console_setcursor (int on)efi_call_2 (o->enable_cursor, o, on); } -static struct grub_term grub_console_term = +static struct grub_term_input grub_console_term_input = { .name ="console" , - .init =0 , - .fini =0 , - .putchar = grub_console_putchar, - .getcharwidth = grub_console_getcharwidth, .checkkey = grub_console_checkkey, .getkey = grub_console_getkey, + }; + +static struct grub_term_output grub_console_term_output = + { + .name ="console" , + .putchar = grub_console_putchar, + .getcharwidth = grub_console_getcharwidth, .getwh = grub_console_getwh, .getxy = grub_console_getxy, .gotoxy = grub_console_gotoxy,
@@ -350,7 +353,6 @@ static struct grub_term grub_console_ter .getcolor = grub_console_getcolor, .setcursor = grub_console_setcursor, .flags = 0, - .next = 0 };void
@@ -364,12 +366,15 @@ grub_console_init (void)return ; } -grub_term_register (&grub_console_term); -grub_term_set_current (&grub_console_term); +grub_term_register_input (&grub_console_term_input); +grub_term_register_output (&grub_console_term_output); +grub_term_set_current_output (&grub_console_term_output); +grub_term_set_current_input (&grub_console_term_input); }void grub_console_fini (void ) { -grub_term_unregister (&grub_console_term); +grub_term_unregister_input (&grub_console_term_input); +grub_term_unregister_output (&grub_console_term_output); }
ieee1275/ofconsole.c +31 -22
104 lines not on this page · raw message
i386/pc/serial.c +16 -9
@@ -467,15 +467,18 @@ grub_serial_setcursor (const int on)grub_terminfo_cursor_off (); } -static struct grub_term grub_serial_term = +static struct grub_term_input grub_serial_term_input = { .name ="serial" , - .init =0 , - .fini =0 , - .putchar = grub_serial_putchar, - .getcharwidth = grub_serial_getcharwidth, .checkkey = grub_serial_checkkey, .getkey = grub_serial_getkey, +}; + +static struct grub_term_output grub_serial_term_output = +{ + .name ="serial" , + .putchar = grub_serial_putchar, + .getcharwidth = grub_serial_getcharwidth, .getwh = grub_serial_getwh, .getxy = grub_serial_getxy, .gotoxy = grub_serial_gotoxy,
@@ -483,7 +486,6 @@ static struct grub_term grub_serial_term .setcolorstate = grub_serial_setcolorstate, .setcursor = grub_serial_setcursor, .flags = 0, - .next = 0 };
@@ -575,7 +577,8 @@ grub_cmd_serial (struct grub_arg_list *s/* Register terminal if not yet registered. */ if (registered ==0 ) { -grub_term_register (&grub_serial_term); +grub_term_register_input (&grub_serial_term_input); +grub_term_register_output (&grub_serial_term_output); registered =1 ; } }
@@ -590,7 +593,8 @@ grub_cmd_serial (struct grub_arg_list *sif (serial_hw_init () !=GRUB_ERR_NONE ) {/* If unable to restore settings, unregister terminal. */ -grub_term_unregister (&grub_serial_term); +grub_term_unregister_input (&grub_serial_term_input); +grub_term_unregister_output (&grub_serial_term_output); registered =0 ; } }
@@ -616,5 +620,8 @@ GRUB_MOD_FINI(serial) {grub_unregister_command ("serial" );if (registered ==1 )/* Unregister terminal only if registered. */ -grub_term_unregister (&grub_serial_term); + { +grub_term_unregister_input (&grub_serial_term_input); +grub_term_unregister_output (&grub_serial_term_output); + } }
i386/pc/console.c +23 -13
@@ -125,15 +125,22 @@ grub_console_getcolor (grub_uint8_t *nor *highlight_color = grub_console_highlight_color; } -static struct grub_term grub_console_term = +/* On non-BIOS platforms, console.c is used in combination with vga_text.c +(only to handle output). */ +#ifdef GRUB_MACHINE_PCBIOS +static struct grub_term_input grub_console_term_input = { .name ="console" , - .init =0 , - .fini =0 , - .putchar = grub_console_putchar, - .getcharwidth = grub_console_getcharwidth, .checkkey = grub_console_checkkey, .getkey = grub_console_getkey, + }; +#endif + +static struct grub_term_output grub_console_term_output = + { + .name ="console" , + .putchar = grub_console_putchar, + .getcharwidth = grub_console_getcharwidth, .getwh = grub_console_getwh, .getxy = grub_console_getxy, .gotoxy = grub_console_gotoxy,
@@ -143,23 +150,26 @@ static struct grub_term grub_console_ter .getcolor = grub_console_getcolor, .setcursor = grub_console_setcursor, .flags = 0, - .next = 0 };void grub_console_init (void ) { -grub_term_register (&grub_console_term); -grub_term_set_current (&grub_console_term); - -#ifdef GRUB_MACHINE_LINUXBIOS -grub_keyboard_controller_init (); +grub_term_register_output (&grub_console_term_output); +grub_term_set_current_output (&grub_console_term_output); +#ifdef GRUB_MACHINE_PCBIOS +grub_term_register_input (&grub_console_term_input); +grub_term_set_current_input (&grub_console_term_input);#endif }void grub_console_fini (void ) { -grub_term_set_current (&grub_console_term); -grub_term_unregister (&grub_console_term); +grub_term_set_current_output (&grub_console_term_output); +#ifdef GRUB_MACHINE_PCBIOS +grub_term_set_current_input (&grub_console_term_input); +grub_term_unregister_input (&grub_console_term_input); +#endif +grub_term_unregister_output (&grub_console_term_output); }
i386/pc/at_keyboard.c +45 -14
93 lines not on this page · raw message
i386/pc/vga.c +3 -6
@@ -473,15 +473,13 @@ grub_vga_setcursor (int on) } } -static struct grub_term grub_vga_term = +static struct grub_term_output grub_vga_term = { .name ="vga" , .init = grub_vga_mod_init, .fini = grub_vga_mod_fini, .putchar = grub_vga_putchar, .getcharwidth = grub_vga_getcharwidth, - .checkkey = grub_console_checkkey, - .getkey = grub_console_getkey, .getwh = grub_vga_getwh, .getxy = grub_vga_getxy, .gotoxy = grub_vga_gotoxy,
@@ -489,7 +487,6 @@ static struct grub_term grub_vga_term = .setcolorstate = grub_vga_setcolorstate, .setcursor = grub_vga_setcursor, .flags = 0, - .next = 0 };GRUB_MOD_INIT (vga)
@@ -497,10 +494,10 @@ GRUB_MOD_INIT(vga)#ifndef GRUB_UTIL my_mod = mod;#endif -grub_term_register (&grub_vga_term); +grub_term_register_output (&grub_vga_term); }GRUB_MOD_FINI (vga) { -grub_term_unregister (&grub_vga_term); +grub_term_unregister_output (&grub_vga_term); }
gfxterm.c +3 -5
@@ -1056,15 +1056,13 @@ grub_gfxterm_background_image_cmd (strucreturn grub_errno; } -static struct grub_term grub_video_term = +static struct grub_term_output grub_video_term = { .name ="gfxterm" , .init = grub_gfxterm_init, .fini = grub_gfxterm_fini, .putchar = grub_gfxterm_putchar, .getcharwidth = grub_gfxterm_getcharwidth, - .checkkey = grub_console_checkkey, - .getkey = grub_console_getkey, .getwh = grub_virtual_screen_getwh, .getxy = grub_virtual_screen_getxy, .gotoxy = grub_gfxterm_gotoxy,
@@ -1081,7 +1079,7 @@ static struct grub_term grub_video_termGRUB_MOD_INIT (term_gfxterm) { my_mod = mod; -grub_term_register (&grub_video_term); +grub_term_register_output (&grub_video_term); grub_register_command ("background_image", grub_gfxterm_background_image_cmd,
@@ -1094,5 +1092,5 @@ GRUB_MOD_INIT(term_gfxterm)GRUB_MOD_FINI (term_gfxterm) {grub_unregister_command ("bgimage" ); -grub_term_unregister (&grub_video_term); +grub_term_unregister_output (&grub_video_term); }
grub.d/00_header.in +27 -16
61 lines not on this page · raw message
console.c +2 -1
@@ -371,7 +371,8 @@ voidgrub_console_init (void) {grub_term_register (&grub_ncurses_term); -grub_term_set_current (&grub_ncurses_term); +grub_term_set_current_input (&grub_ncurses_term); +grub_term_set_current_output (&grub_ncurses_term); }void
grub-probe.c +8 -2
@@ -66,8 +66,14 @@ grub_getkey (void)return -1 ; } -grub_term_t -grub_term_get_current (void ) +grub_term_input_t +grub_term_get_current_input (void ) +{ +return 0 ; +} + +grub_term_output_t +grub_term_get_current_output (void ) {return 0 ; }
grub-fstest.c +7 -1
@@ -54,7 +54,13 @@ grub_getkey (void) }grub_term_t -grub_term_get_current (void ) +grub_term_get_current_input (void ) +{ +return 0 ; +} + +grub_term_t +grub_term_get_current_output (void ) {return 0 ; }
i386/pc/grub-setup.c +8 -2
@@ -74,8 +74,14 @@ grub_getkey (void)return -1 ; } -grub_term_t -grub_term_get_current (void ) +grub_term_input_t +grub_term_get_current_input (void ) +{ +return 0 ; +} + +grub_term_output_t +grub_term_get_current_output (void ) {return 0 ; }
grub-mkconfig.in +13 -7
@@ -130,31 +130,37 @@ if test -f ${sysconfdir}/default/grub ; . ${sysconfdir}/default/grub fi -case x${GRUB_TERMINAL} in +# XXX: should this be deprecated at some point? +if [ "x${GRUB_TERMINAL}" != "x" ] ; then + GRUB_TERMINAL_INPUT="${GRUB_TERMINAL}" + GRUB_TERMINAL_OUTPUT="${GRUB_TERMINAL}" +fi + +case x${GRUB_TERMINAL_OUTPUT} in x) # If this platform supports gfxterm, try to use it. if test -e ${grub_prefix}/gfxterm.mod ; then - GRUB_TERMINAL=gfxterm + GRUB_TERMINAL_OUTPUT=gfxterm fi ;; xconsole | xserial | xofconsole | xgfxterm) ;; - *) echo "Invalid terminal \"${GRUB_TERMINAL}\"" >&2 ; exit 1 ;; + *) echo "Invalid output terminal \"${GRUB_TERMINAL_OUTPUT}\"" >&2 ; exit 1 ;; esac # check for terminals that require fonts -case ${GRUB_TERMINAL} in +case ${GRUB_TERMINAL_OUTPUT} in gfxterm) if path=`font_path` ; then GRUB_FONT_PATH="${path}" else # fallback to the native terminal for this platform - unset GRUB_TERMINAL + unset GRUB_TERMINAL_OUTPUT fi ;; esac # does our terminal support utf-8 ? -case ${GRUB_TERMINAL} in +case ${GRUB_TERMINAL_OUTPUT} in gfxterm) ;; *) # make sure all our children behave in conformance with ascii..
@@ -167,7 +173,7 @@ esac export GRUB_DEVICE GRUB_DEVICE_UUID GRUB_DEVICE_BOOT GRUB_DEVICE_BOOT_UUID GRUB_FS GRUB_FONT_PATH GRUB_PRELOAD_MODULES # These are optional, user-defined variables. -export GRUB_DEFAULT GRUB_TIMEOUT GRUB_DISTRIBUTOR GRUB_CMDLINE_LINUX GRUB_CMDLINE_LINUX_DEFAULT GRUB_TERMINAL GRUB_SERIAL_COMMAND GRUB_DISABLE_LINUX_UUID GRUB_GFXMODE +export GRUB_DEFAULT GRUB_TIMEOUT GRUB_DISTRIBUTOR GRUB_CMDLINE_LINUX GRUB_CMDLINE_LINUX_DEFAULT GRUB_TERMINAL_OUTPUT GRUB_SERIAL_COMMAND GRUB_DISABLE_LINUX_UUID GRUB_GFXMODE if test "x${grub_cfg}" != "x"; then rm -f ${grub_cfg}.new
grub-editenv.c +7 -1
@@ -41,7 +41,13 @@ grub_refresh (void) }void * -grub_term_get_current (void ) +grub_term_get_current_input (void ) +{ +return 0 ; +} + +void * +grub_term_get_current_output (void ) {return 0 ; }
Quoted 5 lines · On Tuesday 04 November 2008 18:14:17 Robert Millan wrote:
Quoted 1 line · Yoshinori K. Okuji
No ChangeLog?
Here. I ommitted it because I wanted to see if it would need big adjustments first.
OK. The patch looks perfect for me.
Quoted 8 lines
Quoted 2 lines
BTW, I would like to obtain the capability of handling pipes, so that we can, say, "help | more". I guess you have the same idea in your mind.
Actually, I didn't think about this possibility. My goal was to simplify things on the backend side, so many of the quirks we have can be removed (some examples in my previous mail), and we can integrate USB keyboard support cleanly.
Quoted 7 lines
Quoted 2 lines
This should
be trivial, once the input and output are separate, right?Well, I suppose one could write a "pipe" output terminal that stores output in a buffer, and then a "pipe" input terminal that reads from it. My code probably makes pipes easier, but I don't know how much is left (I assume you don't want real pipes since that implies multi-threading).
Surely, I don't want multi-processing or multi-threading in GRUB. This is overkill. A pipe should be implemented in the same way as in DOS.
Regards,
Okuji
Quoted 8 lines · Yoshinori K. Okuji
Quoted 5 lines · On Tuesday 04 November 2008 18:14:17 Robert Millan wrote:
Quoted 1 line · Yoshinori K. Okuji
No ChangeLog?
Here. I ommitted it because I wanted to see if it would need big adjustments first.
OK. The patch looks perfect for me.
Ok, I just committed it.
Signature · 5 lines
Robert Millan The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."
Quoted 3 lines · Yoshinori K. Okuji
BTW, I would like to obtain the capability of handling pipes, so that we can, say, "help | more". I guess you have the same idea in your mind. This should be trivial, once the input and output are separate, right?
I think this would need separated streams design in order to be functional. Not a bad idea as such.... I am wondering the gain however. What kind of implementation plan did you have for piping in example more?
Quoted 8 lines · On Tuesday 04 November 2008 19:31:09 Vesa Jääskeläinen wrote:
Quoted 3 lines · Yoshinori K. Okuji
BTW, I would like to obtain the capability of handling pipes, so that we can, say, "help | more". I guess you have the same idea in your mind. This should be trivial, once the input and output are separate, right?
I think this would need separated streams design in order to be functional. Not a bad idea as such.... I am wondering the gain however. What kind of implementation plan did you have for piping in example more?
In "if" conditions, pipes can be sometimes very useful. For example:
if ls | grep eth; then
# if any ethernet device is present, change the strategy...
set fallback="1 2"
fiAlso, a similar technique can be used to implement "getting an output as a string". For example:
# Use the same password as the super user.
set password=$(sed -ne '/^root:/{s/root:\([^:]*\).*/\1/;p}' /etc/shadow)Regards,
Okuji
Quoted 6 lines · Yoshinori K. Okuji
Also, a similar technique can be used to implement "getting an output as a string". For example:
# Use the same password as the super user. set password=$(sed -ne '/^root:/{s/root:\([^:]*\).*/\1/;p}' /etc/shadow)
This would work much better in grub-mkconfig. You don't want to implement (or port) sed do you? ;-)
Signature · 5 lines
Robert Millan The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."
Quoted 10 lines · On Friday 07 November 2008 20:07:07 Robert Millan wrote:
Quoted 6 lines · Yoshinori K. Okuji
Also, a similar technique can be used to implement "getting an output as a string". For example:
# Use the same password as the super user.
set password=$(sed -ne '/^root:/{s/root:\([^:]*\).*/\1/;p}'/etc/shadow)This would work much better in grub-mkconfig. You don't want to implement (or port) sed do you? ;-)
I don't want to duplicate information when they should be indentical. Synchronization is a nightmare. sed is just an example. You can use 'cut' in this case as well.
Regards,
Okuji
Quoted 11 lines · Robert Millan
Hi,
This patch splits terminal handling in input and output. While at it, it resolves/removes some of the kludges we had to work around this limitation.
For example, gfxterm/vga no longer need to assume the input is bios console,
at_keyboardcan be used in combination with any output terminal, etc.It will also be possible to turn
vga_text.cinto a standalone output term, but this needs more work since it is currently sharing much code with the bios console inconsole.c.
I think multipath would be nice feature. Eg. you can have serial/other remote connected and then have local terminal at same time.
This would allow remote maintenance for server and then if user is locally there he can operate machine too.
For this there would need to be a way to say send output to these terminals and gather input from these terminals.
Quoted 3 lines · Vesa Jääskeläinen
I think multipath would be nice feature. Eg. you can have serial/other remote connected and then have local terminal at same time.
In fact we need that if we ever want to support reading from AT keyboards and USB keyboards at the same time (we don't know which one is there, so whenever using hardware access for one of them, we need to try both).
I was thinking that after terminal split is merged, we could either:
- Turn the grub_cur_term_{input,output} pointers into lists, so that multiple terminals can be "current" at the same time.
- Implement a "magic" input (or output) terminal that can be attached to other terminals and reads from (or writes to) more than one of them. The advantage of this is that the code doesn't have to be in kernel.
But I suppose we agree that the change I'm currently proposing is in the right direction?
Signature · 5 lines
Robert Millan The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."
Quoted 10 lines · On Tue, 4 Nov 2008 20:12:56 +0100 Robert Millan <[email protected]> wrote:
Quoted 4 lines · Vesa Jääskeläinen
I think multipath would be nice feature. Eg. you can have serial/other remote connected and then have local terminal at same time.
In fact we need that if we ever want to support reading from AT keyboards and USB keyboards at the same time (we don't know which one is there, so whenever using hardware access for one of them, we need to try both).
Good point. Don't forget that machines may have multiple USB keyboards attached, as well. I have used multi-keyboard, multi-mouse machines before in a pair programming environment. (This does not necessarily promote good pair programming practices, however.)
Regards,
Colin
[RFC] Multi-terminal support (Re: [PATCH] terminal split)
In reply to Robert MillanQuoted 7 lines · Robert Millan
- Turn the grub_cur_term_{input,output} pointers into lists, so that multiple terminals can be "current" at the same time.
- Implement a "magic" input (or output) terminal that can be attached to other terminals and reads from (or writes to) more than one of them. The advantage of this is that the code doesn't have to be in kernel.
Or a third option, which derives from the second one:
- Move the whole terminal selection code away from kernel, into a module (e.g. terminal.mod) that manages multiple terminals, and can possibly enable them simultaneously.
This basicaly would mean:
- There's always a "default" terminal that is built into kernel already. Before terminal.mod is loaded, the kernel would map generic terminal functions (grub_getkey(), etc) to this terminal (e.g. using a single grub_term_{input,output} couple of pointers).
- When loading terminal.mod, it hooks itself by replacing those two pointers, and implements the whole register / unregister / iterate enchilada.
- Some special casing would be needed so that the in-kernel terminals can be part of terminal.mod's scheme.
What I like in this option is that it moves complexity (and code) away from kernel without removing any functionality from it.
Signature · 5 lines
Robert Millan The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."
Re: [RFC] Multi-terminal support (Re: [PATCH] terminal split)
Quoted 8 lines · On Friday 07 November 2008 20:26:32 Robert Millan wrote:
Quoted 6 lines · Robert Millan
- Turn the grub_cur_term_{input,output} pointers into lists, so that multiple terminals can be "current" at the same time.
- Implement a "magic" input (or output) terminal that can be attached
to other terminals and reads from (or writes to) more than one of them. The advantage of this is that the code doesn't have to be in kernel.
Quoted 5 lines
Or a third option, which derives from the second one:
- Move the whole terminal selection code away from kernel, into a module (e.g. terminal.mod) that manages multiple terminals, and can possibly enable them simultaneously.
My feeling is that it is better to include all the functionality in the kernel itself, because the users of the terminal API would have to be aware of the presence of multiple terminals in some cases, anyway.
When you just print out a string, you can treat all kinds of terminals as dumb terminals, so it is very simple. No need to care about their differences.
However, whenever you want to do more than that, you must control each terminal differently. In particular, the menu code. The menu interface may not be uniform with all terminals. A terminal might have the size 80x25. Another might have 120x40. This is more complex with graphical terminals.
I like the idea that GRUB displays the user interface simultaneously. But this requires a lot of refactoring. Probably, the menu code will have to iterate all terminals explicitly, and make actions differently for each terminal, based on the capabilities. With the menu editor, how should the cursor be managed? We need to think a lot.
Regards,
Okuji
Re: [RFC] Multi-terminal support (Re: [PATCH] terminal split)
Quoted 5 lines · Yoshinori K. Okuji
However, whenever you want to do more than that, you must control each terminal differently. In particular, the menu code. The menu interface may not be uniform with all terminals. A terminal might have the size 80x25. Another might have 120x40. This is more complex with graphical terminals.
This problem does only happen with output terminals, right? My primary concern are input terminals, because if we want to support USB keyboards we need to probe from both USB and AT ones at the same time.
Quoted 5 lines
I like the idea that GRUB displays the user interface simultaneously. But this requires a lot of refactoring. Probably, the menu code will have to iterate all terminals explicitly, and make actions differently for each terminal, based on the capabilities. With the menu editor, how should the cursor be managed? We need to think a lot.
I've been thinking... what if we make this generic? I.e. with an event loop, then terminals can register their poll functions to it, and write their stuff to a shared resource the rest of GRUB can read from.
Signature · 5 lines
Robert Millan The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."
Re: [RFC] Multi-terminal support (Re: [PATCH] terminal split)
Quoted 10 lines · On Saturday 22 November 2008 20:54:57 Robert Millan wrote:
Quoted 5 lines · Yoshinori K. Okuji
However, whenever you want to do more than that, you must control each terminal differently. In particular, the menu code. The menu interface may not be uniform with all terminals. A terminal might have the size 80x25. Another might have 120x40. This is more complex with graphical terminals.
This problem does only happen with output terminals, right? My primary concern are input terminals, because if we want to support USB keyboards we need to probe from both USB and AT ones at the same time.
Yes.
Quoted 9 lines
Quoted 5 lines
I like the idea that GRUB displays the user interface simultaneously. But this requires a lot of refactoring. Probably, the menu code will have to iterate all terminals explicitly, and make actions differently for each terminal, based on the capabilities. With the menu editor, how should the cursor be managed? We need to think a lot.
I've been thinking... what if we make this generic? I.e. with an event loop, then terminals can register their poll functions to it, and write their stuff to a shared resource the rest of GRUB can read from.
For inputs, this is trivial for me. But, for outputs, not simple. For example, although we don't support yet in GRUB 2, if we have a dumb terminal, the menu interface must be very different from others.
Regards,
Okuji
Re: SPAM-LOW: Re: [RFC] Multi-terminal support (Re: [PATCH] terminal split)
* Yoshinori K. Okuji wrote, On 25/11/08 21:23:
Quoted 24 lines · On Saturday 22 November 2008 20:54:57 Robert Millan wrote:
Quoted 9 lines · Yoshinori K. Okuji
Quoted 7 lines
However, whenever you want to do more than that, you must control each terminal differently. In particular, the menu code. The menu interface may not be uniform with all terminals. A terminal might have the size 80x25. Another might have 120x40. This is more complex with graphical terminals.
Quoted 4 lines
This problem does only happen with output terminals, right? My primary concern are input terminals, because if we want to support USB keyboards we need to probe from both USB and AT ones at the same time.
Yes.
Quoted 6 lines
Quoted 6 lines
I like the idea that GRUB displays the user interface simultaneously. But this requires a lot of refactoring. Probably, the menu code will have to iterate all terminals explicitly, and make actions differently for each terminal, based on the capabilities. With the menu editor, how should the cursor be managed? We need to think a lot.
Quoted 9 lines
Quoted 4 lines
I've been thinking... what if we make this generic? I.e. with an event loop, then terminals can register their poll functions to it, and write their stuff to a shared resource the rest of GRUB can read from.
For inputs, this is trivial for me. But, for outputs, not simple. For example, although we don't support yet in GRUB 2, if we have a dumb terminal, the menu interface must be very different from others.
I just noticed this converation.
I use 2x16 character 4 button serial terminals, and on "some" of them you have to poll for keypresses! (And ideally convert a bitmap into keycodes, and debounce).
Sam
Re: [RFC] Multi-terminal support (Re: [PATCH] terminal split)
In reply to Yoshinori K. OkujiQuoted 8 lines · Yoshinori K. Okuji
Quoted 4 lines
I've been thinking... what if we make this generic? I.e. with an event loop, then terminals can register their poll functions to it, and write their stuff to a shared resource the rest of GRUB can read from.
For inputs, this is trivial for me. But, for outputs, not simple. For example, although we don't support yet in GRUB 2, if we have a dumb terminal, the menu interface must be very different from others.
Aside from the problem with output ones, what to you think of the event loop idea? It can be useful exploit the parellelism in hardware initialisations. Currently GRUB can do silly things like:
- wait for keyboard controller in grub_keyboard_controller_read() and in grub_keyboard_controller_write()
- move on
- wait for ATA disk in grub_atapi_read()
- move on
- wait for _user_ to stare at the menu and pick an option
- move on
which could be avoided this way (instead of waiting, each function would register a hook that will be repeatedly run untill it returns non-zero).
Signature · 5 lines
Robert Millan The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."
Re: [RFC] Multi-terminal support (Re: [PATCH] terminal split)
Quoted 20 lines · Robert Millan
Quoted 6 lines · Yoshinori K. Okuji
Quoted 3 lines
I've been thinking... what if we make this generic? I.e. with an event loop, then terminals can register their poll functions to it, and write their stuff to a shared resource the rest of GRUB can read from.
For inputs, this is trivial for me. But, for outputs, not simple. For example, although we don't support yet in GRUB 2, if we have a dumb terminal, the menu interface must be very different from others.
Aside from the problem with output ones, what to you think of the event loop idea? It can be useful exploit the parellelism in hardware initialisations. Currently GRUB can do silly things like:
- wait for keyboard controller in
grub_keyboard_controller_read()and ingrub_keyboard_controller_write()
- move on
- wait for ATA disk ingrub_atapi_read()
- move on
- wait for _user_ to stare at the menu and pick an option
- move on
Quoted 2 lines
which could be avoided this way (instead of waiting, each function would register a hook that will be repeatedly run untill it returns non-zero).
Well... I think better road would be co-operative multitasking. While waiting for hardware to respond you could give time to other tasks to handle their stuff. This would also make easier to write such tasks as you do not have to think about complex event system. System you propose can get quite complex to understand and maintain.