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'.
This commit is contained in:
parent
99fadbaafd
commit
409480b7a2
6 changed files with 3969 additions and 3429 deletions
21
ChangeLog
21
ChangeLog
|
@ -1,3 +1,24 @@
|
|||
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-04 Bean <bean123ch@gmail.com>
|
||||
|
||||
* Makefile.in (enable_grub_fstest): New variable.
|
||||
|
|
|
@ -88,10 +88,10 @@
|
|||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* The size of a `long', as computed by sizeof. */
|
||||
/* The size of `long', as computed by sizeof. */
|
||||
#undef SIZEOF_LONG
|
||||
|
||||
/* The size of a `void *', as computed by sizeof. */
|
||||
/* The size of `void *', as computed by sizeof. */
|
||||
#undef SIZEOF_VOID_P
|
||||
|
||||
/* Define it to either start or _start */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2003,2005,2007 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2002,2003,2005,2007,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
|
||||
|
@ -19,6 +19,22 @@
|
|||
#ifndef GRUB_TERM_HEADER
|
||||
#define GRUB_TERM_HEADER 1
|
||||
|
||||
/* Internal codes used by GRUB to represent terminal input. */
|
||||
#define GRUB_TERM_LEFT 2
|
||||
#define GRUB_TERM_RIGHT 6
|
||||
#define GRUB_TERM_UP 16
|
||||
#define GRUB_TERM_DOWN 14
|
||||
#define GRUB_TERM_HOME 1
|
||||
#define GRUB_TERM_END 5
|
||||
#define GRUB_TERM_DC 4
|
||||
#define GRUB_TERM_PPAGE 7
|
||||
#define GRUB_TERM_NPAGE 3
|
||||
#define GRUB_TERM_ESC '\e'
|
||||
#define GRUB_TERM_TAB '\t'
|
||||
#define GRUB_TERM_BACKSPACE '\b'
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
#include <grub/err.h>
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/types.h>
|
||||
|
@ -211,4 +227,6 @@ void EXPORT_FUNC(grub_set_more) (int onoff);
|
|||
/* For convenience. */
|
||||
#define GRUB_TERM_ASCII_CHAR(c) ((c) & 0xff)
|
||||
|
||||
#endif /* ! ASM_FILE */
|
||||
|
||||
#endif /* ! GRUB_TERM_HEADER */
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
#include <grub/machine/console.h>
|
||||
#include <grub/cpu/linux.h>
|
||||
#include <grub/machine/kernel.h>
|
||||
#include <grub/term.h>
|
||||
#include <multiboot.h>
|
||||
#include <multiboot2.h>
|
||||
|
||||
|
@ -1179,16 +1180,16 @@ FUNCTION(grub_console_real_putchar)
|
|||
|
||||
/* this table is used in translate_keycode below */
|
||||
translation_table:
|
||||
.word GRUB_CONSOLE_KEY_LEFT, 2
|
||||
.word GRUB_CONSOLE_KEY_RIGHT, 6
|
||||
.word GRUB_CONSOLE_KEY_UP, 16
|
||||
.word GRUB_CONSOLE_KEY_DOWN, 14
|
||||
.word GRUB_CONSOLE_KEY_HOME, 1
|
||||
.word GRUB_CONSOLE_KEY_END, 5
|
||||
.word GRUB_CONSOLE_KEY_DC, 4
|
||||
.word GRUB_CONSOLE_KEY_BACKSPACE, 8
|
||||
.word GRUB_CONSOLE_KEY_PPAGE, 7
|
||||
.word GRUB_CONSOLE_KEY_NPAGE, 3
|
||||
.word GRUB_CONSOLE_KEY_LEFT, GRUB_TERM_LEFT
|
||||
.word GRUB_CONSOLE_KEY_RIGHT, GRUB_TERM_RIGHT
|
||||
.word GRUB_CONSOLE_KEY_UP, GRUB_TERM_UP
|
||||
.word GRUB_CONSOLE_KEY_DOWN, GRUB_TERM_DOWN
|
||||
.word GRUB_CONSOLE_KEY_HOME, GRUB_TERM_HOME
|
||||
.word GRUB_CONSOLE_KEY_END, GRUB_TERM_END
|
||||
.word GRUB_CONSOLE_KEY_DC, GRUB_TERM_DC
|
||||
.word GRUB_CONSOLE_KEY_BACKSPACE, GRUB_TERM_BACKSPACE
|
||||
.word GRUB_CONSOLE_KEY_PPAGE, GRUB_TERM_PPAGE
|
||||
.word GRUB_CONSOLE_KEY_NPAGE, GRUB_TERM_NPAGE
|
||||
.word 0
|
||||
|
||||
/*
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include <grub/machine/console.h>
|
||||
#include <grub/cpu/io.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/term.h>
|
||||
|
||||
#define SHIFT_L 0x2a
|
||||
#define SHIFT_R 0x36
|
||||
|
@ -52,32 +53,28 @@ static short at_keyboard_status = 0;
|
|||
|
||||
static char keyboard_map[128] =
|
||||
{
|
||||
'\0', '\0', '1', '2', '3', '4', '5', '6',
|
||||
'7', '8', '9', '0', '-', '=', '\b', '\t',
|
||||
'\0', GRUB_TERM_ESC, '1', '2', '3', '4', '5', '6',
|
||||
'7', '8', '9', '0', '-', '=', GRUB_TERM_BACKSPACE, GRUB_TERM_TAB,
|
||||
'q', 'w', 'e', 'r', 't', 'y', 'u', 'i',
|
||||
'o', 'p', '[', ']', '\n', '\0', 'a', 's',
|
||||
'd', 'f', 'g', 'h', 'j', 'k', 'l', ';',
|
||||
'\'', '`', '\0', '\\', 'z', 'x', 'c', 'v',
|
||||
'b', 'n', 'm', ',', '.', '/', '\0', '*',
|
||||
'\0', ' ', '\0', '\0', '\0', '\0', '\0', '\0',
|
||||
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '7',
|
||||
'8', '9', '-', '4', '5', '6', '+', '1',
|
||||
'2', '3',
|
||||
'\0', '\0', '\0', '\0', '\0', '\0', '\0', GRUB_TERM_HOME,
|
||||
GRUB_TERM_UP, GRUB_TERM_NPAGE, '-', GRUB_TERM_LEFT, '\0', GRUB_TERM_RIGHT, '+', GRUB_TERM_END,
|
||||
GRUB_TERM_DOWN, GRUB_TERM_PPAGE, '\0', GRUB_TERM_DC
|
||||
};
|
||||
|
||||
static char keyboard_map_shift[128] =
|
||||
{
|
||||
'\0', '\0', '!', '@', '#', '$', '%', '^',
|
||||
'&', '*', '(', ')', '_', '+', '\b', '\t',
|
||||
'&', '*', '(', ')', '_', '+', '\0', '\0',
|
||||
'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I',
|
||||
'O', 'P', '{', '}', '\n', '\0', 'A', 'S',
|
||||
'D', 'F', 'G', 'H', 'J', 'K', 'L', ':',
|
||||
'\"', '~', '\0', '|', 'Z', 'X', 'C', 'V',
|
||||
'B', 'N', 'M', '<', '>', '?', '\0', '*',
|
||||
'\0', ' ', '\0', '\0', '\0', '\0', '\0', '\0',
|
||||
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '7',
|
||||
'8', '9', '-', '4', '5', '6', '+', '1',
|
||||
'2', '3',
|
||||
'B', 'N', 'M', '<', '>', '?'
|
||||
};
|
||||
|
||||
static void
|
||||
|
@ -180,17 +177,17 @@ grub_console_checkkey (void)
|
|||
switch (key)
|
||||
{
|
||||
case CAPS_LOCK:
|
||||
if (at_keyboard_status & KEYBOARD_STATUS_CAPS_LOCK)
|
||||
at_keyboard_status &= ~KEYBOARD_STATUS_CAPS_LOCK;
|
||||
else
|
||||
at_keyboard_status |= KEYBOARD_STATUS_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);
|
||||
#ifdef DEBUG_AT_KEYBOARD
|
||||
grub_dprintf ("atkeyb", "caps_lock = %d\n", !!(at_keyboard_status & KEYBOARD_STATUS_CAPS_LOCK));
|
||||
#endif
|
||||
key = -1;
|
||||
break;
|
||||
default:
|
||||
if (at_keyboard_status & (KEYBOARD_STATUS_SHIFT_L | KEYBOARD_STATUS_SHIFT_R))
|
||||
if ((at_keyboard_status & (KEYBOARD_STATUS_SHIFT_L | KEYBOARD_STATUS_SHIFT_R))
|
||||
&& keyboard_map_shift[key])
|
||||
key = keyboard_map_shift[key];
|
||||
else
|
||||
key = keyboard_map[key];
|
||||
|
|
Loading…
Reference in a new issue