Simplify AT keyboards and support 102nd key
This commit is contained in:
parent
08bfb543c4
commit
1ff38af9b9
3 changed files with 17 additions and 18 deletions
|
@ -58,19 +58,12 @@ get_abstract_code (grub_term_input_t term, int in)
|
|||
unsigned flags = 0;
|
||||
switch (term->flags & GRUB_TERM_INPUT_FLAGS_TYPE_MASK)
|
||||
{
|
||||
case GRUB_TERM_INPUT_FLAGS_TYPE_TERMCODES:
|
||||
default:
|
||||
return in;
|
||||
case GRUB_TERM_INPUT_FLAGS_TYPE_BIOS:
|
||||
{
|
||||
unsigned status = 0;
|
||||
if (term->getkeystatus)
|
||||
status = term->getkeystatus ();
|
||||
if (status & GRUB_TERM_CAPS)
|
||||
flags |= GRUB_TERM_CAPS;
|
||||
}
|
||||
/* Fall through. */
|
||||
case GRUB_TERM_INPUT_FLAGS_TYPE_AT:
|
||||
{
|
||||
struct {
|
||||
int from, to;
|
||||
} translations[] =
|
||||
|
@ -88,12 +81,16 @@ get_abstract_code (grub_term_input_t term, int in)
|
|||
{0x5600 | '|', GRUB_TERM_KEY_SHIFT_102},
|
||||
};
|
||||
unsigned i;
|
||||
|
||||
if (term->getkeystatus)
|
||||
status = term->getkeystatus ();
|
||||
if (status & GRUB_TERM_CAPS)
|
||||
flags |= GRUB_TERM_CAPS;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE (translations); i++)
|
||||
if (translations[i].from == (in & 0xffff))
|
||||
return translations[i].to | flags;
|
||||
if ((term->flags & GRUB_TERM_INPUT_FLAGS_TYPE_MASK)
|
||||
== GRUB_TERM_INPUT_FLAGS_TYPE_AT)
|
||||
return in & ~0xff00;
|
||||
|
||||
/* Detect CTRL'ed keys. */
|
||||
if ((in & 0xff) > 0 && (in & 0xff) < 0x20
|
||||
&& ((in & 0xffff) != (0x0100 | '\e'))
|
||||
|
|
|
@ -152,9 +152,9 @@ struct grub_term_input
|
|||
};
|
||||
typedef struct grub_term_input *grub_term_input_t;
|
||||
|
||||
#define GRUB_TERM_INPUT_FLAGS_TYPE_MASK 0xf
|
||||
#define GRUB_TERM_INPUT_FLAGS_TYPE_AT 0x1
|
||||
#define GRUB_TERM_INPUT_FLAGS_TYPE_BIOS 0x2
|
||||
#define GRUB_TERM_INPUT_FLAGS_TYPE_MASK 0xf
|
||||
#define GRUB_TERM_INPUT_FLAGS_TYPE_TERMCODES 0x0
|
||||
#define GRUB_TERM_INPUT_FLAGS_TYPE_BIOS 0x1
|
||||
|
||||
struct grub_term_output
|
||||
{
|
||||
|
|
|
@ -53,13 +53,14 @@ static int keyboard_map[128] =
|
|||
'\0', ' ', '\0', '\0', '\0', '\0', '\0', '\0',
|
||||
'\0', '\0', '\0', '\0', '\0', '\0', '\0', GRUB_TERM_KEY_HOME,
|
||||
GRUB_TERM_KEY_UP, GRUB_TERM_KEY_NPAGE, '-', GRUB_TERM_KEY_LEFT, '\0', GRUB_TERM_KEY_RIGHT, '+', GRUB_TERM_KEY_END,
|
||||
GRUB_TERM_KEY_DOWN, GRUB_TERM_KEY_PPAGE, '\0', GRUB_TERM_KEY_DC, '\0', '\0', '\0', '\0',
|
||||
GRUB_TERM_KEY_DOWN, GRUB_TERM_KEY_PPAGE, '\0', GRUB_TERM_KEY_DC, '\0', '\0',
|
||||
GRUB_TERM_KEY_102, '\0',
|
||||
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
|
||||
'\0', '\0', '\0', '\0', '\0', OLPC_UP, OLPC_DOWN, OLPC_LEFT,
|
||||
OLPC_RIGHT
|
||||
};
|
||||
|
||||
static char keyboard_map_shift[128] =
|
||||
static int keyboard_map_shift[128] =
|
||||
{
|
||||
'\0', '\0', '!', '@', '#', '$', '%', '^',
|
||||
'&', '*', '(', ')', '_', '+', '\0', '\0',
|
||||
|
@ -67,7 +68,8 @@ static char keyboard_map_shift[128] =
|
|||
'O', 'P', '{', '}', '\n', '\0', 'A', 'S',
|
||||
'D', 'F', 'G', 'H', 'J', 'K', 'L', ':',
|
||||
'\"', '~', '\0', '|', 'Z', 'X', 'C', 'V',
|
||||
'B', 'N', 'M', '<', '>', '?'
|
||||
'B', 'N', 'M', '<', '>', '?',
|
||||
[0x56] = GRUB_TERM_KEY_SHIFT_102
|
||||
};
|
||||
|
||||
static grub_uint8_t grub_keyboard_controller_orig;
|
||||
|
@ -300,7 +302,7 @@ static struct grub_term_input grub_at_keyboard_term =
|
|||
.fini = grub_keyboard_controller_fini,
|
||||
.checkkey = grub_at_keyboard_checkkey,
|
||||
.getkey = grub_at_keyboard_getkey,
|
||||
.flags = GRUB_TERM_INPUT_FLAGS_TYPE_AT
|
||||
.flags = GRUB_TERM_INPUT_FLAGS_TYPE_TERMCODES
|
||||
};
|
||||
|
||||
GRUB_MOD_INIT(at_keyboard)
|
||||
|
|
Loading…
Reference in a new issue