+/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Keyboard input helper functions (too small to be called a layer)
*
* Copyright (c) 2011 The Chromium OS Authors.
- *
- * SPDX-License-Identifier: GPL-2.0+
*/
#ifndef _INPUT_H
enum {
/* Keyboard LEDs */
INPUT_LED_SCROLL = 1 << 0,
- INPUT_LED_CAPS = 1 << 1,
- INPUT_LED_NUM = 1 << 2,
+ INPUT_LED_NUM = 1 << 1,
+ INPUT_LED_CAPS = 1 << 2,
};
/*
/* 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 */
* @param config Input state
* @param keycode List of key codes to examine
* @param num_keycodes Number of key codes
- * @return number of ascii characters sent, or 0 if none, or -1 for an
+ * Return: number of ascii characters sent, or 0 if none, or -1 for an
* internal error
*/
int input_send_keycodes(struct input_config *config, int keycode[], int count);
* @param config Input state
* @param new_keycode New keycode to add/remove
* @param release true if this key was released, false if depressed
- * @return number of ascii characters sent, or 0 if none, or -1 for an
+ * Return: number of ascii characters sent, or 0 if none, or -1 for an
* internal error
*/
int input_add_keycode(struct input_config *config, int new_keycode,
* Test if keys are available to be read
*
* @param config Input state
- * @return 0 if no keys available, 1 if keys are available
+ * Return: 0 if no keys available, 1 if keys are available
*/
int input_tstc(struct input_config *config);
* TODO: U-Boot wants 0 for no key, but Ctrl-@ is a valid key...
*
* @param config Input state
- * @return key, or 0 if no key, or -1 if error
+ * Return: key, or 0 if no key, or -1 if error
*/
int input_getc(struct input_config *config);
* Register a new device with stdio and switch to it if wanted
*
* @param dev Pointer to device
- * @return 0 if ok, -1 on error
+ * Return: 0 if ok, -1 on error
*/
int input_stdio_register(struct stdio_dev *dev);
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.
*
* @param config Input state
- * @return 0 if ok, -1 on error
+ * @param german true to use German keyboard layout, false for US
+ * Return: 0 if ok, -1 on error
*/
-int input_add_tables(struct input_config *config);
+int input_add_tables(struct input_config *config, bool german);
/**
* Set up the input handler with basic key maps.
*
* @param config Input state
* @param leds Initial LED value (INPUT_LED_ mask), 0 suggested
- * @return 0 if ok, -1 on error
+ * Return: 0 if ok, -1 on error
*/
int input_init(struct input_config *config, int leds);