Subversion Repositories HelenOS-historic

Rev

Rev 1504 | Rev 1566 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1504 Rev 1560
Line 55... Line 55...
55
#define SC_DOWNARR      0x50
55
#define SC_DOWNARR      0x50
56
#define SC_DELETE       0x53
56
#define SC_DELETE       0x53
57
#define SC_HOME         0x47
57
#define SC_HOME         0x47
58
#define SC_END          0x4f
58
#define SC_END          0x4f
59
 
59
 
-
 
60
#define FUNCTION_KEYS 0x100
-
 
61
 
60
static volatile int keyflags;       /**< Tracking of multiple keypresses. */
62
static volatile int keyflags;       /**< Tracking of multiple keypresses. */
61
static volatile int lockflags;      /**< Tracking of multiple keys lockings. */
63
static volatile int lockflags;      /**< Tracking of multiple keys lockings. */
62
 
64
 
63
/** Primary meaning of scancodes. */
65
/** Primary meaning of scancodes. */
64
static char sc_primary_map[] = {
66
static int sc_primary_map[] = {
65
    SPECIAL, /* 0x00 */
67
    SPECIAL, /* 0x00 */
66
    SPECIAL, /* 0x01 - Esc */
68
    SPECIAL, /* 0x01 - Esc */
67
    '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=',
69
    '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=',
68
    '\b', /* 0x0e - Backspace */
70
    '\b', /* 0x0e - Backspace */
69
    '\t', 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', '\n',
71
    '\t', 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', '\n',
Line 76... Line 78...
76
    SPECIAL, /* 0x36 - RShift */
78
    SPECIAL, /* 0x36 - RShift */
77
    '*',
79
    '*',
78
    SPECIAL, /* 0x38 - LAlt */
80
    SPECIAL, /* 0x38 - LAlt */
79
    ' ',
81
    ' ',
80
    SPECIAL, /* 0x3a - CapsLock */
82
    SPECIAL, /* 0x3a - CapsLock */
81
    SPECIAL, /* 0x3b - F1 */
83
    (FUNCTION_KEYS | 1), /* 0x3b - F1 */
82
    SPECIAL, /* 0x3c - F2 */
84
    (FUNCTION_KEYS | 2), /* 0x3c - F2 */
83
    SPECIAL, /* 0x3d - F3 */
85
    (FUNCTION_KEYS | 3), /* 0x3d - F3 */
84
    SPECIAL, /* 0x3e - F4 */
86
    (FUNCTION_KEYS | 4), /* 0x3e - F4 */
85
    SPECIAL, /* 0x3f - F5 */
87
    (FUNCTION_KEYS | 5), /* 0x3f - F5 */
86
    SPECIAL, /* 0x40 - F6 */
88
    (FUNCTION_KEYS | 6), /* 0x40 - F6 */
87
    SPECIAL, /* 0x41 - F7 */
89
    (FUNCTION_KEYS | 7), /* 0x41 - F7 */
88
    SPECIAL, /* 0x42 - F8 */
90
    (FUNCTION_KEYS | 8), /* 0x42 - F8 */
89
    SPECIAL, /* 0x43 - F9 */
91
    (FUNCTION_KEYS | 9), /* 0x43 - F9 */
90
    SPECIAL, /* 0x44 - F10 */
92
    (FUNCTION_KEYS | 10), /* 0x44 - F10 */
91
    SPECIAL, /* 0x45 - NumLock */
93
    SPECIAL, /* 0x45 - NumLock */
92
    SPECIAL, /* 0x46 - ScrollLock */
94
    SPECIAL, /* 0x46 - ScrollLock */
93
    '7', '8', '9', '-',
95
    '7', '8', '9', '-',
94
    '4', '5', '6', '+',
96
    '4', '5', '6', '+',
95
    '1', '2', '3',
97
    '1', '2', '3',
96
    '0', '.',
98
    '0', '.',
97
    SPECIAL, /* 0x54 - Alt-SysRq */
99
    SPECIAL, /* 0x54 - Alt-SysRq */
98
    SPECIAL, /* 0x55 - F11/F12/PF1/FN */
100
    SPECIAL, /* 0x55 - F11/F12/PF1/FN */
99
    SPECIAL, /* 0x56 - unlabelled key next to LAlt */
101
    SPECIAL, /* 0x56 - unlabelled key next to LAlt */
100
    SPECIAL, /* 0x57 - F11 */
102
    FUNCTION_KEYS | 11, /* 0x57 - F11 */
101
    SPECIAL, /* 0x58 - F12 */
103
    FUNCTION_KEYS | 12, /* 0x58 - F12 */
102
    SPECIAL, /* 0x59 */
104
    SPECIAL, /* 0x59 */
103
    SPECIAL, /* 0x5a */
105
    SPECIAL, /* 0x5a */
104
    SPECIAL, /* 0x5b */
106
    SPECIAL, /* 0x5b */
105
    SPECIAL, /* 0x5c */
107
    SPECIAL, /* 0x5c */
106
    SPECIAL, /* 0x5d */
108
    SPECIAL, /* 0x5d */
Line 248... Line 250...
248
    }
250
    }
249
}
251
}
250
 
252
 
251
static int key_pressed(keybuffer_t *keybuffer, unsigned char key)
253
static int key_pressed(keybuffer_t *keybuffer, unsigned char key)
252
{
254
{
253
    char *map = sc_primary_map;
255
    int *map = sc_primary_map;
254
    char ascii = sc_primary_map[key];
256
    int ascii = sc_primary_map[key];
255
    char shift, capslock;
257
    int shift, capslock;
256
    char letter = 0;
258
    int letter = 0;
257
 
259
 
258
    switch (key) {
260
    switch (key) {
259
        case SC_LSHIFT:
261
        case SC_LSHIFT:
260
        case SC_RSHIFT:
262
        case SC_RSHIFT:
261
                keyflags |= PRESSED_SHIFT;
263
                keyflags |= PRESSED_SHIFT;