Subversion Repositories HelenOS

Rev

Rev 4346 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4346 Rev 4691
Line 30... Line 30...
30
 * @ingroup kbd
30
 * @ingroup kbd
31
 * @{
31
 * @{
32
 */
32
 */
33
/**
33
/**
34
 * @file
34
 * @file
35
 * @brief   PC keyboard controller driver.
35
 * @brief PC keyboard controller driver.
36
 */
36
 */
37
 
37
 
38
#include <kbd.h>
38
#include <kbd.h>
39
#include <kbd/kbd.h>
39
#include <io/console.h>
40
#include <kbd/keycode.h>
40
#include <io/keycode.h>
41
#include <kbd_ctl.h>
41
#include <kbd_ctl.h>
42
#include <gsp.h>
42
#include <gsp.h>
43
 
43
 
44
enum dec_state {
44
enum dec_state {
45
    ds_s,
45
    ds_s,
Line 186... Line 186...
186
    return 0;
186
    return 0;
187
}
187
}
188
 
188
 
189
void kbd_ctl_parse_scancode(int scancode)
189
void kbd_ctl_parse_scancode(int scancode)
190
{
190
{
191
    kbd_ev_type_t type;
191
    console_ev_type_t type;
192
    unsigned int key;
192
    unsigned int key;
193
    int *map;
193
    int *map;
194
    size_t map_length;
194
    size_t map_length;
195
 
195
 
196
    if (scancode == 0xe0) {
196
    if (scancode == 0xe0) {
Line 205... Line 205...
205
        break;
205
        break;
206
    case ds_e:
206
    case ds_e:
207
        map = scanmap_e0;
207
        map = scanmap_e0;
208
        map_length = sizeof(scanmap_e0) / sizeof(int);
208
        map_length = sizeof(scanmap_e0) / sizeof(int);
209
        break;
209
        break;
-
 
210
    default:
-
 
211
        map = NULL;
-
 
212
        map_length = 0;
210
    }
213
    }
211
 
214
 
212
    ds = ds_s;
215
    ds = ds_s;
213
 
216
 
214
    if (scancode & 0x80) {
217
    if (scancode & 0x80) {
215
        scancode &= ~0x80;
218
        scancode &= ~0x80;
216
        type = KE_RELEASE;
219
        type = KEY_RELEASE;
217
    } else {
220
    } else {
218
        type = KE_PRESS;
221
        type = KEY_PRESS;
219
    }
222
    }
220
 
223
 
221
    if (scancode < 0 || scancode >= map_length)
224
    if ((scancode < 0) || ((size_t) scancode >= map_length))
222
        return;
225
        return;
223
 
226
 
224
    key = map[scancode];
227
    key = map[scancode];
225
    if (key != 0)
228
    if (key != 0)
226
        kbd_push_ev(type, key);
229
        kbd_push_ev(type, key);