Changeset f89979b in mainline for uspace/srv/kbd/generic/kbd.c


Ignore:
Timestamp:
2009-02-17T23:05:15Z (16 years ago)
Author:
Jiri Svoboda <jirik.svoboda@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
24ff4df
Parents:
96e0748d
Message:

Keyboard driver overhaul — organize by hardware structure. This is w.i.p. Modifier keys, as well as ppc32, ia64 and sparc64 will not work yet.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/kbd/generic/kbd.c

    r96e0748d rf89979b  
    4848#include <kbd/kbd.h>
    4949
    50 #include <arch/kbd.h>
    5150#include <kbd.h>
    5251#include <key_buffer.h>
    53 #include <keys.h>
     52#include <kbd_port.h>
     53#include <kbd_ctl.h>
     54#include <layout.h>
    5455
    5556#define NAME "kbd"
     
    5960keybuffer_t keybuffer; 
    6061
    61 static void irq_handler(ipc_callid_t iid, ipc_call_t *call)
     62void kbd_push_scancode(int scancode)
     63{
     64        printf("scancode: 0x%x\n", scancode);
     65        kbd_ctl_parse_scancode(scancode);
     66}
     67
     68#include <kbd/keycode.h>
     69void kbd_push_ev(int type, unsigned int key, unsigned int mods)
    6270{
    6371        kbd_event_t ev;
    6472
    65 #ifdef MOUSE_ENABLED
    66         if (mouse_arch_process(phone2cons, call))
    67                 return;
    68 #endif
    69        
    70         kbd_arch_process(&keybuffer, call);
     73        printf("type: %d\n", type);
     74        printf("mods: 0x%x\n", mods);
     75        printf("keycode: %u\n", key);
    7176
    72         if (cons_connected && phone2cons != -1) {
    73                 /*
    74                  * One interrupt can produce more than one event so the result
    75                  * is stored in a FIFO.
    76                  */
    77                 while (!keybuffer_empty(&keybuffer)) {
    78                         if (!keybuffer_pop(&keybuffer, &ev))
    79                                 break;
     77        ev.type = type;
     78        ev.key = key;
     79        ev.mods = mods;
    8080
    81                         async_msg_4(phone2cons, KBD_EVENT, ev.type, ev.key,
    82                             ev.mods, ev.c);
    83                 }
    84         }
     81        ev.c = layout_parse_ev(&ev);
     82
     83        async_msg_4(phone2cons, KBD_EVENT, ev.type, ev.key, ev.mods, ev.c);
    8584}
     85
     86//static void irq_handler(ipc_callid_t iid, ipc_call_t *call)
     87//{
     88//      kbd_event_t ev;
     89//
     90//      kbd_arch_process(&keybuffer, call);
     91//
     92//      if (cons_connected && phone2cons != -1) {
     93//              /*
     94//               * One interrupt can produce more than one event so the result
     95//               * is stored in a FIFO.
     96//               */
     97//              while (!keybuffer_empty(&keybuffer)) {
     98//                      if (!keybuffer_pop(&keybuffer, &ev))
     99//                              break;
     100//
     101//                      async_msg_4(phone2cons, KBD_EVENT, ev.type, ev.key,
     102//                          ev.mods, ev.c);
     103//              }
     104//      }
     105//}
    86106
    87107static void console_connection(ipc_callid_t iid, ipc_call_t *icall)
     
    123143
    124144
     145
    125146int main(int argc, char **argv)
    126147{
     
    129150        ipcarg_t phonead;
    130151       
    131         /* Initialize arch dependent parts */
    132         if (kbd_arch_init())
     152        /* Initialize port driver. */
     153        if (kbd_port_init())
    133154                return -1;
    134155       
     
    137158       
    138159        async_set_client_connection(console_connection);
    139         async_set_interrupt_received(irq_handler);
    140         /* Register service at nameserver */
     160
     161        /* Register service at nameserver. */
    141162        if (ipc_connect_to_me(PHONE_NS, SERVICE_KEYBOARD, 0, 0, &phonead) != 0)
    142163                return -1;
     
    145166        async_manager();
    146167
    147         /* Never reached */
     168        /* Not reached. */
    148169        return 0;
    149170}
Note: See TracChangeset for help on using the changeset viewer.