[U-Boot] [PATCH v2 20/28] input: Allow updating of keyboard LEDs
Simon Glass
sjg at chromium.org
Mon Oct 19 05:17:29 CEST 2015
Add a function which returns a new keyboard LED value when the LEDs need
updating.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
Changes in v2: None
drivers/input/input.c | 9 +++++++++
include/input.h | 14 +++++++++++++-
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 0cb117f..0f3495f 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -247,6 +247,7 @@ static struct input_key_xlate *process_modifier(struct input_config *config,
if (config->flags & FLAG_SCROLL_LOCK)
leds |= INPUT_LED_SCROLL;
config->leds = leds;
+ config->leds_changed = flip;
}
}
@@ -558,6 +559,14 @@ void input_allow_repeats(struct input_config *config, bool allow_repeats)
config->allow_repeats = allow_repeats;
}
+int input_leds_changed(struct input_config *config)
+{
+ if (config->leds_changed)
+ return config->leds;
+
+ return -1;
+}
+
int input_add_tables(struct input_config *config, bool german)
{
int ret;
diff --git a/include/input.h b/include/input.h
index c1af259..ad120e4 100644
--- a/include/input.h
+++ b/include/input.h
@@ -43,7 +43,8 @@ struct input_config {
/* Which modifiers are active (1 bit for each MOD_... value) */
uchar modifiers;
uchar flags; /* active state keys (FLAGS_...) */
- uchar leds; /* active LEDS (INPUT_LED_...) */
+ uchar leds; /* active LEDs (INPUT_LED_...) */
+ uchar leds_changed; /* LEDs that just changed */
uchar num_tables; /* number of modifier tables */
int prev_keycodes[INPUT_BUFFER_LEN]; /* keys held last time */
int num_prev_keycodes; /* number of prev keys */
@@ -162,6 +163,17 @@ void input_set_delays(struct input_config *config, int repeat_delay_ms,
void input_allow_repeats(struct input_config *config, bool allow_repeats);
/**
+ * Check if keyboard LEDs need to be updated
+ *
+ * This can be called after input_tstc() to see if keyboard LEDs need
+ * updating.
+ *
+ * @param config Input state
+ * @return -1 if no LEDs need updating, other value if they do
+ */
+int input_leds_changed(struct input_config *config);
+
+/**
* Set up the key map tables
*
* This must be called after input_init() or keycode decoding will not work.
--
2.6.0.rc2.230.g3dd15c0
More information about the U-Boot
mailing list