From 1bc6faa48907919376b14429f3b802d0d16fc00a Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Tue, 21 Dec 2010 17:29:14 +0100 Subject: Make evemu ABI resilient Hide the evemu struct, make it versioned, and instead use new/delete and accessor functions. This should give us enough ABI stability to run mixed library implementations. Signed-off-by: Henrik Rydberg --- include/evemu.h | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) (limited to 'include') diff --git a/include/evemu.h b/include/evemu.h index 70a5bd5..698a539 100644 --- a/include/evemu.h +++ b/include/evemu.h @@ -26,28 +26,22 @@ * ****************************************************************************/ -#ifndef _EVPLAY_H -#define _EVPLAY_H +#ifndef _EVEMU_H +#define _EVEMU_H -#include #include +#include +#include -#define EVPLAY_NBITS KEY_CNT -#define EVPLAY_NBYTES ((EVPLAY_NBITS + 7) / 8) +#define EVEMU_VERSION_MAJOR 1 +#define EVEMU_VERSION_MINOR 1 -struct evemu_device { - char name[UINPUT_MAX_NAME_SIZE]; - struct input_id id; - unsigned char mask[EV_CNT][EVPLAY_NBYTES]; - int bytes[EV_CNT]; - struct input_absinfo abs[ABS_CNT]; -}; +struct evemu_device *evemu_new(const char *name); +void evemu_delete(struct evemu_device *dev); -static inline int evemu_has(const struct evemu_device *dev, - int type, int code) -{ - return (dev->mask[type][code >> 3] >> (code & 7)) & 1; -} +const char *evemu_get_name(const struct evemu_device *dev); + +int evemu_has(const struct evemu_device *dev, int type, int code); int evemu_extract(struct evemu_device *dev, int fd); int evemu_write(const struct evemu_device *dev, FILE *fp); -- cgit v1.2.3