diff options
Diffstat (limited to '')
-rw-r--r-- | common.h | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -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; }; |