Revision 7096a96d

b/hw/ps2.c
110 110

  
111 111
/* Table to convert from PC scancodes to raw scancodes.  */
112 112
static const unsigned char ps2_raw_keycode[128] = {
113
          0,118, 22, 30, 38, 37, 46, 54, 61, 62, 70, 69, 78, 85,102, 13,
114
         21, 29, 36, 45, 44, 53, 60, 67, 68, 77, 84, 91, 90, 20, 28, 27,
115
         35, 43, 52, 51, 59, 66, 75, 76, 82, 14, 18, 93, 26, 34, 33, 42,
116
         50, 49, 58, 65, 73, 74, 89,124, 17, 41, 88,  5,  6,  4, 12,  3,
117
         11,  2, 10,  1,  9,119,126,108,117,125,123,107,115,116,121,105,
118
        114,122,112,113,127, 96, 97,120,  7, 15, 23, 31, 39, 47, 55, 63,
119
         71, 79, 86, 94,  8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 87,111,
120
         19, 25, 57, 81, 83, 92, 95, 98, 99,100,101,103,104,106,109,110
113
  0, 118,  22,  30,  38,  37,  46,  54,  61,  62,  70,  69,  78,  85, 102,  13,
114
 21,  29,  36,  45,  44,  53,  60,  67,  68,  77,  84,  91,  90,  20,  28,  27,
115
 35,  43,  52,  51,  59,  66,  75,  76,  82,  14,  18,  93,  26,  34,  33,  42,
116
 50,  49,  58,  65,  73,  74,  89, 124,  17,  41,  88,   5,   6,   4,  12,   3,
117
 11,   2,  10,   1,   9, 119, 126, 108, 117, 125, 123, 107, 115, 116, 121, 105,
118
114, 122, 112, 113, 127,  96,  97, 120,   7,  15,  23,  31,  39,  47,  55,  63,
119
 71,  79,  86,  94,   8,  16,  24,  32,  40,  48,  56,  64,  72,  80,  87, 111,
120
 19,  25,  57,  81,  83,  92,  95,  98,  99, 100, 101, 103, 104, 106, 109, 110
121
};
122
static const unsigned char ps2_raw_keycode_set3[128] = {
123
  0,   8,  22,  30,  38,  37,  46,  54,  61,  62,  70,  69,  78,  85, 102,  13,
124
 21,  29,  36,  45,  44,  53,  60,  67,  68,  77,  84,  91,  90,  17,  28,  27,
125
 35,  43,  52,  51,  59,  66,  75,  76,  82,  14,  18,  92,  26,  34,  33,  42,
126
 50,  49,  58,  65,  73,  74,  89, 126,  25,  41,  20,   7,  15,  23,  31,  39,
127
 47,   2,  63,  71,  79, 118,  95, 108, 117, 125, 132, 107, 115, 116, 124, 105,
128
114, 122, 112, 113, 127,  96,  97,  86,  94,  15,  23,  31,  39,  47,  55,  63,
129
 71,  79,  86,  94,   8,  16,  24,  32,  40,  48,  56,  64,  72,  80,  87, 111,
130
 19,  25,  57,  81,  83,  92,  95,  98,  99, 100, 101, 103, 104, 106, 109, 110
121 131
};
122 132

  
123 133
void ps2_queue(void *opaque, int b)
......
143 153
{
144 154
    PS2KbdState *s = opaque;
145 155

  
146
    /* XXX: add support for scancode sets 1 and 3 */
147
    if (!s->translate && keycode < 0xe0 && s->scancode_set == 2)
148
      {
149
        if (keycode & 0x80)
156
    /* XXX: add support for scancode set 1 */
157
    if (!s->translate && keycode < 0xe0 && s->scancode_set > 1) {
158
        if (keycode & 0x80) {
150 159
            ps2_queue(&s->common, 0xf0);
151
        keycode = ps2_raw_keycode[keycode & 0x7f];
160
        }
161
        if (s->scancode_set == 2) {
162
            keycode = ps2_raw_keycode[keycode & 0x7f];
163
        } else if (s->scancode_set == 3) {
164
            keycode = ps2_raw_keycode_set3[keycode & 0x7f];
165
        }
152 166
      }
153 167
    ps2_queue(&s->common, keycode);
154 168
}

Also available in: Unified diff