~hamo/ubuntu/precise/grub2/grub2.hi_res

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Mario Limonciello
  • Date: 2008-05-27 11:32:41 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20080527113241-033nau9g4yfsr5ps
Tags: 1.96+20080512-1ubuntu1
* Merge from debian unstable, remaining changes:
  - Adjust debian/default/grub for default Ubuntu boot options.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#include <grub/machine/console.h>
20
20
#include <grub/cpu/io.h>
21
21
#include <grub/misc.h>
 
22
#include <grub/term.h>
22
23
 
23
24
#define SHIFT_L         0x2a
24
25
#define SHIFT_R         0x36
52
53
 
53
54
static char keyboard_map[128] =
54
55
{
55
 
  '\0', '\0', '1', '2', '3', '4', '5', '6',
56
 
  '7', '8', '9', '0', '-', '=', '\b', '\t',
 
56
  '\0', GRUB_TERM_ESC, '1', '2', '3', '4', '5', '6',
 
57
  '7', '8', '9', '0', '-', '=', GRUB_TERM_BACKSPACE, GRUB_TERM_TAB,
57
58
  'q', 'w', 'e', 'r', 't', 'y', 'u', 'i',
58
59
  'o', 'p', '[', ']', '\n', '\0', 'a', 's',
59
60
  'd', 'f', 'g', 'h', 'j', 'k', 'l', ';',
60
61
  '\'', '`', '\0', '\\', 'z', 'x', 'c', 'v',
61
62
  'b', 'n', 'm', ',', '.', '/', '\0', '*',
62
63
  '\0', ' ', '\0', '\0', '\0', '\0', '\0', '\0',
63
 
  '\0', '\0', '\0', '\0', '\0', '\0', '\0', '7',
64
 
  '8', '9', '-', '4', '5', '6', '+', '1',
65
 
  '2', '3',
 
64
  '\0', '\0', '\0', '\0', '\0', '\0', '\0', GRUB_TERM_HOME,
 
65
  GRUB_TERM_UP, GRUB_TERM_NPAGE, '-', GRUB_TERM_LEFT, '\0', GRUB_TERM_RIGHT, '+', GRUB_TERM_END,
 
66
  GRUB_TERM_DOWN, GRUB_TERM_PPAGE, '\0', GRUB_TERM_DC
66
67
};
67
68
 
68
69
static char keyboard_map_shift[128] =
69
70
{
70
71
  '\0', '\0', '!', '@', '#', '$', '%', '^',
71
 
  '&', '*', '(', ')', '_', '+', '\b', '\t',
 
72
  '&', '*', '(', ')', '_', '+', '\0', '\0',
72
73
  'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I',
73
74
  'O', 'P', '{', '}', '\n', '\0', 'A', 'S',
74
75
  'D', 'F', 'G', 'H', 'J', 'K', 'L', ':',
75
76
  '\"', '~', '\0', '|', 'Z', 'X', 'C', 'V',
76
 
  'B', 'N', 'M', '<', '>', '?', '\0', '*',
77
 
  '\0', ' ', '\0', '\0', '\0', '\0', '\0', '\0',
78
 
  '\0', '\0', '\0', '\0', '\0', '\0', '\0', '7',
79
 
  '8', '9', '-', '4', '5', '6', '+', '1',
80
 
  '2', '3',
 
77
  'B', 'N', 'M', '<', '>', '?'
81
78
};
82
79
 
83
80
static void
180
177
  switch (key)
181
178
    {
182
179
      case CAPS_LOCK:
183
 
        if (at_keyboard_status & KEYBOARD_STATUS_CAPS_LOCK)
184
 
          at_keyboard_status &= ~KEYBOARD_STATUS_CAPS_LOCK;
185
 
        else
186
 
          at_keyboard_status |= KEYBOARD_STATUS_CAPS_LOCK;
 
180
        at_keyboard_status ^= KEYBOARD_STATUS_CAPS_LOCK;
 
181
        /* Caps lock sends scan code twice.  Get the second one and discard it.  */
 
182
        while (grub_keyboard_getkey () == -1);
187
183
#ifdef DEBUG_AT_KEYBOARD
188
184
        grub_dprintf ("atkeyb", "caps_lock = %d\n", !!(at_keyboard_status & KEYBOARD_STATUS_CAPS_LOCK));
189
185
#endif
190
186
        key = -1;
191
187
        break;
192
188
      default:
193
 
        if (at_keyboard_status & (KEYBOARD_STATUS_SHIFT_L | KEYBOARD_STATUS_SHIFT_R))
 
189
        if ((at_keyboard_status & (KEYBOARD_STATUS_SHIFT_L | KEYBOARD_STATUS_SHIFT_R))
 
190
            && keyboard_map_shift[key])
194
191
          key = keyboard_map_shift[key];
195
192
        else
196
193
          key = keyboard_map[key];