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