Changeset f89979b in mainline for uspace/srv/kbd/generic/kbd.c
- Timestamp:
- 2009-02-17T23:05:15Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 24ff4df
- Parents:
- 96e0748d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/kbd/generic/kbd.c
r96e0748d rf89979b 48 48 #include <kbd/kbd.h> 49 49 50 #include <arch/kbd.h>51 50 #include <kbd.h> 52 51 #include <key_buffer.h> 53 #include <keys.h> 52 #include <kbd_port.h> 53 #include <kbd_ctl.h> 54 #include <layout.h> 54 55 55 56 #define NAME "kbd" … … 59 60 keybuffer_t keybuffer; 60 61 61 static void irq_handler(ipc_callid_t iid, ipc_call_t *call) 62 void 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> 69 void kbd_push_ev(int type, unsigned int key, unsigned int mods) 62 70 { 63 71 kbd_event_t ev; 64 72 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); 71 76 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; 80 80 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); 85 84 } 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 //} 86 106 87 107 static void console_connection(ipc_callid_t iid, ipc_call_t *icall) … … 123 143 124 144 145 125 146 int main(int argc, char **argv) 126 147 { … … 129 150 ipcarg_t phonead; 130 151 131 /* Initialize arch dependent parts*/132 if (kbd_ arch_init())152 /* Initialize port driver. */ 153 if (kbd_port_init()) 133 154 return -1; 134 155 … … 137 158 138 159 async_set_client_connection(console_connection); 139 async_set_interrupt_received(irq_handler); 140 /* Register service at nameserver */160 161 /* Register service at nameserver. */ 141 162 if (ipc_connect_to_me(PHONE_NS, SERVICE_KEYBOARD, 0, 0, &phonead) != 0) 142 163 return -1; … … 145 166 async_manager(); 146 167 147 /* N ever reached*/168 /* Not reached. */ 148 169 return 0; 149 170 }
Note:
See TracChangeset
for help on using the changeset viewer.