Changeset 79460ae in mainline for kbd/generic/kbd.c


Ignore:
Timestamp:
2006-05-30T10:40:17Z (19 years ago)
Author:
Josef Cejka <malyzelenyhnus@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
44c6d88d
Parents:
f25b73d6
Message:

Basic support for console driver.
Does not provide separate screens yet.
TODO fix many unhandled states.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kbd/generic/kbd.c

    rf25b73d6 r79460ae  
    4949        int phoneid;
    5050        char connected = 0;
    51        
     51        keybuffer_t keybuffer; 
    5252        ipcarg_t retval, arg1, arg2;
    5353
    54         printf("Uspace kbd service started.\n");
     54//      printf("Uspace kbd service started.\n");
    5555
    5656        /* Initialize arch dependent parts */
    5757        if (!(res = kbd_arch_init())) {
    58                         printf("Kbd registration failed with retval %d.\n", res);
     58//                      printf("Kbd registration failed with retval %d.\n", res);
    5959                        return -1;
    6060                        };
    6161       
    6262        /* Initialize key buffer */
    63         key_buffer_init();
     63        keybuffer_init(&keybuffer);
    6464       
    6565        /* Register service at nameserver */
    66         printf("%s: Registering at naming service.\n", NAME);
     66//      printf("%s: Registering at naming service.\n", NAME);
    6767
    6868        if ((res = ipc_connect_to_me(PHONE_NS, SERVICE_KEYBOARD, 0, &phonead)) != 0) {
    69                 printf("%s: Error: Registering at naming service failed.\n", NAME);
     69//              printf("%s: Error: Registering at naming service failed.\n", NAME);
    7070                return -1;
    7171        };
     
    7676                switch (IPC_GET_METHOD(call)) {
    7777                        case IPC_M_PHONE_HUNGUP:
    78                                 printf("%s: Phone hung up.\n", NAME);
     78//                              printf("%s: Phone hung up.\n", NAME);
    7979                                connected = 0;
    8080                                retval = 0;
     
    9898                                if (connected) {
    9999                                        /* recode to ASCII - one interrupt can produce more than one code so result is stored in fifo */
    100                                         kbd_arch_process(IPC_GET_ARG2(call));
     100                                        kbd_arch_process(&keybuffer, IPC_GET_ARG2(call));
    101101
    102102                                        //printf("%s: GOT INTERRUPT: %c\n", NAME, key);
     
    107107                                        retval = 0;
    108108
    109                                         while (!key_buffer_empty()) {
    110                                                 if (!key_buffer_pop((char *)&arg1)) {
    111                                                         printf("%s: KeyBuffer is empty but it should not be.\n");
     109                                        while (!keybuffer_empty(&keybuffer)) {
     110                                                if (!keybuffer_pop(&keybuffer, (char *)&arg1)) {
     111//                                                      printf("%s: KeyBuffer is empty but it should not be.\n");
    112112                                                        break;
    113113                                                }
    114114                                                /*FIXME: detection of closed connection */
    115                                                 ipc_call_async(phoneid, KBD_PUSHCHAR, arg1, 0, NULL);
     115                                                ipc_call_async(phoneid, KBD_PUSHCHAR, arg1, NULL, NULL);
    116116                                        }
    117117
    118118                                }
    119                                 printf("%s: Interrupt processed.\n", NAME);
     119//                              printf("%s: Interrupt processed.\n", NAME);
    120120                                break;
    121121                        default:
    122                                 printf("%s: Unknown method: %zd\n", NAME, IPC_GET_METHOD(call));
     122//                              printf("%s: Unknown method: %zd\n", NAME, IPC_GET_METHOD(call));
    123123                                retval = ENOENT;
    124124                                break;
Note: See TracChangeset for help on using the changeset viewer.