Changeset 19a1800 in mainline for uspace/srv/hid/console/console.c
- Timestamp:
- 2011-03-01T22:20:56Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e24e7b1
- Parents:
- 976f546 (diff), ac8285d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/console/console.c
r976f546 r19a1800 34 34 35 35 #include <libc.h> 36 #include <ipc/ipc.h>37 36 #include <ipc/kbd.h> 38 37 #include <io/keycode.h> … … 40 39 #include <ipc/fb.h> 41 40 #include <ipc/services.h> 41 #include <ipc/ns.h> 42 42 #include <errno.h> 43 43 #include <ipc/console.h> … … 116 116 static void curs_hide_sync(void) 117 117 { 118 ipc_call_sync_1_0(fb_info.phone, FB_CURSOR_VISIBILITY, false);118 async_req_1_0(fb_info.phone, FB_CURSOR_VISIBILITY, false); 119 119 } 120 120 … … 131 131 static void screen_yield(void) 132 132 { 133 ipc_call_sync_0_0(fb_info.phone, FB_SCREEN_YIELD);133 async_req_0_0(fb_info.phone, FB_SCREEN_YIELD); 134 134 } 135 135 136 136 static void screen_reclaim(void) 137 137 { 138 ipc_call_sync_0_0(fb_info.phone, FB_SCREEN_RECLAIM);138 async_req_0_0(fb_info.phone, FB_SCREEN_RECLAIM); 139 139 } 140 140 141 141 static void kbd_yield(void) 142 142 { 143 ipc_call_sync_0_0(kbd_phone, KBD_YIELD);143 async_req_0_0(kbd_phone, KBD_YIELD); 144 144 } 145 145 146 146 static void kbd_reclaim(void) 147 147 { 148 ipc_call_sync_0_0(kbd_phone, KBD_RECLAIM);148 async_req_0_0(kbd_phone, KBD_RECLAIM); 149 149 } 150 150 … … 438 438 retval = ENOENT; 439 439 } 440 ipc_answer_0(callid, retval);440 async_answer_0(callid, retval); 441 441 } 442 442 } … … 474 474 } 475 475 476 ipc_answer_0(callid, retval);476 async_answer_0(callid, retval); 477 477 } 478 478 } … … 485 485 486 486 if (rc != EOK) { 487 ipc_answer_0(rid, rc);487 async_answer_0(rid, rc); 488 488 return; 489 489 } … … 500 500 501 501 gcons_notify_char(cons->index); 502 ipc_answer_1(rid, EOK, size);502 async_answer_1(rid, EOK, size); 503 503 504 504 free(buf); … … 510 510 size_t size; 511 511 if (!async_data_read_receive(&callid, &size)) { 512 ipc_answer_0(callid, EINVAL);513 ipc_answer_0(rid, EINVAL);512 async_answer_0(callid, EINVAL); 513 async_answer_0(rid, EINVAL); 514 514 return; 515 515 } … … 517 517 char *buf = (char *) malloc(size); 518 518 if (buf == NULL) { 519 ipc_answer_0(callid, ENOMEM);520 ipc_answer_0(rid, ENOMEM);519 async_answer_0(callid, ENOMEM); 520 async_answer_0(rid, ENOMEM); 521 521 return; 522 522 } … … 536 536 if (pos == size) { 537 537 (void) async_data_read_finalize(callid, buf, size); 538 ipc_answer_1(rid, EOK, size);538 async_answer_1(rid, EOK, size); 539 539 free(buf); 540 540 } else { … … 554 554 recheck: 555 555 if (keybuffer_pop(&cons->keybuffer, &ev)) { 556 ipc_answer_4(rid, EOK, ev.type, ev.key, ev.mods, ev.c);556 async_answer_4(rid, EOK, ev.type, ev.key, ev.mods, ev.c); 557 557 } else { 558 558 fibril_condvar_wait(&input_cv, &input_mutex); … … 580 580 581 581 if (cons == NULL) { 582 ipc_answer_0(iid, ENOENT);582 async_answer_0(iid, ENOENT); 583 583 return; 584 584 } … … 599 599 600 600 /* Accept the connection */ 601 ipc_answer_0(iid, EOK);601 async_answer_0(iid, EOK); 602 602 603 603 while (true) { … … 659 659 rc = ccap_fb_to_con(fb_info.color_cap, &arg1); 660 660 if (rc != EOK) { 661 ipc_answer_0(callid, rc);661 async_answer_0(callid, rc); 662 662 continue; 663 663 } … … 703 703 break; 704 704 } 705 ipc_answer_3(callid, EOK, arg1, arg2, arg3);705 async_answer_3(callid, EOK, arg1, arg2, arg3); 706 706 } 707 707 } … … 727 727 /* NB: The callback connection is slotted for removal */ 728 728 sysarg_t phonehash; 729 sysarg_t taskhash; 729 730 int rc = async_req_3_5(phone, IPC_M_CONNECT_TO_ME, SERVICE_CONSOLE, 730 0, 0, NULL, NULL, NULL, NULL, &phonehash);731 0, 0, NULL, NULL, NULL, &taskhash, &phonehash); 731 732 if (rc != EOK) { 732 733 printf(NAME ": Failed to create callback from input device\n"); … … 734 735 } 735 736 736 async_new_connection( phonehash, 0, NULL, keyboard_events);737 async_new_connection(taskhash, phonehash, 0, NULL, keyboard_events); 737 738 738 739 printf(NAME ": we got a hit (new keyboard \"%s\").\n", path); … … 761 762 if (retval != EOK) { 762 763 async_wait_for(req, NULL); 763 ipc_hangup(devmap_phone);764 async_hangup(devmap_phone); 764 765 return retval; 765 766 } … … 768 769 769 770 if (retval != EOK) { 770 ipc_hangup(devmap_phone);771 async_hangup(devmap_phone); 771 772 return retval; 772 773 } … … 774 775 devmap_handle_t handle = (devmap_handle_t) IPC_GET_ARG1(answer); 775 776 776 ipc_hangup(devmap_phone);777 async_hangup(devmap_phone); 777 778 778 779 int phone = async_connect_me_to(PHONE_NS, … … 784 785 /* NB: The callback connection is slotted for removal */ 785 786 sysarg_t phonehash; 787 sysarg_t taskhash; 786 788 int rc = async_req_3_5(phone, IPC_M_CONNECT_TO_ME, SERVICE_CONSOLE, 787 0, 0, NULL, NULL, NULL, NULL, &phonehash);789 0, 0, NULL, NULL, NULL, &taskhash, &phonehash); 788 790 if (rc != EOK) { 789 791 printf(NAME ": Failed to create callback from input device\n"); … … 791 793 } 792 794 793 async_new_connection( phonehash, 0, NULL, keyboard_events);795 async_new_connection(taskhash, phonehash, 0, NULL, keyboard_events); 794 796 795 797 printf(NAME ": we got a hit (new keyboard \"/dev/%s\").\n", … … 862 864 } 863 865 864 sysarg_t phonehash;865 if (ipc_connect_to_me(mouse_phone, SERVICE_CONSOLE, 0, 0, &phonehash)!= 0) {866 if (async_connect_to_me(mouse_phone, SERVICE_CONSOLE, 0, 0, mouse_events) 867 != 0) { 866 868 printf(NAME ": Failed to create callback from mouse device\n"); 867 869 mouse_phone = -1; … … 869 871 } 870 872 871 async_new_connection(phonehash, 0, NULL, mouse_events);872 873 skip_mouse: 873 874 874 875 /* Connect to framebuffer driver */ 875 fb_info.phone = ipc_connect_me_to_blocking(PHONE_NS,SERVICE_VIDEO, 0, 0);876 fb_info.phone = service_connect_blocking(SERVICE_VIDEO, 0, 0); 876 877 if (fb_info.phone < 0) { 877 878 printf(NAME ": Failed to connect to video service\n"); … … 949 950 950 951 /* Receive kernel notifications */ 952 async_set_interrupt_received(interrupt_received); 951 953 if (event_subscribe(EVENT_KCONSOLE, 0) != EOK) 952 954 printf(NAME ": Error registering kconsole notifications\n"); 953 954 async_set_interrupt_received(interrupt_received);955 955 956 956 /* Start fibril for checking on hot-plugged keyboards. */
Note:
See TracChangeset
for help on using the changeset viewer.