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