]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
input: Add the keycode translation tables separately
authorSimon Glass <sjg@chromium.org>
Mon, 19 Oct 2015 03:17:13 +0000 (21:17 -0600)
committerSimon Glass <sjg@chromium.org>
Fri, 20 Nov 2015 03:13:40 +0000 (20:13 -0700)
Require the caller to add the keycode translation tables separately so that
it can select which ones to use. In a later patch we will add the option to
add German tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
board/kosagi/novena/novena.c
drivers/input/cros_ec_keyb.c
drivers/input/input.c
drivers/input/tegra-kbc.c
include/input.h

index 919133b7d3efc9b5338ca95c5c2fed9cf8f8228e..4a9f7243d0566e4c7072cf5285354107f64de127 100644 (file)
@@ -88,6 +88,7 @@ int drv_keyboard_init(void)
                debug("%s: Cannot set up input\n", __func__);
                return -1;
        }
+       input_add_tables(&button_input);
        button_input.read_keys = novena_gpio_button_read_keys;
 
        error = input_stdio_register(&dev);
index dd150eeb459fd67b04273c6ce4206e7ece2e0e68..41d8a6f4222e613fd6652f834f4aa410789eef03 100644 (file)
@@ -255,6 +255,7 @@ int drv_keyboard_init(void)
                return -1;
        }
        config.input.read_keys = cros_ec_kbc_check;
+       input_add_tables(&config.input);
 
        memset(&dev, '\0', sizeof(dev));
        strcpy(dev.name, "cros-ec-keyb");
index 90339357736d762697c9ddc27d4969216f0b2c9d..82e8381c345d3e0236c81a3f8b171f40de1beedb 100644 (file)
@@ -457,19 +457,27 @@ void input_set_delays(struct input_config *config, int repeat_delay_ms,
        config->repeat_rate_ms = repeat_rate_ms;
 }
 
+int input_add_tables(struct input_config *config)
+{
+       int ret;
+
+       ret = input_add_table(config, -1, -1,
+                             kbd_plain_xlate, ARRAY_SIZE(kbd_plain_xlate));
+       if (ret)
+               return ret;
+       ret = input_add_table(config, KEY_LEFTSHIFT, KEY_RIGHTSHIFT,
+                             kbd_shift_xlate, ARRAY_SIZE(kbd_shift_xlate));
+       if (ret)
+               return ret;
+
+       return input_add_table(config, KEY_LEFTCTRL, KEY_RIGHTCTRL,
+                              kbd_ctrl_xlate, ARRAY_SIZE(kbd_ctrl_xlate));
+}
+
 int input_init(struct input_config *config, int leds)
 {
        memset(config, '\0', sizeof(*config));
        config->leds = leds;
-       if (input_add_table(config, -1, -1,
-                       kbd_plain_xlate, ARRAY_SIZE(kbd_plain_xlate)) ||
-               input_add_table(config, KEY_LEFTSHIFT, KEY_RIGHTSHIFT,
-                       kbd_shift_xlate, ARRAY_SIZE(kbd_shift_xlate)) ||
-               input_add_table(config, KEY_LEFTCTRL, KEY_RIGHTCTRL,
-                       kbd_ctrl_xlate, ARRAY_SIZE(kbd_ctrl_xlate))) {
-               debug("%s: Could not add modifier tables\n", __func__);
-               return -ENOSPC;
-       }
 
        return 0;
 }
index 6b88db4def79b802f0ccb8750ae2c40b6453ed22..818ed8ccab63b13ea872a4737a2b730b8f3bcf6d 100644 (file)
@@ -355,6 +355,7 @@ int drv_keyboard_init(void)
                return -1;
        }
        config.input.read_keys = tegra_kbc_check;
+       input_add_tables(input);
 
        memset(&dev, '\0', sizeof(dev));
        strcpy(dev.name, "tegra-kbc");
index 7bccc8ec896c22a8c3fc23be0cc3700c74246bd9..71f3538db535e579e1eca25f05897252e334b661 100644 (file)
@@ -122,6 +122,16 @@ int input_stdio_register(struct stdio_dev *dev);
 void input_set_delays(struct input_config *config, int repeat_delay_ms,
               int repeat_rate_ms);
 
+/**
+ * Set up the key map tables
+ *
+ * This must be called after input_init() or keycode decoding will not work.
+ *
+ * @param config       Input state
+ * @return 0 if ok, -1 on error
+ */
+int input_add_tables(struct input_config *config);
+
 /**
  * Set up the input handler with basic key maps.
  *