Rev 4341 | Rev 4345 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4341 | Rev 4343 | ||
---|---|---|---|
Line 33... | Line 33... | ||
33 | */ |
33 | */ |
34 | 34 | ||
35 | #include <libc.h> |
35 | #include <libc.h> |
36 | #include <fb.h> |
36 | #include <fb.h> |
37 | #include <ipc/ipc.h> |
37 | #include <ipc/ipc.h> |
38 | #include <keys.h> |
38 | #include <kbd.h> |
- | 39 | #include <kbd/keycode.h> |
|
39 | #include <ipc/fb.h> |
40 | #include <ipc/fb.h> |
40 | #include <ipc/services.h> |
41 | #include <ipc/services.h> |
41 | #include <errno.h> |
42 | #include <errno.h> |
42 | #include <key_buffer.h> |
43 | #include <key_buffer.h> |
43 | #include <ipc/console.h> |
44 | #include <ipc/console.h> |
Line 295... | Line 296... | ||
295 | static void keyboard_events(ipc_callid_t iid, ipc_call_t *icall) |
296 | static void keyboard_events(ipc_callid_t iid, ipc_call_t *icall) |
296 | { |
297 | { |
297 | ipc_callid_t callid; |
298 | ipc_callid_t callid; |
298 | ipc_call_t call; |
299 | ipc_call_t call; |
299 | int retval; |
300 | int retval; |
300 | int c; |
301 | kbd_event_t ev; |
301 | connection_t *conn; |
302 | connection_t *conn; |
302 | int newcon; |
303 | int newcon; |
303 | 304 | ||
304 | /* Ignore parameters, the connection is alread opened */ |
305 | /* Ignore parameters, the connection is alread opened */ |
305 | while (1) { |
306 | while (1) { |
Line 317... | Line 318... | ||
317 | case KBD_MS_MOVE: |
318 | case KBD_MS_MOVE: |
318 | gcons_mouse_move(IPC_GET_ARG1(call), |
319 | gcons_mouse_move(IPC_GET_ARG1(call), |
319 | IPC_GET_ARG2(call)); |
320 | IPC_GET_ARG2(call)); |
320 | retval = 0; |
321 | retval = 0; |
321 | break; |
322 | break; |
322 | case KBD_PUSHCHAR: |
323 | case KBD_EVENT: |
323 | /* got key from keyboard driver */ |
324 | /* Got event from keyboard driver. */ |
324 | retval = 0; |
325 | retval = 0; |
- | 326 | ev.type = IPC_GET_ARG1(call); |
|
- | 327 | ev.key = IPC_GET_ARG2(call); |
|
- | 328 | ev.mods = IPC_GET_ARG3(call); |
|
325 | c = IPC_GET_ARG1(call); |
329 | ev.c = IPC_GET_ARG4(call); |
- | 330 | ||
326 | /* switch to another virtual console */ |
331 | /* switch to another virtual console */ |
327 | 332 | ||
328 | conn = &connections[active_console]; |
333 | conn = &connections[active_console]; |
329 | /* |
334 | |
330 | * if ((c >= KBD_KEY_F1) && (c < KBD_KEY_F1 + |
335 | if ((ev.key >= KC_F1) && (ev.key < KC_F1 + |
331 | * CONSOLE_COUNT)) { |
336 | CONSOLE_COUNT)) { |
332 | */ |
- | |
333 | if ((c >= 0x101) && (c < 0x101 + CONSOLE_COUNT)) { |
- | |
334 | if (c == 0x112) |
337 | if (ev.key == KC_F12) |
335 | change_console(KERNEL_CONSOLE); |
338 | change_console(KERNEL_CONSOLE); |
336 | else |
339 | else |
337 | change_console(c - 0x101); |
340 | change_console(ev.key - KC_F1); |
338 | break; |
341 | break; |
339 | } |
342 | } |
340 | 343 | ||
341 | /* if client is awaiting key, send it */ |
344 | /* if client is awaiting key, send it */ |
342 | if (conn->keyrequest_counter > 0) { |
345 | if (conn->keyrequest_counter > 0) { |
343 | conn->keyrequest_counter--; |
346 | conn->keyrequest_counter--; |
344 | ipc_answer_1(fifo_pop(conn->keyrequests), EOK, |
347 | ipc_answer_4(fifo_pop(conn->keyrequests), EOK, |
345 | c); |
348 | ev.type, ev.key, ev.mods, ev.c); |
346 | break; |
349 | break; |
347 | } |
350 | } |
348 | 351 | ||
349 | keybuffer_push(&conn->keybuffer, c); |
352 | keybuffer_push(&conn->keybuffer, &ev); |
350 | retval = 0; |
353 | retval = 0; |
351 | 354 | ||
352 | break; |
355 | break; |
353 | default: |
356 | default: |
354 | retval = ENOENT; |
357 | retval = ENOENT; |
355 | } |
358 | } |
356 | ipc_answer_0(callid, retval); |
359 | ipc_answer_0(callid, retval); |
Line 361... | Line 364... | ||
361 | static void client_connection(ipc_callid_t iid, ipc_call_t *icall) |
364 | static void client_connection(ipc_callid_t iid, ipc_call_t *icall) |
362 | { |
365 | { |
363 | ipc_callid_t callid; |
366 | ipc_callid_t callid; |
364 | ipc_call_t call; |
367 | ipc_call_t call; |
365 | int consnum; |
368 | int consnum; |
366 | ipcarg_t arg1, arg2, arg3; |
369 | ipcarg_t arg1, arg2, arg3, arg4; |
367 | connection_t *conn; |
370 | connection_t *conn; |
368 | 371 | ||
369 | if ((consnum = find_free_connection()) == -1) { |
372 | if ((consnum = find_free_connection()) == -1) { |
370 | ipc_answer_0(iid, ELIMIT); |
373 | ipc_answer_0(iid, ELIMIT); |
371 | return; |
374 | return; |
Line 386... | Line 389... | ||
386 | callid = async_get_call(&call); |
389 | callid = async_get_call(&call); |
387 | async_serialize_start(); |
390 | async_serialize_start(); |
388 | 391 | ||
389 | arg1 = 0; |
392 | arg1 = 0; |
390 | arg2 = 0; |
393 | arg2 = 0; |
- | 394 | arg3 = 0; |
|
- | 395 | arg4 = 0; |
|
- | 396 | ||
391 | switch (IPC_GET_METHOD(call)) { |
397 | switch (IPC_GET_METHOD(call)) { |
392 | case IPC_M_PHONE_HUNGUP: |
398 | case IPC_M_PHONE_HUNGUP: |
393 | gcons_notify_disconnect(consnum); |
399 | gcons_notify_disconnect(consnum); |
394 | 400 | ||
395 | /* Answer all pending requests */ |
401 | /* Answer all pending requests */ |
Line 456... | Line 462... | ||
456 | arg1 = IPC_GET_ARG1(call); |
462 | arg1 = IPC_GET_ARG1(call); |
457 | conn->screenbuffer.is_cursor_visible = arg1; |
463 | conn->screenbuffer.is_cursor_visible = arg1; |
458 | if (consnum == active_console) |
464 | if (consnum == active_console) |
459 | curs_visibility(arg1); |
465 | curs_visibility(arg1); |
460 | break; |
466 | break; |
461 | case CONSOLE_GETCHAR: |
467 | case CONSOLE_GETKEY: |
462 | if (keybuffer_empty(&conn->keybuffer)) { |
468 | if (keybuffer_empty(&conn->keybuffer)) { |
463 | /* buffer is empty -> store request */ |
469 | /* buffer is empty -> store request */ |
464 | if (conn->keyrequest_counter < |
470 | if (conn->keyrequest_counter < |
465 | MAX_KEYREQUESTS_BUFFERED) { |
471 | MAX_KEYREQUESTS_BUFFERED) { |
466 | fifo_push(conn->keyrequests, callid); |
472 | fifo_push(conn->keyrequests, callid); |
Line 472... | Line 478... | ||
472 | */ |
478 | */ |
473 | ipc_answer_0(callid, ELIMIT); |
479 | ipc_answer_0(callid, ELIMIT); |
474 | } |
480 | } |
475 | continue; |
481 | continue; |
476 | } |
482 | } |
477 | int ch; |
483 | kbd_event_t ev; |
478 | keybuffer_pop(&conn->keybuffer, &ch); |
484 | keybuffer_pop(&conn->keybuffer, &ev); |
- | 485 | arg1 = ev.type; |
|
- | 486 | arg2 = ev.key; |
|
- | 487 | arg3 = ev.mods; |
|
479 | arg1 = ch; |
488 | arg4 = ev.c; |
480 | break; |
489 | break; |
481 | } |
490 | } |
482 | ipc_answer_2(callid, EOK, arg1, arg2); |
491 | ipc_answer_4(callid, EOK, arg1, arg2, arg3, arg4); |
483 | } |
492 | } |
484 | } |
493 | } |
485 | 494 | ||
486 | static void interrupt_received(ipc_callid_t callid, ipc_call_t *call) |
495 | static void interrupt_received(ipc_callid_t callid, ipc_call_t *call) |
487 | { |
496 | { |