Merge multiterm into gfxmenu+multiterm
This commit is contained in:
commit
e6e86df1de
238 changed files with 3524 additions and 1873 deletions
|
@ -211,7 +211,7 @@ grub_virtual_screen_setup (unsigned int x, unsigned int y,
|
|||
virtual_screen.font = grub_font_get (font_name);
|
||||
if (!virtual_screen.font)
|
||||
return grub_error (GRUB_ERR_BAD_FONT,
|
||||
"No font loaded.");
|
||||
"no font loaded");
|
||||
virtual_screen.width = width;
|
||||
virtual_screen.height = height;
|
||||
virtual_screen.offset_x = x;
|
||||
|
@ -1181,12 +1181,11 @@ GRUB_MOD_INIT(term_gfxterm)
|
|||
#else
|
||||
grub_term_register_output ("gfxterm", &grub_video_term);
|
||||
#endif
|
||||
|
||||
background_image_cmd_handle =
|
||||
grub_register_extcmd ("background_image",
|
||||
grub_gfxterm_background_image_cmd,
|
||||
GRUB_COMMAND_FLAG_BOTH,
|
||||
"background_image [-m (stretch|normal)] FILE",
|
||||
"[-m (stretch|normal)] FILE",
|
||||
"Load background image for active terminal.",
|
||||
background_image_cmd_options);
|
||||
}
|
||||
|
|
|
@ -32,6 +32,13 @@ static short at_keyboard_status = 0;
|
|||
#define KEYBOARD_STATUS_CTRL_L (1 << 4)
|
||||
#define KEYBOARD_STATUS_CTRL_R (1 << 5)
|
||||
#define KEYBOARD_STATUS_CAPS_LOCK (1 << 6)
|
||||
#define KEYBOARD_STATUS_NUM_LOCK (1 << 7)
|
||||
|
||||
static grub_uint8_t led_status;
|
||||
|
||||
#define KEYBOARD_LED_SCROLL (1 << 0)
|
||||
#define KEYBOARD_LED_NUM (1 << 1)
|
||||
#define KEYBOARD_LED_CAPS (1 << 2)
|
||||
|
||||
static char keyboard_map[128] =
|
||||
{
|
||||
|
@ -65,9 +72,15 @@ static char keyboard_map_shift[128] =
|
|||
static grub_uint8_t grub_keyboard_controller_orig;
|
||||
|
||||
static void
|
||||
grub_keyboard_controller_write (grub_uint8_t c)
|
||||
keyboard_controller_wait_until_ready (void)
|
||||
{
|
||||
while (! KEYBOARD_COMMAND_ISREADY (grub_inb (KEYBOARD_REG_STATUS)));
|
||||
}
|
||||
|
||||
static void
|
||||
grub_keyboard_controller_write (grub_uint8_t c)
|
||||
{
|
||||
keyboard_controller_wait_until_ready ();
|
||||
grub_outb (KEYBOARD_COMMAND_WRITE, KEYBOARD_REG_STATUS);
|
||||
grub_outb (c, KEYBOARD_REG_DATA);
|
||||
}
|
||||
|
@ -75,11 +88,20 @@ grub_keyboard_controller_write (grub_uint8_t c)
|
|||
static grub_uint8_t
|
||||
grub_keyboard_controller_read (void)
|
||||
{
|
||||
while (! KEYBOARD_COMMAND_ISREADY (grub_inb (KEYBOARD_REG_STATUS)));
|
||||
keyboard_controller_wait_until_ready ();
|
||||
grub_outb (KEYBOARD_COMMAND_READ, KEYBOARD_REG_STATUS);
|
||||
return grub_inb (KEYBOARD_REG_DATA);
|
||||
}
|
||||
|
||||
static void
|
||||
keyboard_controller_led (grub_uint8_t leds)
|
||||
{
|
||||
keyboard_controller_wait_until_ready ();
|
||||
grub_outb (0xed, KEYBOARD_REG_DATA);
|
||||
keyboard_controller_wait_until_ready ();
|
||||
grub_outb (leds & 0x7, KEYBOARD_REG_DATA);
|
||||
}
|
||||
|
||||
/* FIXME: This should become an interrupt service routine. For now
|
||||
it's just used to catch events from control keys. */
|
||||
static void
|
||||
|
@ -158,14 +180,37 @@ grub_at_keyboard_getkey_noblock (void)
|
|||
switch (code)
|
||||
{
|
||||
case CAPS_LOCK:
|
||||
at_keyboard_status ^= KEYBOARD_STATUS_CAPS_LOCK;
|
||||
/* Caps lock sends scan code twice. Get the second one and discard it. */
|
||||
while (grub_keyboard_getkey () == -1);
|
||||
|
||||
at_keyboard_status ^= KEYBOARD_STATUS_CAPS_LOCK;
|
||||
led_status ^= KEYBOARD_LED_CAPS;
|
||||
keyboard_controller_led (led_status);
|
||||
|
||||
#ifdef DEBUG_AT_KEYBOARD
|
||||
grub_dprintf ("atkeyb", "caps_lock = %d\n", !!(at_keyboard_status & KEYBOARD_STATUS_CAPS_LOCK));
|
||||
#endif
|
||||
key = -1;
|
||||
break;
|
||||
case NUM_LOCK:
|
||||
/* Num lock sends scan code twice. Get the second one and discard it. */
|
||||
while (grub_keyboard_getkey () == -1);
|
||||
|
||||
at_keyboard_status ^= KEYBOARD_STATUS_NUM_LOCK;
|
||||
led_status ^= KEYBOARD_LED_NUM;
|
||||
keyboard_controller_led (led_status);
|
||||
|
||||
#ifdef DEBUG_AT_KEYBOARD
|
||||
grub_dprintf ("atkeyb", "num_lock = %d\n", !!(at_keyboard_status & KEYBOARD_STATUS_NUM_LOCK));
|
||||
#endif
|
||||
key = -1;
|
||||
break;
|
||||
case SCROLL_LOCK:
|
||||
/* For scroll lock we don't keep track of status. Only update its led. */
|
||||
led_status ^= KEYBOARD_LED_SCROLL;
|
||||
keyboard_controller_led (led_status);
|
||||
key = -1;
|
||||
break;
|
||||
default:
|
||||
if (at_keyboard_status & (KEYBOARD_STATUS_CTRL_L | KEYBOARD_STATUS_CTRL_R))
|
||||
key = keyboard_map[code] - 'a' + 1;
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <grub/terminfo.h>
|
||||
#include <grub/cpu/io.h>
|
||||
#include <grub/extcmd.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
#define TEXT_WIDTH 80
|
||||
#define TEXT_HEIGHT 25
|
||||
|
@ -42,12 +43,12 @@ static unsigned int npending = 0;
|
|||
/* Argument options. */
|
||||
static const struct grub_arg_option options[] =
|
||||
{
|
||||
{"unit", 'u', 0, "Set the serial unit", 0, ARG_TYPE_INT},
|
||||
{"port", 'p', 0, "Set the serial port address", 0, ARG_TYPE_STRING},
|
||||
{"speed", 's', 0, "Set the serial port speed", 0, ARG_TYPE_INT},
|
||||
{"word", 'w', 0, "Set the serial port word length", 0, ARG_TYPE_INT},
|
||||
{"parity", 'r', 0, "Set the serial port parity", 0, ARG_TYPE_STRING},
|
||||
{"stop", 't', 0, "Set the serial port stop bits", 0, ARG_TYPE_INT},
|
||||
{"unit", 'u', 0, N_("Set the serial unit."), 0, ARG_TYPE_INT},
|
||||
{"port", 'p', 0, N_("Set the serial port address."), 0, ARG_TYPE_STRING},
|
||||
{"speed", 's', 0, N_("Set the serial port speed."), 0, ARG_TYPE_INT},
|
||||
{"word", 'w', 0, N_("Set the serial port word length."), 0, ARG_TYPE_INT},
|
||||
{"parity", 'r', 0, N_("Set the serial port parity."), 0, ARG_TYPE_STRING},
|
||||
{"stop", 't', 0, N_("Set the serial port stop bits."), 0, ARG_TYPE_INT},
|
||||
{0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
|
@ -499,7 +500,7 @@ grub_cmd_serial (grub_extcmd_t cmd,
|
|||
unit = grub_strtoul (state[0].arg, 0, 0);
|
||||
serial_settings.port = serial_hw_get_port (unit);
|
||||
if (!serial_settings.port)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "bad unit number.");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "bad unit number");
|
||||
}
|
||||
|
||||
if (state[1].set)
|
||||
|
@ -603,8 +604,8 @@ GRUB_MOD_INIT(serial)
|
|||
{
|
||||
cmd = grub_register_extcmd ("serial", grub_cmd_serial,
|
||||
GRUB_COMMAND_FLAG_BOTH,
|
||||
"serial [OPTIONS...]",
|
||||
"Configure serial port.", options);
|
||||
N_("[OPTIONS...]"),
|
||||
N_("Configure serial port."), options);
|
||||
|
||||
/* Set default settings. */
|
||||
serial_settings.port = serial_hw_get_port (0);
|
||||
|
|
|
@ -163,7 +163,7 @@ grub_vga_mod_init (void)
|
|||
set_start_address (PAGE_OFFSET (page));
|
||||
font = grub_font_get (""); /* Choose any font, for now. */
|
||||
if (!font)
|
||||
return grub_error (GRUB_ERR_BAD_FONT, "No font loaded.");
|
||||
return grub_error (GRUB_ERR_BAD_FONT, "no font loaded");
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
|
|
@ -346,7 +346,7 @@ grub_ofconsole_init_input (void)
|
|||
if (grub_ieee1275_get_integer_property (grub_ieee1275_chosen, "stdin", &stdin_ihandle,
|
||||
sizeof stdin_ihandle, &actual)
|
||||
|| actual != sizeof stdin_ihandle)
|
||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Cannot find stdin");
|
||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "cannot find stdin");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -365,7 +365,7 @@ grub_ofconsole_init_output (void)
|
|||
if (grub_ieee1275_get_integer_property (grub_ieee1275_chosen, "stdout", &stdout_ihandle,
|
||||
sizeof stdout_ihandle, &actual)
|
||||
|| actual != sizeof stdout_ihandle)
|
||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Cannot find stdout");
|
||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "cannot find stdout");
|
||||
|
||||
/* Initialize colors. */
|
||||
if (! grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_CANNOT_SET_COLORS))
|
||||
|
|
|
@ -103,7 +103,7 @@ grub_terminfo_set_current (const char *str)
|
|||
return grub_errno;
|
||||
}
|
||||
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminfo type.");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminfo type");
|
||||
}
|
||||
|
||||
/* Wrapper for grub_putchar to write strings. */
|
||||
|
@ -168,7 +168,7 @@ grub_cmd_terminfo (grub_command_t cmd __attribute__ ((unused)),
|
|||
return GRUB_ERR_NONE;
|
||||
}
|
||||
else if (argc != 1)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "too many parameters.");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "too many parameters");
|
||||
else
|
||||
return grub_terminfo_set_current (args[0]);
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ static grub_command_t cmd;
|
|||
GRUB_MOD_INIT(terminfo)
|
||||
{
|
||||
cmd = grub_register_command ("terminfo", grub_cmd_terminfo,
|
||||
"terminfo [TERM]", "Set terminfo type.");
|
||||
"[TERM]", "Set terminfo type.");
|
||||
grub_terminfo_set_current ("vt100");
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue