summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2015-10-18 21:17:24 -0600
committerSimon Glass <sjg@chromium.org>2015-11-19 20:13:40 -0700
commit3a85e4362aa830c0beb2b0253c0e70102b42f066 (patch)
tree6d4d0c459f99c7aec495048687018089aec94bc2 /include
parent77c7f0459f1f8e6de004ca1d03a81df1a9792d70 (diff)
downloadblackbird-obmc-uboot-3a85e4362aa830c0beb2b0253c0e70102b42f066.tar.gz
blackbird-obmc-uboot-3a85e4362aa830c0beb2b0253c0e70102b42f066.zip
input: Add a function to add a keycode to the existing set
Most keyboards can be scanned to produce a list of the keycodes which are depressed. With the i8042 keyboard this scanning is done internally and only the processed results are returned. In this case, when a key is pressed, a 'make' code is sent. When the key is released a 'break' code is sent. This means that the driver needs to keep track of which keys are pressed. It also means that any protocol error can lead to stuck keys. In order to support this type of keyboard, add a function when can be used to provide a single keycode and either add it to the list of what is pressed or remove it from the list. Then the normal input_send_keycodes() function can be used to actually do the decoding work. Add debugging to display the ASCII characters written to the input queue also. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'include')
-rw-r--r--include/input.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/input.h b/include/input.h
index 71f3538db5..9942d6f77d 100644
--- a/include/input.h
+++ b/include/input.h
@@ -76,6 +76,26 @@ struct stdio_dev;
int input_send_keycodes(struct input_config *config, int keycode[], int count);
/**
+ * Add a new keycode to an existing list of keycodes
+ *
+ * This can be used to handle keyboards which do their own scanning. An
+ * internal list of depressed keys is maintained by the input library. Then
+ * this function is called to add a new key to the list (when a 'make code' is
+ * received), or remove a key (when a 'break code' is received).
+ *
+ * This function looks after maintenance of the list of active keys, and calls
+ * input_send_keycodes() with its updated list.
+ *
+ * @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
+ * internal error
+ */
+int input_add_keycode(struct input_config *config, int new_keycode,
+ bool release);
+
+/**
* Add a new key translation table to the input
*
* @param config Input state
OpenPOWER on IntegriCloud