From cd810918fd638df4e91f232ec889896c6155440a Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Thu, 12 Nov 2015 05:33:02 -0800 Subject: [PATCH] input: Call keyboard's update_leds() method when the LEDs change We should request keyboard to turn on/off its LED when detecting any changes on the LEDs. Signed-off-by: Bin Meng Acked-by: Simon Glass Minor changes to allow this to build without CONFIG_DM_KEYBOARD: Signed-off-by: Simon Glass --- drivers/input/input.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/input/input.c b/drivers/input/input.c index 575f4b6..e02e264 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -8,9 +8,13 @@ */ #include +#include #include #include #include +#ifdef CONFIG_DM_KEYBOARD +#include +#endif #include 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 } }