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