summaryrefslogtreecommitdiffstats
path: root/include/input
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2016-01-12 13:50:42 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2016-01-13 16:26:05 +0100
commit224a08df5d9eed4e75d436911ffaca6b0af5a689 (patch)
treefdee657b62f4a463b6d45d598da1ce788f87053c /include/input
parentcfe4e61df18748001aedc201a0a35652f946802e (diff)
downloadbarebox-224a08df5d9eed4e75d436911ffaca6b0af5a689.tar.gz
barebox-224a08df5d9eed4e75d436911ffaca6b0af5a689.tar.xz
input: Add input core
Currently all input driver register themselves as consoles. Consoles are fine for typing text, but they do not allow to ask for the current pressed state of buttons or keypads. They also do not support non printable keys like the function keys. This patch adds a simple input core. On the driver side it supports input_report_key_event() to report events (button presses and releases). On the consumer side it allows getting the current button status via input_key_get_status(). Also an event driven interface is available which calls a callback whenever an input event is received. The input core also registers a console for all registered input devices which handles passing events to the console and stuff like key repetition, so this can be removed from the drivers once they are converted to the input core. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/input')
-rw-r--r--include/input/input.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/include/input/input.h b/include/input/input.h
new file mode 100644
index 0000000000..dbf3e7f574
--- /dev/null
+++ b/include/input/input.h
@@ -0,0 +1,34 @@
+#ifndef __INPUT_H
+#define __INPUT_H
+
+#include <linux/types.h>
+#include <linux/list.h>
+#include <dt-bindings/input/linux-event-codes.h>
+
+struct input_event {
+ uint16_t code;
+ uint16_t value;
+};
+
+struct input_device {
+ struct list_head list;
+ DECLARE_BITMAP(keys, KEY_CNT);
+};
+
+void input_report_key_event(struct input_device *idev, unsigned int code, int value);
+
+int input_device_register(struct input_device *);
+void input_device_unregister(struct input_device *);
+
+void input_key_get_status(unsigned long *keys, int bits);
+
+struct input_notifier {
+ void (*notify)(struct input_notifier *in, struct input_event *event);
+ struct list_head list;
+};
+
+int input_register_notfier(struct input_notifier *in);
+void input_unregister_notfier(struct input_notifier *in);
+
+#endif /* __INPUT_H */
+