2009-08-28 Colin Watson <cjwatson@ubuntu.com>
2009-08-28 Robert Millan <rmh.grub@aybabtu.com> Add `getkeystatus' terminal method. Add a new `keystatus' command to query it. * include/grub/term.h (GRUB_TERM_STATUS_SHIFT, GRUB_TERM_STATUS_CTRL, GRUB_TERM_STATUS_ALT): Definitions for modifier key bitmasks. (struct grub_term_input): Add `getkeystatus' member. (grub_getkeystatus): Add prototype. * kern/term.c (grub_getkeystatus): New function. * include/grub/i386/pc/memory.h (GRUB_MEMORY_MACHINE_BIOS_DATA_AREA_ADDR): New macro. (struct grub_machine_bios_data_area): Define necessary parts of BIOS Data Area layout. * term/i386/pc/console.c (grub_console_getkeystatus): New function. (grub_console_term_input): Set `getkeystatus' member. * term/usb_keyboard.c (grub_usb_hid): Macroify HID protocol constants. (grub_usb_keyboard_getreport): Likewise. (grub_usb_keyboard_checkkey): Likewise. (grub_usb_keyboard_getkeystatus): New function. (grub_usb_keyboard_term): Set `getkeystatus' member. * commands/keystatus.c: New file. * conf/common.rmk (pkglib_MODULES): Add keystatus.mod. (keystatus_mod_SOURCES): New variable. (keystatus_mod_CFLAGS): Likewise. (keystatus_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Add commands/keystatus.c. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_emu_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise. * DISTLIST: Add commands/keystatus.c.
This commit is contained in:
parent
6e2a90859a
commit
4cbe67e509
15 changed files with 270 additions and 15 deletions
|
@ -78,8 +78,19 @@
|
|||
/* The data segment of the pseudo real mode. */
|
||||
#define GRUB_MEMORY_MACHINE_PSEUDO_REAL_DSEG 0x20
|
||||
|
||||
#define GRUB_MEMORY_MACHINE_BIOS_DATA_AREA_ADDR 0x400
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
/* See http://heim.ifi.uio.no/~stanisls/helppc/bios_data_area.html for a
|
||||
description of the BIOS Data Area layout. */
|
||||
struct grub_machine_bios_data_area
|
||||
{
|
||||
grub_uint8_t unused1[0x17];
|
||||
grub_uint8_t keyboard_flag_lower; /* 0x17 */
|
||||
grub_uint8_t unused2[0xf0 - 0x18];
|
||||
};
|
||||
|
||||
struct grub_machine_mmap_entry
|
||||
{
|
||||
grub_uint32_t size;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2003,2005,2007,2008 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2002,2003,2005,2007,2008,2009 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
|
||||
|
@ -72,6 +72,12 @@ grub_term_color_state;
|
|||
#define GRUB_TERM_NEED_INIT (1 << 16)
|
||||
|
||||
|
||||
/* Bitmasks for modifier keys returned by grub_getkeystatus. */
|
||||
#define GRUB_TERM_STATUS_SHIFT (1 << 0)
|
||||
#define GRUB_TERM_STATUS_CTRL (1 << 1)
|
||||
#define GRUB_TERM_STATUS_ALT (1 << 2)
|
||||
|
||||
|
||||
/* Unicode characters for fancy graphics. */
|
||||
#define GRUB_TERM_DISP_LEFT 0x2190
|
||||
#define GRUB_TERM_DISP_UP 0x2191
|
||||
|
@ -157,6 +163,9 @@ struct grub_term_input
|
|||
|
||||
/* Get a character. */
|
||||
int (*getkey) (void);
|
||||
|
||||
/* Get keyboard modifier status. */
|
||||
int (*getkeystatus) (void);
|
||||
};
|
||||
typedef struct grub_term_input *grub_term_input_t;
|
||||
|
||||
|
@ -275,6 +284,7 @@ void EXPORT_FUNC(grub_putcode) (grub_uint32_t code);
|
|||
grub_ssize_t EXPORT_FUNC(grub_getcharwidth) (grub_uint32_t code);
|
||||
int EXPORT_FUNC(grub_getkey) (void);
|
||||
int EXPORT_FUNC(grub_checkkey) (void);
|
||||
int EXPORT_FUNC(grub_getkeystatus) (void);
|
||||
grub_uint16_t EXPORT_FUNC(grub_getwh) (void);
|
||||
grub_uint16_t EXPORT_FUNC(grub_getxy) (void);
|
||||
void EXPORT_FUNC(grub_gotoxy) (grub_uint8_t x, grub_uint8_t y);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue