Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 47a350f in mainline for uspace/srv/console/console.c


Ignore:
Timestamp:
2009-12-16T01:49:16Z (12 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master
Children:
df747bd8
Parents:
4491338
Message:

keyboard is not a single possible human input device, thus don't register the kbd driver as a singleton service to the Naming service, but to the Device mapper

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/console/console.c

    r4491338 r47a350f  
    5050#include <event.h>
    5151#include <devmap.h>
     52#include <fcntl.h>
     53#include <vfs/vfs.h>
    5254#include <fibril_synch.h>
    5355
     
    665667}
    666668
    667 static bool console_init(void)
    668 {
    669         ipcarg_t color_cap;
    670 
    671         /* Connect to keyboard driver */
    672         kbd_phone = ipc_connect_me_to_blocking(PHONE_NS, SERVICE_KEYBOARD, 0, 0);
     669static 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);
    673679        if (kbd_phone < 0) {
    674                 printf(NAME ": Failed to connect to keyboard service\n");
     680                printf(NAME ": Failed to connect to input device\n");
    675681                return false;
    676682        }
    677683       
     684        /* NB: The callback connection is slotted for removal */
    678685        ipcarg_t phonehash;
    679686        if (ipc_connect_to_me(kbd_phone, SERVICE_CONSOLE, 0, 0, &phonehash) != 0) {
    680                 printf(NAME ": Failed to create callback from keyboard service\n");
     687                printf(NAME ": Failed to create callback from input device\n");
    681688                return false;
    682689        }
     
    702709       
    703710        /* Synchronize, the gcons could put something in queue */
     711        ipcarg_t color_cap;
    704712        async_req_0_0(fb_info.phone, FB_FLUSH);
    705713        async_req_0_2(fb_info.phone, FB_GET_CSIZE, &fb_info.cols, &fb_info.rows);
     
    771779}
    772780
     781static void usage(void)
     782{
     783        printf("Usage: console <input>\n");
     784}
     785
    773786int main(int argc, char *argv[])
    774787{
     788        if (argc < 2) {
     789                usage();
     790                return -1;
     791        }
     792       
    775793        printf(NAME ": HelenOS Console service\n");
    776794       
    777         if (!console_init())
     795        if (!console_init(argv[1]))
    778796                return -1;
    779797       
Note: See TracChangeset for help on using the changeset viewer.