Input: qci_gkbd - allow changing keymap from userspace From: Dmitry Torokhov Wire up input->keycode, input->keycodemax and input->keycodesize so that EVIOGSKEYCODE ioctl works for the device and users can adjust keymap from userspace. Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/qci_gkbd.c | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/input/keyboard/qci_gkbd.c b/drivers/input/keyboard/qci_gkbd.c index 6cc06c4..905d76b 100644 --- a/drivers/input/keyboard/qci_gkbd.c +++ b/drivers/input/keyboard/qci_gkbd.c @@ -46,6 +46,7 @@ struct qci_keyboard { struct input_dev *input; unsigned int gpio; unsigned int irq; + unsigned short keymap[QCI_KEYBOARD_MAX_KEY + 1]; }; #ifdef CONFIG_PM @@ -96,7 +97,7 @@ static irqreturn_t qcikbd_interrupt(int irq, void *dev_id) if (scancode) { input_event(input, EV_MSC, MSC_SCAN, scancode); - input_report_key(input, scancode, down); + input_report_key(input, qcikbd->keymap[scancode], down); input_sync(input); } @@ -161,9 +162,16 @@ static int __devinit qcikbd_probe(struct i2c_client *client, __set_bit(EV_REP, input->evbit); __set_bit(MSC_SCAN, input->mscbit); + input->keycode = qcikbd->keymap; + input->keycodesize = sizeof(qcikbd->keymap[0]); + input->keycodemax = ARRAY_SIZE(qcikbd->keymap); + /* Enable all supported keys */ - for (i = 1; i <= QCI_KEYBOARD_MAX_KEY; i++) + for (i = 1; i <= QCI_KEYBOARD_MAX_KEY; i++) { + /* Initial keymap has 1:1 scancode - keycode mapping */ + qcikbd->keymap[i] = i; __set_bit(i, input->keybit); + } input_set_drvdata(qcikbd->input, qcikbd);