summaryrefslogtreecommitdiff
path: root/libevdev/libevdev-int.h
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2013-05-27 14:59:41 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2013-05-29 15:33:21 +1000
commita3255d3ec78c80918daac7f001dbb246a5970552 (patch)
tree5eedd5c3a187e98cb483b42df2b9ff8107a24014 /libevdev/libevdev-int.h
downloadlibevdev-a3255d3ec78c80918daac7f001dbb246a5970552.tar.gz
libevdev is a library to handle evdev devices
Two main goals of this library: - 'transparently' handle SYN_DROPPED events - avoid errors in ioctl handling by providing a simpler interface. Keeps a cached copy of the device for quick querying. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'libevdev/libevdev-int.h')
-rw-r--r--libevdev/libevdev-int.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/libevdev/libevdev-int.h b/libevdev/libevdev-int.h
new file mode 100644
index 0000000..c86a656
--- /dev/null
+++ b/libevdev/libevdev-int.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright © 2013 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#ifndef libevdev_INT_H
+#define libevdev_INT_H
+
+#include <config.h>
+#include "libevdev.h"
+
+#define LONG_BITS (sizeof(long) * 8)
+#define NLONGS(x) (((x) + LONG_BITS - 1) / LONG_BITS)
+#define ARRAY_LENGTH(a) (sizeof(a) / (sizeof((a)[0])))
+#define MAX_NAME 256
+#define MAX_SLOTS 32
+#define ABS_MT_MIN ABS_MT_SLOT
+#define ABS_MT_MAX ABS_MT_TOOL_Y
+#define ABS_MT_CNT (ABS_MT_MAX - ABS_MT_MIN + 1)
+
+struct libevdev {
+ int fd;
+ libevdev_callback_proc callback;
+ libevdev_callback_proc sync_callback;
+ void *userdata;
+
+ char name[MAX_NAME];
+ struct input_id ids;
+ unsigned long bits[NLONGS(EV_CNT)];
+ unsigned long props[NLONGS(INPUT_PROP_CNT)];
+ unsigned long key_bits[NLONGS(KEY_CNT)];
+ unsigned long rel_bits[NLONGS(REL_CNT)];
+ unsigned long abs_bits[NLONGS(ABS_CNT)];
+ unsigned long led_bits[NLONGS(LED_CNT)];
+ unsigned long key_values[NLONGS(KEY_CNT)];
+ struct input_absinfo abs_info[ABS_CNT];
+ unsigned int mt_slot_vals[MAX_SLOTS][ABS_MT_CNT];
+ int num_slots; /**< valid slots in mt_slot_vals */
+
+ int need_sync;
+ int grabbed;
+
+ struct input_event *queue;
+ size_t queue_size; /**< size of queue in elements */
+ size_t queue_next; /**< next event index */
+};
+
+#endif
+