Rev 3082 | Rev 3923 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3082 | Rev 3905 | ||
---|---|---|---|
Line 40... | Line 40... | ||
40 | #include <stdio.h> |
40 | #include <stdio.h> |
41 | #include <unistd.h> |
41 | #include <unistd.h> |
42 | #include <stdlib.h> |
42 | #include <stdlib.h> |
43 | #include <stdio.h> |
43 | #include <stdio.h> |
44 | #include <ipc/ns.h> |
44 | #include <ipc/ns.h> |
- | 45 | #include <async.h> |
|
45 | #include <errno.h> |
46 | #include <errno.h> |
- | 47 | #include <libadt/fifo.h> |
|
- | 48 | #include <kbd/kbd.h> |
|
- | 49 | ||
46 | #include <arch/kbd.h> |
50 | #include <arch/kbd.h> |
47 | #include <kbd.h> |
51 | #include <kbd.h> |
48 | #include <libadt/fifo.h> |
- | |
49 | #include <key_buffer.h> |
52 | #include <key_buffer.h> |
50 | #include <async.h> |
- | |
51 | #include <keys.h> |
53 | #include <keys.h> |
52 | 54 | ||
53 | #define NAME "kbd" |
55 | #define NAME "kbd" |
54 | 56 | ||
55 | int cons_connected = 0; |
57 | int cons_connected = 0; |
56 | int phone2cons = -1; |
58 | int phone2cons = -1; |
57 | keybuffer_t keybuffer; |
59 | keybuffer_t keybuffer; |
58 | 60 | ||
59 | static void irq_handler(ipc_callid_t iid, ipc_call_t *call) |
61 | static void irq_handler(ipc_callid_t iid, ipc_call_t *call) |
60 | { |
62 | { |
61 | int chr; |
63 | kbd_event_t ev; |
62 | 64 | ||
63 | #ifdef MOUSE_ENABLED |
65 | #ifdef MOUSE_ENABLED |
64 | if (mouse_arch_process(phone2cons, call)) |
66 | if (mouse_arch_process(phone2cons, call)) |
65 | return; |
67 | return; |
66 | #endif |
68 | #endif |
67 | 69 | ||
68 | kbd_arch_process(&keybuffer, call); |
70 | kbd_arch_process(&keybuffer, call); |
69 | 71 | ||
70 | if (cons_connected && phone2cons != -1) { |
72 | if (cons_connected && phone2cons != -1) { |
71 | /* |
73 | /* |
72 | * recode to ASCII - one interrupt can produce more than one |
74 | * One interrupt can produce more than one event so the result |
73 | * code so result is stored in fifo |
75 | * is stored in a FIFO. |
74 | */ |
76 | */ |
75 | while (!keybuffer_empty(&keybuffer)) { |
77 | while (!keybuffer_empty(&keybuffer)) { |
76 | if (!keybuffer_pop(&keybuffer, (int *)&chr)) |
78 | if (!keybuffer_pop(&keybuffer, &ev)) |
77 | break; |
79 | break; |
78 | 80 | ||
79 | async_msg_1(phone2cons, KBD_PUSHCHAR, chr); |
81 | async_msg_4(phone2cons, KBD_EVENT, ev.type, ev.key, |
- | 82 | ev.mods, ev.c); |
|
80 | } |
83 | } |
81 | } |
84 | } |
82 | } |
85 | } |
83 | 86 | ||
84 | static void console_connection(ipc_callid_t iid, ipc_call_t *icall) |
87 | static void console_connection(ipc_callid_t iid, ipc_call_t *icall) |