summaryrefslogtreecommitdiff
path: root/src/libsystemd-terminal/idev.h
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2014-08-27 18:31:34 +0200
committerDavid Herrmann <dh.herrmann@gmail.com>2014-08-27 18:42:28 +0200
commitc93e5a62ff599528c3bf2a8656825403aaebe093 (patch)
tree4aed2f2ccaad553397e60d68851b5fdc80307d6e /src/libsystemd-terminal/idev.h
parente202fa31fb2d60084e7b2ab7976a81c138184d40 (diff)
terminal: add evdev elements to idev
The evdev-element provides linux evdev interfaces as idev-elements. This way, all real input hardware devices on linux can be used with the idev interface. We use libevdev to interface with the kernel. It's a simple wrapper library around the kernel evdev API that takes care to resync devices after kernel-queue overflows, which is a rather non-trivial task. Furthermore, it's a well tested interface used by all other major input users (Xorg, weston, libinput, ...). Last but not least, it provides nice keycode to keyname lookup tables (and vice versa), which is really nice for debugging input problems.
Diffstat (limited to 'src/libsystemd-terminal/idev.h')
-rw-r--r--src/libsystemd-terminal/idev.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/libsystemd-terminal/idev.h b/src/libsystemd-terminal/idev.h
index 6f618f37a..c98fb1bfb 100644
--- a/src/libsystemd-terminal/idev.h
+++ b/src/libsystemd-terminal/idev.h
@@ -26,6 +26,8 @@
#pragma once
#include <inttypes.h>
+#include <libudev.h>
+#include <linux/input.h>
#include <stdbool.h>
#include <stdlib.h>
#include <systemd/sd-bus.h>
@@ -33,6 +35,7 @@
#include "util.h"
typedef struct idev_data idev_data;
+typedef struct idev_data_evdev idev_data_evdev;
typedef struct idev_event idev_event;
typedef struct idev_device idev_device;
@@ -44,6 +47,7 @@ typedef struct idev_context idev_context;
*/
enum {
+ IDEV_ELEMENT_EVDEV,
IDEV_ELEMENT_CNT
};
@@ -52,17 +56,30 @@ enum {
};
/*
+ * Evdev Elements
+ */
+
+struct idev_data_evdev {
+ struct input_event event;
+};
+
+/*
* Data Packets
*/
enum {
IDEV_DATA_RESYNC,
+ IDEV_DATA_EVDEV,
IDEV_DATA_CNT
};
struct idev_data {
unsigned int type;
bool resync : 1;
+
+ union {
+ idev_data_evdev evdev;
+ };
};
/*
@@ -122,6 +139,9 @@ bool idev_session_is_enabled(idev_session *s);
void idev_session_enable(idev_session *s);
void idev_session_disable(idev_session *s);
+int idev_session_add_evdev(idev_session *s, struct udev_device *ud);
+int idev_session_remove_evdev(idev_session *s, struct udev_device *ud);
+
/*
* Contexts
*/