Changes in uspace/srv/hid/console/console.c [854eddd6:1875a0c] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/console/console.c
r854eddd6 r1875a0c 54 54 #include <event.h> 55 55 #include <devmap.h> 56 #include <devmap_obsolete.h>57 56 #include <fcntl.h> 58 57 #include <vfs/vfs.h> … … 68 67 #define NAMESPACE "term" 69 68 70 /** Phone tothe input server. */71 static int input_phone;69 /** Session with the input server. */ 70 static async_sess_t *input_sess; 72 71 73 72 /** Information about framebuffer */ … … 109 108 static FIBRIL_CONDVAR_INITIALIZE(input_cv); 110 109 110 static FIBRIL_MUTEX_INITIALIZE(big_console_lock); 111 112 static void console_serialize_start(void) 113 { 114 fibril_mutex_lock(&big_console_lock); 115 } 116 117 static void console_serialize_end(void) 118 { 119 fibril_mutex_unlock(&big_console_lock); 120 } 121 111 122 static void curs_visibility(bool visible) 112 123 { … … 141 152 static void input_yield(void) 142 153 { 143 async_obsolete_req_0_0(input_phone, INPUT_YIELD); 154 async_exch_t *exch = async_exchange_begin(input_sess); 155 if (exch == NULL) { 156 printf("%s: Failed starting exchange with input device.\n", 157 NAME); 158 return; 159 } 160 161 async_req_0_0(exch, INPUT_YIELD); 162 async_exchange_end(exch); 144 163 } 145 164 146 165 static void input_reclaim(void) 147 166 { 148 async_obsolete_req_0_0(input_phone, INPUT_RECLAIM); 167 async_exch_t *exch = async_exchange_begin(input_sess); 168 if (exch == NULL) { 169 printf("%s: Failed starting exchange with input device.\n", 170 NAME); 171 return; 172 } 173 174 async_req_0_0(exch, INPUT_RECLAIM); 175 async_exchange_end(exch); 149 176 } 150 177 … … 323 350 324 351 if (cons == kernel_console) { 325 async_obsolete_serialize_start();352 console_serialize_start(); 326 353 curs_hide_sync(); 327 354 gcons_in_kernel(); 328 355 screen_yield(); 329 356 input_yield(); 330 async_obsolete_serialize_end();357 console_serialize_end(); 331 358 332 359 if (__SYSCALL0(SYS_DEBUG_ENABLE_CONSOLE)) { … … 338 365 339 366 if (cons != kernel_console) { 340 async_obsolete_serialize_start();367 console_serialize_start(); 341 368 342 369 if (active_console == kernel_console) { … … 393 420 curs_visibility(cons->scr.is_cursor_visible); 394 421 395 async_obsolete_serialize_end();422 console_serialize_end(); 396 423 } 397 424 } … … 410 437 if (!IPC_GET_IMETHOD(call)) { 411 438 /* TODO: Handle hangup */ 412 async_ obsolete_hangup(input_phone);439 async_hangup(input_sess); 413 440 return; 414 441 } … … 455 482 retval = ENOENT; 456 483 } 484 457 485 async_answer_0(callid, retval); 458 486 } … … 470 498 } 471 499 472 async_obsolete_serialize_start();500 console_serialize_start(); 473 501 474 502 size_t off = 0; … … 478 506 } 479 507 480 async_obsolete_serialize_end();508 console_serialize_end(); 481 509 482 510 gcons_notify_char(cons->index); … … 573 601 int rc; 574 602 575 async_obsolete_serialize_start();603 console_serialize_start(); 576 604 if (cons->refcount == 0) 577 605 gcons_notify_connect(cons->index); … … 583 611 584 612 while (true) { 585 async_obsolete_serialize_end();613 console_serialize_end(); 586 614 callid = async_get_call(&call); 587 async_obsolete_serialize_start();615 console_serialize_start(); 588 616 589 617 arg1 = 0; … … 595 623 if (cons->refcount == 0) 596 624 gcons_notify_disconnect(cons->index); 625 console_serialize_end(); 597 626 return; 598 627 } … … 600 629 switch (IPC_GET_IMETHOD(call)) { 601 630 case VFS_OUT_READ: 602 async_obsolete_serialize_end();631 console_serialize_end(); 603 632 cons_read(cons, callid, &call); 604 async_obsolete_serialize_start();633 console_serialize_start(); 605 634 continue; 606 635 case VFS_OUT_WRITE: 607 async_obsolete_serialize_end();636 console_serialize_end(); 608 637 cons_write(cons, callid, &call); 609 async_obsolete_serialize_start();638 console_serialize_start(); 610 639 continue; 611 640 case VFS_OUT_SYNC: … … 678 707 break; 679 708 case CONSOLE_GET_EVENT: 680 async_obsolete_serialize_end();709 console_serialize_end(); 681 710 cons_get_event(cons, callid, &call); 682 async_obsolete_serialize_start();711 console_serialize_start(); 683 712 continue; 684 713 case CONSOLE_KCON_ENABLE: … … 695 724 } 696 725 697 static int connect_input(const char *dev_path) 698 { 699 int phone; 726 static async_sess_t *connect_input(const char *dev_path) 727 { 728 async_sess_t *sess; 729 async_exch_t *exch; 700 730 devmap_handle_t handle; 701 731 702 732 int rc = devmap_device_get_handle(dev_path, &handle, 0); 703 733 if (rc == EOK) { 704 phone = devmap_obsolete_device_connect(handle, 0);705 if ( phone < 0) {706 printf("%s: Failed to connect to input device\n", NAME);707 return phone;734 sess = devmap_device_connect(EXCHANGE_ATOMIC, handle, 0); 735 if (sess == NULL) { 736 printf("%s: Failed to connect to input server\n", NAME); 737 return NULL; 708 738 } 709 739 } else { 710 return rc; 740 return NULL; 741 } 742 743 exch = async_exchange_begin(sess); 744 if (exch == NULL) { 745 printf("%s: Failed to create callback from input server.\n", NAME); 746 return NULL; 711 747 } 712 748 713 749 /* NB: The callback connection is slotted for removal */ 714 rc = async_obsolete_connect_to_me(phone, SERVICE_CONSOLE, 0, 0, 715 input_events, NULL); 750 rc = async_connect_to_me(exch, 0, 0, 0, input_events, NULL); 751 752 async_exchange_end(exch); 716 753 717 754 if (rc != EOK) { 718 async_ obsolete_hangup(phone);719 printf("%s: Failed to create callback from input device(%s).\n",755 async_hangup(sess); 756 printf("%s: Failed to create callback from input server (%s).\n", 720 757 NAME, str_error(rc)); 721 return rc;722 } 723 724 return phone;758 return NULL; 759 } 760 761 return sess; 725 762 } 726 763 … … 728 765 { 729 766 /* Connect to input server */ 730 input_ phone= connect_input(input_dev);731 if (input_ phone < 0)767 input_sess = connect_input(input_dev); 768 if (input_sess == NULL) 732 769 return false; 733 770 … … 800 837 801 838 /* Initialize the screen */ 802 async_obsolete_serialize_start();839 console_serialize_start(); 803 840 gcons_redraw_console(); 804 841 set_style(STYLE_NORMAL); … … 806 843 curs_goto(0, 0); 807 844 curs_visibility(active_console->scr.is_cursor_visible); 808 async_obsolete_serialize_end();845 console_serialize_end(); 809 846 810 847 /* Receive kernel notifications */
Note:
See TracChangeset
for help on using the changeset viewer.