diff options
| author | Henrik Rydberg <rydberg@euromail.se> | 2010-12-21 17:29:14 +0100 |
|---|---|---|
| committer | Henrik Rydberg <rydberg@euromail.se> | 2010-12-21 17:29:14 +0100 |
| commit | 1bc6faa48907919376b14429f3b802d0d16fc00a (patch) | |
| tree | 73e57b6f956d8f50c456330c878e9b210ad41483 /include/evemu.h | |
| 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.
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'include/evemu.h')
| -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 @@ | |||
| 26 | * | 26 | * |
| 27 | ****************************************************************************/ | 27 | ****************************************************************************/ |
| 28 | 28 | ||
| 29 | #ifndef _EVPLAY_H | 29 | #ifndef _EVEMU_H |
| 30 | #define _EVPLAY_H | 30 | #define _EVEMU_H |
| 31 | 31 | ||
| 32 | #include <linux/uinput.h> | ||
| 33 | #include <stdio.h> | 32 | #include <stdio.h> |
| 33 | #include <errno.h> | ||
| 34 | #include <linux/input.h> | ||
| 34 | 35 | ||
| 35 | #define EVPLAY_NBITS KEY_CNT | 36 | #define EVEMU_VERSION_MAJOR 1 |
| 36 | #define EVPLAY_NBYTES ((EVPLAY_NBITS + 7) / 8) | 37 | #define EVEMU_VERSION_MINOR 1 |
| 37 | 38 | ||
| 38 | struct evemu_device { | 39 | struct evemu_device *evemu_new(const char *name); |
| 39 | char name[UINPUT_MAX_NAME_SIZE]; | 40 | void evemu_delete(struct evemu_device *dev); |
| 40 | struct input_id id; | ||
| 41 | unsigned char mask[EV_CNT][EVPLAY_NBYTES]; | ||
| 42 | int bytes[EV_CNT]; | ||
| 43 | struct input_absinfo abs[ABS_CNT]; | ||
| 44 | }; | ||
| 45 | 41 | ||
| 46 | static inline int evemu_has(const struct evemu_device *dev, | 42 | const char *evemu_get_name(const struct evemu_device *dev); |
| 47 | int type, int code) | 43 | |
| 48 | { | 44 | int evemu_has(const struct evemu_device *dev, int type, int code); |
| 49 | return (dev->mask[type][code >> 3] >> (code & 7)) & 1; | ||
| 50 | } | ||
| 51 | 45 | ||
| 52 | int evemu_extract(struct evemu_device *dev, int fd); | 46 | int evemu_extract(struct evemu_device *dev, int fd); |
| 53 | int evemu_write(const struct evemu_device *dev, FILE *fp); | 47 | int evemu_write(const struct evemu_device *dev, FILE *fp); |
