automatically activated because they're the only terminal that has been loaded.
This solution is temporary. In the future, all terminals should auto-enable,
but this is non-trivial due to resource conflict, and it shouldn't prevent
merge in trunk.
2010-01-07 Vladimir Serbinenko <phcoder@gmail.com>
-2010-01-07 Robert Millan <rmh.grub@aybabtu.com>
+2010-01-09 Robert Millan <rmh.grub@aybabtu.com>
Support for multiple terminals.
(grub_term_inputs_disabled): Likewise.
(grub_term_outputs): Likewise.
(grub_term_inputs): Likewise.
- (grub_term_register_input_active): New function.
- (grub_term_register_output_active): Likewise.
(grub_term_register_input): Rewritten.
(grub_term_register_output): Likewise.
(grub_term_unregister_input): Likewise.
* normal/menu_text.c: Likewise.
* normal/menu_viewer.c: Removed. All users updated.
* normal/term.c: New file.
- * term/efi/console.c (grub_console_init): Use
- grub_term_register_input_active and grub_term_register_output_active.
- * term/gfxterm.c (GRUB_MOD_INIT) [GRUB_MACHINE_MIPS_YEELOONG]: Likewise.
- * term/i386/pc/at_keyboard.c (GRUB_MOD_INIT)
- [GRUB_MACHINE_MIPS_YEELOONG] || [GRUB_MACHINE_COREBOOT]
- || [GRUB_MACHINE_QEMU]: Likewise.
- * term/i386/pc/vga_text.c (GRUB_MOD_INIT) [GRUB_MACHINE_COREBOOT]
- || [GRUB_MACHINE_QEMU]: Likewise.
- * term/i386/pc/console.c (grub_console_init): Likewise.
- * term/ieee1275/ofconsole.c (grub_console_init): Likewise.
* util/console.c: Change order of includes to workaround a bug in
ncurses headers.
- (grub_console_init): Use
- grub_term_register_input_active and grub_term_register_output_active.
* term/terminfo.c: New argument oterm on all exported functions.
All users updated.
* util/grub-editenv.c (grub_term_input_class): Removed.
#! /bin/sh
#
-# Copyright (C) 2009 Free Software Foundation, Inc.
+# Copyright (C) 2009,2010 Free Software Foundation, Inc.
#
# This script is free software; the author
# gives unlimited permission to copy and/or distribute it,
grep -v "^#" | sed -n \
-e "/grub_term_register_input *( *\"/{s/.*( *\"\([^\"]*\)\".*/i\1: $module/;p;}" \
- -e "/grub_term_register_input_active *( *\"/{s/.*( *\"\([^\"]*\)\".*/i\1: $module/;p;}" \
-e "/grub_term_register_output *( *\"/{s/.*( *\"\([^\"]*\)\".*/o\1: $module/;p;}" \
- -e "/grub_term_register_output_active *( *\"/{s/.*( *\"\([^\"]*\)\".*/o\1: $module/;p;}"
/*
* GRUB -- GRand Unified Bootloader
- * Copyright (C) 2002,2003,2005,2007,2008,2009 Free Software Foundation, Inc.
+ * Copyright (C) 2002,2003,2005,2007,2008,2009,2010 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
extern struct grub_term_output *EXPORT_VAR(grub_term_outputs);
extern struct grub_term_input *EXPORT_VAR(grub_term_inputs);
-static inline void
-grub_term_register_input_active (const char *name __attribute__ ((unused)),
- grub_term_input_t term)
-{
- if (term->init)
- term->init ();
- grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs), GRUB_AS_LIST (term));
-}
-
static inline void
grub_term_register_input (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));
-}
-
-static inline void
-grub_term_register_output_active (const char *name __attribute__ ((unused)),
- grub_term_output_t term)
-{
- if (term->init)
- term->init ();
- grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs), GRUB_AS_LIST (term));
+ 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. */
+ if (term->init)
+ term->init ();
+ grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs), GRUB_AS_LIST (term));
+ }
}
static inline void
grub_term_register_output (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));
+ 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. */
+ if (term->init)
+ term->init ();
+ grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs),
+ GRUB_AS_LIST (term));
+ }
}
static inline void
return;
}
- grub_term_register_input_active ("console", &grub_console_term_input);
- grub_term_register_output_active ("console", &grub_console_term_output);
+ grub_term_register_input ("console", &grub_console_term_input);
+ grub_term_register_output ("console", &grub_console_term_output);
}
void
GRUB_MOD_INIT(term_gfxterm)
{
-#ifdef GRUB_MACHINE_MIPS_YEELOONG
- grub_term_register_output_active ("gfxterm", &grub_video_term);
-#else
grub_term_register_output ("gfxterm", &grub_video_term);
-#endif
cmd = grub_register_command ("background_image",
grub_gfxterm_background_image_cmd,
0, "Load background image for active terminal.");
GRUB_MOD_INIT(at_keyboard)
{
-#if defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_QEMU) || defined (GRUB_MACHINE_MIPS_YEELOONG)
- grub_term_register_input_active ("at_keyboard", &grub_at_keyboard_term);
-#else
grub_term_register_input ("at_keyboard", &grub_at_keyboard_term);
-#endif
}
GRUB_MOD_FINI(at_keyboard)
void
grub_console_init (void)
{
- grub_term_register_output_active ("console", &grub_console_term_output);
- grub_term_register_input_active ("console", &grub_console_term_input);
+ grub_term_register_output ("console", &grub_console_term_output);
+ grub_term_register_input ("console", &grub_console_term_input);
}
void
.setcolorstate = grub_console_setcolorstate,
.setcolor = grub_console_setcolor,
.getcolor = grub_console_getcolor,
- .setcursor = grub_vga_text_setcursor
+ .setcursor = grub_vga_text_setcursor,
};
GRUB_MOD_INIT(vga_text)
{
-#if defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_QEMU)
- grub_term_register_output_active ("vga_text", &grub_vga_text_term);
-#else
grub_term_register_output ("vga_text", &grub_vga_text_term);
-#endif
}
GRUB_MOD_FINI(vga_text)
void
grub_console_init (void)
{
- grub_term_register_input_active ("ofconsole", &grub_ofconsole_term_input);
- grub_term_register_output_active ("ofconsole", &grub_ofconsole_term_output);
+ grub_term_register_input ("ofconsole", &grub_ofconsole_term_input);
+ grub_term_register_output ("ofconsole", &grub_ofconsole_term_output);
}
void
void
grub_console_init (void)
{
- grub_term_register_output_active ("console", &grub_ncurses_term_output);
- grub_term_register_input_active ("console", &grub_ncurses_term_input);
+ grub_term_register_output ("console", &grub_ncurses_term_output);
+ grub_term_register_input ("console", &grub_ncurses_term_input);
}
void