aboutsummaryrefslogtreecommitdiffstats
path: root/common.h
diff options
context:
space:
mode:
Diffstat (limited to 'common.h')
-rw-r--r--common.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/common.h b/common.h
index aec4277..9889858 100644
--- a/common.h
+++ b/common.h
@@ -18,10 +18,24 @@
#include <unistd.h>
#include <libevdev/libevdev.h>
+#include <libsha2.h>
#include <libudev.h>
+#if defined(__GNUC__)
+# define LIBGAMEPAD_CONST__ __attribute__((__const__))
+#else
+# define LIBGAMEPAD_CONST__
+#endif
+
+
+#define READ_(ARR, I) ((ARR)[(I) / BITSOF(*(ARR))])
+#define SHIFT_(ARR, I) ((I) % BITSOF(*(ARR)))
+
#define ELEMSOF(A) (sizeof(A) / sizeof(*(A)))
+#define BITSOF(T) (8 * sizeof(T))
+#define SETBIT(ARR, I) (READ_(ARR, I) |= 1 << SHIFT_(ARR, I))
+#define GETBIT(ARR, I) ((READ_(ARR, I) >> SHIFT_(ARR, I)) & 1)
struct libgamepad_attachment_monitor {
@@ -34,6 +48,8 @@ struct libgamepad_device_internals {
int close_fd;
int require_sync;
struct libevdev *dev;
+ struct input_absinfo *absinfo;
+ uint8_t *buttons;
};