Subversion Repositories HelenOS

Rev

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

Rev 3343 Rev 3549
Line 32... Line 32...
32
 * @{
32
 * @{
33
 */
33
 */
34
/** @file
34
/** @file
35
 */
35
 */
36
#include <arch/kbd.h>
36
#include <arch/kbd.h>
-
 
37
#include <genarch/nofb.h>
37
#include <ipc/ipc.h>
38
#include <ipc/ipc.h>
38
#include <sysinfo.h>
39
#include <sysinfo.h>
39
#include <kbd.h>
40
#include <kbd.h>
40
#include <keys.h>
41
#include <keys.h>
41
 
42
 
Line 97... Line 98...
97
{
98
{
98
        return "0123456789ABCDEF"[v];
99
        return "0123456789ABCDEF"[v];
99
}
100
}
100
*/
101
*/
101
 
102
 
102
static int kbd_arch_process_no_fb(keybuffer_t *keybuffer, int scan_code)
-
 
103
{
-
 
104
 
-
 
105
    static unsigned long buf = 0;
-
 
106
    static int count = 0;  
-
 
107
 
-
 
108
    /* Please preserve this code (it can be used to determine scancodes)
-
 
109
   
-
 
110
    keybuffer_push(keybuffer, to_hex((scan_code>>4)&0xf));
-
 
111
    keybuffer_push(keybuffer, to_hex(scan_code&0xf));
-
 
112
    keybuffer_push(keybuffer, ' ');
-
 
113
    keybuffer_push(keybuffer, ' ');
-
 
114
   
-
 
115
    return 1;
-
 
116
    */
-
 
117
   
-
 
118
    if(scan_code == 0x7e) {
-
 
119
        switch (buf) {
-
 
120
        case MSIM_KEY_F5:
-
 
121
            keybuffer_push(keybuffer,FUNCTION_KEYS | 5);
-
 
122
            buf = count = 0;
-
 
123
            return 1;
-
 
124
        case MSIM_KEY_F6:
-
 
125
            keybuffer_push(keybuffer,FUNCTION_KEYS | 6);
-
 
126
            buf = count = 0;
-
 
127
            return 1;
-
 
128
        case MSIM_KEY_F7:
-
 
129
            keybuffer_push(keybuffer,FUNCTION_KEYS | 7);
-
 
130
            buf = count = 0;
-
 
131
            return 1;
-
 
132
        case MSIM_KEY_F8:
-
 
133
            keybuffer_push(keybuffer,FUNCTION_KEYS | 8);
-
 
134
            buf = count = 0;
-
 
135
            return 1;
-
 
136
        case MSIM_KEY_F9:
-
 
137
            keybuffer_push(keybuffer,FUNCTION_KEYS | 9);
-
 
138
            buf = count = 0;
-
 
139
            return 1;
-
 
140
        case MSIM_KEY_F10:
-
 
141
            keybuffer_push(keybuffer,FUNCTION_KEYS | 10);
-
 
142
            buf = count = 0;
-
 
143
            return 1;
-
 
144
        case MSIM_KEY_F11:
-
 
145
            keybuffer_push(keybuffer,FUNCTION_KEYS | 11);
-
 
146
            buf = count = 0;
-
 
147
            return 1;
-
 
148
        case MSIM_KEY_F12:
-
 
149
            keybuffer_push(keybuffer,FUNCTION_KEYS | 12);
-
 
150
            buf = count = 0;
-
 
151
            return 1;
-
 
152
        default:
-
 
153
            keybuffer_push(keybuffer, buf & 0xff);
-
 
154
            keybuffer_push(keybuffer, (buf >> 8) &0xff);
-
 
155
            keybuffer_push(keybuffer, (buf >> 16) &0xff);
-
 
156
            keybuffer_push(keybuffer, (buf >> 24) &0xff);
-
 
157
            keybuffer_push(keybuffer, scan_code);
-
 
158
            buf = count = 0;
-
 
159
            return 1;
-
 
160
        }
-
 
161
    }
-
 
162
 
-
 
163
    buf |= ((unsigned long) scan_code)<<(8*(count++));
-
 
164
   
-
 
165
    if((buf & 0xff) != (MSIM_KEY_F1 & 0xff)) {
-
 
166
        keybuffer_push(keybuffer, buf);
-
 
167
        buf = count = 0;
-
 
168
        return 1;
-
 
169
    }
-
 
170
 
-
 
171
    if (count <= 1)
-
 
172
        return 1;
-
 
173
 
-
 
174
    if ((buf & 0xffff) != (MSIM_KEY_F1 & 0xffff)
-
 
175
        && (buf & 0xffff) != (MSIM_KEY_F5 & 0xffff) ) {
-
 
176
 
-
 
177
        keybuffer_push(keybuffer, buf & 0xff);
-
 
178
        keybuffer_push(keybuffer, (buf >> 8) &0xff);
-
 
179
        buf = count = 0;
-
 
180
        return 1;
-
 
181
    }
-
 
182
 
-
 
183
    if (count <= 2)
-
 
184
        return 1;
-
 
185
 
-
 
186
    switch (buf) {
-
 
187
    case MSIM_KEY_F1:
-
 
188
        keybuffer_push(keybuffer,FUNCTION_KEYS | 1);
-
 
189
        buf = count = 0;
-
 
190
        return 1;
-
 
191
    case MSIM_KEY_F2:
-
 
192
        keybuffer_push(keybuffer,FUNCTION_KEYS | 2);
-
 
193
        buf = count = 0;
-
 
194
        return 1;
-
 
195
    case MSIM_KEY_F3:
-
 
196
        keybuffer_push(keybuffer,FUNCTION_KEYS | 3);
-
 
197
        buf = count = 0;
-
 
198
        return 1;
-
 
199
    case MSIM_KEY_F4:
-
 
200
        keybuffer_push(keybuffer,FUNCTION_KEYS | 4);
-
 
201
        buf = count = 0;
-
 
202
        return 1;
-
 
203
    }
-
 
204
 
-
 
205
 
-
 
206
    if((buf & 0xffffff) != (MSIM_KEY_F5 & 0xffffff)
-
 
207
        && (buf & 0xffffff) != (MSIM_KEY_F9 & 0xffffff)) {
-
 
208
 
-
 
209
        keybuffer_push(keybuffer, buf & 0xff);
-
 
210
        keybuffer_push(keybuffer, (buf >> 8) & 0xff);
-
 
211
        keybuffer_push(keybuffer, (buf >> 16) & 0xff);
-
 
212
        buf=count=0;
-
 
213
        return 1;
-
 
214
    }
-
 
215
 
-
 
216
    if (count <= 3)
-
 
217
        return 1;
-
 
218
   
-
 
219
    switch (buf) {
-
 
220
    case MSIM_KEY_F5:
-
 
221
    case MSIM_KEY_F6:
-
 
222
    case MSIM_KEY_F7:
-
 
223
    case MSIM_KEY_F8:
-
 
224
    case MSIM_KEY_F9:
-
 
225
    case MSIM_KEY_F10:
-
 
226
    case MSIM_KEY_F11:
-
 
227
    case MSIM_KEY_F12:
-
 
228
        return 1;
-
 
229
    default:
-
 
230
        keybuffer_push(keybuffer, buf & 0xff);
-
 
231
        keybuffer_push(keybuffer, (buf >> 8) &0xff);
-
 
232
        keybuffer_push(keybuffer, (buf >> 16) &0xff);
-
 
233
        keybuffer_push(keybuffer, (buf >> 24) &0xff);
-
 
234
        buf = count = 0;
-
 
235
        return 1;
-
 
236
    }
-
 
237
    return 1;
-
 
238
}
-
 
239
 
-
 
240
 
-
 
241
 
-
 
242
static int kbd_arch_process_fb(keybuffer_t *keybuffer, int scan_code)
103
static int kbd_arch_process_fb(keybuffer_t *keybuffer, int scan_code)
243
{
104
{
244
    static unsigned long buf = 0;
105
    static unsigned long buf = 0;
245
    static int count = 0;
106
    static int count = 0;
246
 
107
 
Line 369... Line 230...
369
    }
230
    }
370
 
231
 
371
    if (fb_fb)
232
    if (fb_fb)
372
        return kbd_arch_process_fb(keybuffer, scan_code);
233
        return kbd_arch_process_fb(keybuffer, scan_code);
373
 
234
 
374
    return kbd_arch_process_no_fb(keybuffer, scan_code);
235
    return kbd_process_no_fb(keybuffer, scan_code);
375
}
236
}
376
/** @}
237
/** @}
377
*/
238
*/