]> git.sur5r.net Git - u-boot/commitdiff
input: Call keyboard's update_leds() method when the LEDs change
authorBin Meng <bmeng.cn@gmail.com>
Thu, 12 Nov 2015 13:33:02 +0000 (05:33 -0800)
committerSimon Glass <sjg@chromium.org>
Fri, 20 Nov 2015 03:13:41 +0000 (20:13 -0700)
We should request keyboard to turn on/off its LED when detecting
any changes on the LEDs.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Minor changes to allow this to build without CONFIG_DM_KEYBOARD:
Signed-off-by: Simon Glass <sjg@chromium.org>
drivers/input/input.c

index 575f4b66f0ad2aef328dbcd604140983bcd9ccc3..e02e2643c9f2a385d22e7cc2435d07f624840638 100644 (file)
@@ -8,9 +8,13 @@
  */
 
 #include <common.h>
+#include <dm.h>
 #include <errno.h>
 #include <stdio_dev.h>
 #include <input.h>
+#ifdef CONFIG_DM_KEYBOARD
+#include <keyboard.h>
+#endif
 #include <linux/input.h>
 
 enum {
@@ -235,6 +239,10 @@ int input_getc(struct input_config *config)
 static struct input_key_xlate *process_modifier(struct input_config *config,
                                                int key, int release)
 {
+#ifdef CONFIG_DM_KEYBOARD
+       struct udevice *dev = config->dev;
+       struct keyboard_ops *ops = keyboard_get_ops(dev);
+#endif
        struct input_key_xlate *table;
        int i;
 
@@ -276,6 +284,13 @@ static struct input_key_xlate *process_modifier(struct input_config *config,
                                leds |= INPUT_LED_SCROLL;
                        config->leds = leds;
                        config->leds_changed = flip;
+
+#ifdef CONFIG_DM_KEYBOARD
+                       if (ops->update_leds) {
+                               if (ops->update_leds(dev, config->leds))
+                                       debug("Update keyboard's LED failed\n");
+                       }
+#endif
                }
        }