~ilya-yanok/ubuntu/precise/grub2/fix-for-948716

« back to all changes in this revision

Viewing changes to term/i386/pc/console.c

  • Committer: Bazaar Package Importer
  • Author(s): Robert Millan
  • Date: 2009-07-25 19:00:53 UTC
  • mfrom: (1.6.3 upstream)
  • mto: (17.4.13 sid)
  • mto: This revision was merged to the branch mainline in revision 53.
  • Revision ID: james.westby@ubuntu.com-20090725190053-uv3lm6ya3zxs77ep
ImportĀ upstreamĀ versionĀ 1.96+20090725

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 *  GRUB  --  GRand Unified Bootloader
3
 
 *  Copyright (C) 2002,2003,2005,2007,2008,2009  Free Software Foundation, Inc.
 
3
 *  Copyright (C) 2002,2003,2005,2007,2008  Free Software Foundation, Inc.
4
4
 *
5
5
 *  GRUB is free software: you can redistribute it and/or modify
6
6
 *  it under the terms of the GNU General Public License as published by
16
16
 *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
17
17
 */
18
18
 
19
 
#include <grub/machine/memory.h>
20
19
#include <grub/machine/console.h>
21
20
#include <grub/term.h>
22
21
#include <grub/types.h>
23
22
 
24
 
static const struct grub_machine_bios_data_area *bios_data_area =
25
 
  (struct grub_machine_bios_data_area *) GRUB_MEMORY_MACHINE_BIOS_DATA_AREA_ADDR;
26
 
 
27
 
#define KEYBOARD_LEFT_SHIFT     (1 << 0)
28
 
#define KEYBOARD_RIGHT_SHIFT    (1 << 1)
29
 
#define KEYBOARD_CTRL           (1 << 2)
30
 
#define KEYBOARD_ALT            (1 << 3)
31
 
 
32
 
static int
33
 
grub_console_getkeystatus (void)
34
 
{
35
 
  grub_uint8_t status = bios_data_area->keyboard_flag_lower;
36
 
  int mods = 0;
37
 
 
38
 
  if (status & (KEYBOARD_LEFT_SHIFT | KEYBOARD_RIGHT_SHIFT))
39
 
    mods |= GRUB_TERM_STATUS_SHIFT;
40
 
  if (status & KEYBOARD_CTRL)
41
 
    mods |= GRUB_TERM_STATUS_CTRL;
42
 
  if (status & KEYBOARD_ALT)
43
 
    mods |= GRUB_TERM_STATUS_ALT;
44
 
 
45
 
  return mods;
46
 
}
47
 
 
48
23
static struct grub_term_input grub_console_term_input =
49
24
  {
50
25
    .name = "console",
51
26
    .checkkey = grub_console_checkkey,
52
27
    .getkey = grub_console_getkey,
53
 
    .getkeystatus = grub_console_getkeystatus,
54
28
  };
55
29
 
56
30
static struct grub_term_output grub_console_term_output =