From 586ddd6fad5061ea1de4b0fbe903c1c9ea582f72 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 27 Jul 2022 15:32:10 +0200 Subject: m + add controller fingerprint + relay less on libevdev MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- common.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'common.h') diff --git a/common.h b/common.h index aec4277..9889858 100644 --- a/common.h +++ b/common.h @@ -18,10 +18,24 @@ #include #include +#include #include +#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; }; -- cgit v1.2.3-70-g09d2