diff mbox

[U-Boot,2/6] input: Call keyboard's update_leds() method when the LEDs change

Message ID 1447335186-27731-2-git-send-email-bmeng.cn@gmail.com
State Accepted
Delegated to: Simon Glass
Headers show

Commit Message

Bin Meng Nov. 12, 2015, 1:33 p.m. UTC
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>
---

 drivers/input/input.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Simon Glass Nov. 12, 2015, 7:58 p.m. UTC | #1
On 12 November 2015 at 06:33, Bin Meng <bmeng.cn@gmail.com> wrote:
> 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>
> ---
>
>  drivers/input/input.c | 9 +++++++++
>  1 file changed, 9 insertions(+)

Acked-by: Simon Glass <sjg@chromium.org>
Simon Glass Nov. 14, 2015, 2:05 a.m. UTC | #2
Updated to fix build errors when CONFIG_DM_KEYBOARD is not enabled, and

Applied to u-boot-dm, thanks!
diff mbox

Patch

diff --git a/drivers/input/input.c b/drivers/input/input.c
index 79edda5..0926de5 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -9,9 +9,11 @@ 
 
 #include <common.h>
 #include <console.h>
+#include <dm.h>
 #include <errno.h>
 #include <stdio_dev.h>
 #include <input.h>
+#include <keyboard.h>
 #include <linux/input.h>
 
 enum {
@@ -236,6 +238,8 @@  int input_getc(struct input_config *config)
 static struct input_key_xlate *process_modifier(struct input_config *config,
 						int key, int release)
 {
+	struct udevice *dev = config->dev;
+	struct keyboard_ops *ops = keyboard_get_ops(dev);
 	struct input_key_xlate *table;
 	int i;
 
@@ -277,6 +281,11 @@  static struct input_key_xlate *process_modifier(struct input_config *config,
 				leds |= INPUT_LED_SCROLL;
 			config->leds = leds;
 			config->leds_changed = flip;
+
+			if (ops->update_leds) {
+				if (ops->update_leds(dev, config->leds))
+					debug("Update keyboard's LED failed\n");
+			}
 		}
 	}