Changes in uspace/srv/console/console.c [47a350f:cc1f8d4] in mainline
- File:
-
- 1 edited
-
uspace/srv/console/console.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/console/console.c
r47a350f rcc1f8d4 50 50 #include <event.h> 51 51 #include <devmap.h> 52 #include <fcntl.h> 53 #include <vfs/vfs.h> 54 #include <fibril_synch.h> 52 #include <fibril_sync.h> 55 53 56 54 #include "console.h" … … 59 57 #include "screenbuffer.h" 60 58 61 #define NAME "console" 62 #define NAMESPACE "term" 59 #define NAME "console" 60 61 #define MAX_DEVICE_NAME 32 63 62 64 63 /** Phone to the keyboard driver. */ … … 70 69 ipcarg_t cols; /**< Framebuffer columns */ 71 70 ipcarg_t rows; /**< Framebuffer rows */ 72 int color_cap; /**< Color capabilities (FB_CCAP_xxx) */71 int color_cap; /**< Color capabilities (FB_CCAP_xxx) */ 73 72 } fb_info; 74 73 … … 602 601 IPC_GET_ARG2(call)); 603 602 break; 604 case CONSOLE_GET_POS:605 arg1 = cons->scr.position_x;606 arg2 = cons->scr.position_y;607 break;608 603 case CONSOLE_GET_SIZE: 609 604 arg1 = fb_info.cols; … … 667 662 } 668 663 669 static bool console_init(char *input) 670 { 671 /* Connect to input device */ 672 int input_fd = open(input, O_RDONLY); 673 if (input_fd < 0) { 674 printf(NAME ": Failed opening %s\n", input); 664 static bool console_init(void) 665 { 666 ipcarg_t color_cap; 667 668 /* Connect to keyboard driver */ 669 kbd_phone = ipc_connect_me_to_blocking(PHONE_NS, SERVICE_KEYBOARD, 0, 0); 670 if (kbd_phone < 0) { 671 printf(NAME ": Failed to connect to keyboard service\n"); 675 672 return false; 676 673 } 677 674 678 kbd_phone = fd_phone(input_fd);679 if (kbd_phone < 0) {680 printf(NAME ": Failed to connect to input device\n");681 return false;682 }683 684 /* NB: The callback connection is slotted for removal */685 675 ipcarg_t phonehash; 686 676 if (ipc_connect_to_me(kbd_phone, SERVICE_CONSOLE, 0, 0, &phonehash) != 0) { 687 printf(NAME ": Failed to create callback from input device\n");677 printf(NAME ": Failed to create callback from keyboard service\n"); 688 678 return false; 689 679 } … … 709 699 710 700 /* Synchronize, the gcons could put something in queue */ 711 ipcarg_t color_cap;712 701 async_req_0_0(fb_info.phone, FB_FLUSH); 713 702 async_req_0_2(fb_info.phone, FB_GET_CSIZE, &fb_info.cols, &fb_info.rows); … … 747 736 consoles[i].refcount = 0; 748 737 749 char vc[ DEVMAP_NAME_MAXLEN + 1];750 snprintf(vc, DEVMAP_NAME_MAXLEN, "%s/vc%u", NAMESPACE, i);738 char vc[MAX_DEVICE_NAME]; 739 snprintf(vc, MAX_DEVICE_NAME, "vc%u", i); 751 740 752 741 if (devmap_device_register(vc, &consoles[i].dev_handle) != EOK) { … … 779 768 } 780 769 781 static void usage(void)782 {783 printf("Usage: console <input>\n");784 }785 786 770 int main(int argc, char *argv[]) 787 771 { 788 if (argc < 2) {789 usage();790 return -1;791 }792 793 772 printf(NAME ": HelenOS Console service\n"); 794 773 795 if (!console_init( argv[1]))774 if (!console_init()) 796 775 return -1; 797 776
Note:
See TracChangeset
for help on using the changeset viewer.
