Rev 4346 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4346 | Rev 4348 | ||
---|---|---|---|
Line 68... | Line 68... | ||
68 | static unsigned lock_keys; |
68 | static unsigned lock_keys; |
69 | 69 | ||
70 | int cir_service = 0; |
70 | int cir_service = 0; |
71 | int cir_phone = -1; |
71 | int cir_phone = -1; |
72 | 72 | ||
- | 73 | #define NUM_LAYOUTS 3 |
|
- | 74 | ||
- | 75 | static layout_op_t *layout[NUM_LAYOUTS] = { |
|
- | 76 | &us_qwerty_op, |
|
- | 77 | &us_dvorak_op, |
|
- | 78 | &cz_op |
|
- | 79 | }; |
|
- | 80 | ||
- | 81 | static int active_layout = 0; |
|
- | 82 | ||
73 | void kbd_push_scancode(int scancode) |
83 | void kbd_push_scancode(int scancode) |
74 | { |
84 | { |
75 | /* printf("scancode: 0x%x\n", scancode);*/ |
85 | /* printf("scancode: 0x%x\n", scancode);*/ |
76 | kbd_ctl_parse_scancode(scancode); |
86 | kbd_ctl_parse_scancode(scancode); |
77 | } |
87 | } |
Line 121... | Line 131... | ||
121 | /* |
131 | /* |
122 | printf("type: %d\n", type); |
132 | printf("type: %d\n", type); |
123 | printf("mods: 0x%x\n", mods); |
133 | printf("mods: 0x%x\n", mods); |
124 | printf("keycode: %u\n", key); |
134 | printf("keycode: %u\n", key); |
125 | */ |
135 | */ |
- | 136 | if (type == KE_PRESS && (mods & KM_LCTRL) && |
|
- | 137 | key == KC_F1) { |
|
- | 138 | active_layout = 0; |
|
- | 139 | layout[active_layout]->reset(); |
|
- | 140 | return; |
|
- | 141 | } |
|
- | 142 | ||
- | 143 | if (type == KE_PRESS && (mods & KM_LCTRL) && |
|
- | 144 | key == KC_F2) { |
|
- | 145 | active_layout = 1; |
|
- | 146 | layout[active_layout]->reset(); |
|
- | 147 | return; |
|
- | 148 | } |
|
- | 149 | ||
- | 150 | if (type == KE_PRESS && (mods & KM_LCTRL) && |
|
- | 151 | key == KC_F3) { |
|
- | 152 | active_layout = 2; |
|
- | 153 | layout[active_layout]->reset(); |
|
- | 154 | return; |
|
- | 155 | } |
|
- | 156 | ||
126 | ev.type = type; |
157 | ev.type = type; |
127 | ev.key = key; |
158 | ev.key = key; |
128 | ev.mods = mods; |
159 | ev.mods = mods; |
129 | 160 | ||
130 | ev.c = layout_parse_ev(&ev); |
161 | ev.c = layout[active_layout]->parse_ev(&ev); |
131 | 162 | ||
132 | async_msg_4(phone2cons, KBD_EVENT, ev.type, ev.key, ev.mods, ev.c); |
163 | async_msg_4(phone2cons, KBD_EVENT, ev.type, ev.key, ev.mods, ev.c); |
133 | } |
164 | } |
134 | 165 | ||
135 | static void console_connection(ipc_callid_t iid, ipc_call_t *icall) |
166 | static void console_connection(ipc_callid_t iid, ipc_call_t *icall) |
Line 160... | Line 191... | ||
160 | break; |
191 | break; |
161 | } |
192 | } |
162 | phone2cons = IPC_GET_ARG5(call); |
193 | phone2cons = IPC_GET_ARG5(call); |
163 | retval = 0; |
194 | retval = 0; |
164 | break; |
195 | break; |
- | 196 | case KBD_YIELD: |
|
- | 197 | kbd_port_yield(); |
|
- | 198 | retval = 0; |
|
- | 199 | break; |
|
- | 200 | case KBD_RECLAIM: |
|
- | 201 | kbd_port_reclaim(); |
|
- | 202 | retval = 0; |
|
- | 203 | break; |
|
165 | default: |
204 | default: |
166 | retval = EINVAL; |
205 | retval = EINVAL; |
167 | } |
206 | } |
168 | ipc_answer_0(callid, retval); |
207 | ipc_answer_0(callid, retval); |
169 | } |
208 | } |
Line 193... | Line 232... | ||
193 | return -1; |
232 | return -1; |
194 | 233 | ||
195 | /* Initialize controller driver. */ |
234 | /* Initialize controller driver. */ |
196 | if (kbd_ctl_init() != 0) |
235 | if (kbd_ctl_init() != 0) |
197 | return -1; |
236 | return -1; |
- | 237 | ||
- | 238 | /* Initialize (reset) layout. */ |
|
- | 239 | layout[active_layout]->reset(); |
|
198 | 240 | ||
199 | /* Initialize key buffer */ |
241 | /* Initialize key buffer */ |
200 | keybuffer_init(&keybuffer); |
242 | keybuffer_init(&keybuffer); |
201 | 243 | ||
202 | async_set_client_connection(console_connection); |
244 | async_set_client_connection(console_connection); |