Changes in uspace/srv/hid/console/console.c [1875a0c:854eddd6] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/console/console.c
r1875a0c 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();330 async_obsolete_serialize_end(); 358 331 359 332 if (__SYSCALL0(SYS_DEBUG_ENABLE_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; 713 684 case CONSOLE_KCON_ENABLE: … … 724 695 } 725 696 726 static async_sess_t *connect_input(const char *dev_path) 727 { 728 async_sess_t *sess; 729 async_exch_t *exch; 697 static int connect_input(const char *dev_path) 698 { 699 int phone; 730 700 devmap_handle_t handle; 731 701 732 702 int rc = devmap_device_get_handle(dev_path, &handle, 0); 733 703 if (rc == EOK) { 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;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; 738 708 } 739 709 } else { 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; 710 return rc; 747 711 } 748 712 749 713 /* NB: The callback connection is slotted for removal */ 750 rc = async_connect_to_me(exch, 0, 0, 0, input_events, NULL); 751 752 async_exchange_end(exch); 714 rc = async_obsolete_connect_to_me(phone, SERVICE_CONSOLE, 0, 0, 715 input_events, NULL); 753 716 754 717 if (rc != EOK) { 755 async_ hangup(sess);756 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", 757 720 NAME, str_error(rc)); 758 return NULL;759 } 760 761 return sess;721 return rc; 722 } 723 724 return phone; 762 725 } 763 726 … … 765 728 { 766 729 /* Connect to input server */ 767 input_ sess= connect_input(input_dev);768 if (input_ sess == NULL)730 input_phone = connect_input(input_dev); 731 if (input_phone < 0) 769 732 return false; 770 733 … … 837 800 838 801 /* Initialize the screen */ 839 console_serialize_start();802 async_obsolete_serialize_start(); 840 803 gcons_redraw_console(); 841 804 set_style(STYLE_NORMAL); … … 843 806 curs_goto(0, 0); 844 807 curs_visibility(active_console->scr.is_cursor_visible); 845 console_serialize_end();808 async_obsolete_serialize_end(); 846 809 847 810 /* Receive kernel notifications */
Note:
See TracChangeset
for help on using the changeset viewer.