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

Bin Meng bmeng.cn at gmail.com
Thu Nov 12 14:33:02 CET 2015


We should request keyboard to turn on/off its LED when detecting
any changes on the LEDs.

Signed-off-by: Bin Meng <bmeng.cn at gmail.com>
---

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

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");
+			}
 		}
 	}
 
-- 
1.8.2.1



More information about the U-Boot mailing list