Changeset ffa2c8ef in mainline for uspace/srv/hid/console/console.c
- Timestamp:
- 2011-01-29T11:36:08Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 46b881c
- Parents:
- 64d2b10
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/console/console.c
r64d2b10 rffa2c8ef 34 34 35 35 #include <libc.h> 36 #include <ipc/ipc.h>37 36 #include <ipc/kbd.h> 38 37 #include <io/keycode.h> … … 117 116 static void curs_hide_sync(void) 118 117 { 119 ipc_call_sync_1_0(fb_info.phone, FB_CURSOR_VISIBILITY, false);118 async_req_1_0(fb_info.phone, FB_CURSOR_VISIBILITY, false); 120 119 } 121 120 … … 132 131 static void screen_yield(void) 133 132 { 134 ipc_call_sync_0_0(fb_info.phone, FB_SCREEN_YIELD);133 async_req_0_0(fb_info.phone, FB_SCREEN_YIELD); 135 134 } 136 135 137 136 static void screen_reclaim(void) 138 137 { 139 ipc_call_sync_0_0(fb_info.phone, FB_SCREEN_RECLAIM);138 async_req_0_0(fb_info.phone, FB_SCREEN_RECLAIM); 140 139 } 141 140 142 141 static void kbd_yield(void) 143 142 { 144 ipc_call_sync_0_0(kbd_phone, KBD_YIELD);143 async_req_0_0(kbd_phone, KBD_YIELD); 145 144 } 146 145 147 146 static void kbd_reclaim(void) 148 147 { 149 ipc_call_sync_0_0(kbd_phone, KBD_RECLAIM);148 async_req_0_0(kbd_phone, KBD_RECLAIM); 150 149 } 151 150 … … 438 437 retval = ENOENT; 439 438 } 440 ipc_answer_0(callid, retval);439 async_answer_0(callid, retval); 441 440 } 442 441 } … … 473 472 } 474 473 475 ipc_answer_0(callid, retval);474 async_answer_0(callid, retval); 476 475 } 477 476 } … … 484 483 485 484 if (rc != EOK) { 486 ipc_answer_0(rid, rc);485 async_answer_0(rid, rc); 487 486 return; 488 487 } … … 499 498 500 499 gcons_notify_char(cons->index); 501 ipc_answer_1(rid, EOK, size);500 async_answer_1(rid, EOK, size); 502 501 503 502 free(buf); … … 509 508 size_t size; 510 509 if (!async_data_read_receive(&callid, &size)) { 511 ipc_answer_0(callid, EINVAL);512 ipc_answer_0(rid, EINVAL);510 async_answer_0(callid, EINVAL); 511 async_answer_0(rid, EINVAL); 513 512 return; 514 513 } … … 516 515 char *buf = (char *) malloc(size); 517 516 if (buf == NULL) { 518 ipc_answer_0(callid, ENOMEM);519 ipc_answer_0(rid, ENOMEM);517 async_answer_0(callid, ENOMEM); 518 async_answer_0(rid, ENOMEM); 520 519 return; 521 520 } … … 535 534 if (pos == size) { 536 535 (void) async_data_read_finalize(callid, buf, size); 537 ipc_answer_1(rid, EOK, size);536 async_answer_1(rid, EOK, size); 538 537 free(buf); 539 538 } else { … … 553 552 recheck: 554 553 if (keybuffer_pop(&cons->keybuffer, &ev)) { 555 ipc_answer_4(rid, EOK, ev.type, ev.key, ev.mods, ev.c);554 async_answer_4(rid, EOK, ev.type, ev.key, ev.mods, ev.c); 556 555 } else { 557 556 fibril_condvar_wait(&input_cv, &input_mutex); … … 579 578 580 579 if (cons == NULL) { 581 ipc_answer_0(iid, ENOENT);580 async_answer_0(iid, ENOENT); 582 581 return; 583 582 } … … 598 597 599 598 /* Accept the connection */ 600 ipc_answer_0(iid, EOK);599 async_answer_0(iid, EOK); 601 600 602 601 while (true) { … … 658 657 rc = ccap_fb_to_con(fb_info.color_cap, &arg1); 659 658 if (rc != EOK) { 660 ipc_answer_0(callid, rc);659 async_answer_0(callid, rc); 661 660 continue; 662 661 } … … 702 701 break; 703 702 } 704 ipc_answer_3(callid, EOK, arg1, arg2, arg3);703 async_answer_3(callid, EOK, arg1, arg2, arg3); 705 704 } 706 705 } … … 727 726 728 727 /* NB: The callback connection is slotted for removal */ 729 sysarg_t taskhash; 730 sysarg_t phonehash; 731 if (ipc_connect_to_me(kbd_phone, SERVICE_CONSOLE, 0, 0, &taskhash, 732 &phonehash) != 0) { 728 if (async_connect_to_me(kbd_phone, SERVICE_CONSOLE, 0, 0, keyboard_events) 729 != 0) { 733 730 printf(NAME ": Failed to create callback from input device\n"); 734 731 return false; 735 732 } 736 737 async_new_connection(taskhash, phonehash, 0, NULL, keyboard_events);738 733 739 734 /* Connect to mouse device */ … … 752 747 } 753 748 754 if ( ipc_connect_to_me(mouse_phone, SERVICE_CONSOLE, 0, 0, &taskhash,755 &phonehash)!= 0) {749 if (async_connect_to_me(mouse_phone, SERVICE_CONSOLE, 0, 0, mouse_events) 750 != 0) { 756 751 printf(NAME ": Failed to create callback from mouse device\n"); 757 752 mouse_phone = -1; … … 759 754 } 760 755 761 async_new_connection(taskhash, phonehash, 0, NULL, mouse_events);762 756 skip_mouse: 763 757
Note:
See TracChangeset
for help on using the changeset viewer.