70,6 → 70,16 |
int cir_service = 0; |
int cir_phone = -1; |
|
#define NUM_LAYOUTS 3 |
|
static layout_op_t *layout[NUM_LAYOUTS] = { |
&us_qwerty_op, |
&us_dvorak_op, |
&cz_op |
}; |
|
static int active_layout = 0; |
|
void kbd_push_scancode(int scancode) |
{ |
/* printf("scancode: 0x%x\n", scancode);*/ |
123,11 → 133,32 |
printf("mods: 0x%x\n", mods); |
printf("keycode: %u\n", key); |
*/ |
if (type == KE_PRESS && (mods & KM_LCTRL) && |
key == KC_F1) { |
active_layout = 0; |
layout[active_layout]->reset(); |
return; |
} |
|
if (type == KE_PRESS && (mods & KM_LCTRL) && |
key == KC_F2) { |
active_layout = 1; |
layout[active_layout]->reset(); |
return; |
} |
|
if (type == KE_PRESS && (mods & KM_LCTRL) && |
key == KC_F3) { |
active_layout = 2; |
layout[active_layout]->reset(); |
return; |
} |
|
ev.type = type; |
ev.key = key; |
ev.mods = mods; |
|
ev.c = layout_parse_ev(&ev); |
ev.c = layout[active_layout]->parse_ev(&ev); |
|
async_msg_4(phone2cons, KBD_EVENT, ev.type, ev.key, ev.mods, ev.c); |
} |
162,6 → 193,14 |
phone2cons = IPC_GET_ARG5(call); |
retval = 0; |
break; |
case KBD_YIELD: |
kbd_port_yield(); |
retval = 0; |
break; |
case KBD_RECLAIM: |
kbd_port_reclaim(); |
retval = 0; |
break; |
default: |
retval = EINVAL; |
} |
196,6 → 235,9 |
if (kbd_ctl_init() != 0) |
return -1; |
|
/* Initialize (reset) layout. */ |
layout[active_layout]->reset(); |
|
/* Initialize key buffer */ |
keybuffer_init(&keybuffer); |
|