diff options
author | Henrik Rydberg <rydberg@bitmath.org> | 2010-12-21 17:50:56 +0100 |
---|---|---|
committer | Henrik Rydberg <rydberg@bitmath.org> | 2010-12-21 17:50:56 +0100 |
commit | 4b4ca539a446c8443b28946d0dced1e6167d269b (patch) | |
tree | 73e57b6f956d8f50c456330c878e9b210ad41483 /include | |
parent | a8df0405686350c3145b3e5119d796c6642339fd (diff) |
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.
Diffstat (limited to 'include')
-rw-r--r-- | include/evemu.h | 28 |
1 files changed, 11 insertions, 17 deletions
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 <linux/uinput.h> #include <stdio.h> +#include <errno.h> +#include <linux/input.h> -#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); |