diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/caps.c | 12 | ||||
| -rw-r--r-- | src/common.h | 12 | ||||
| -rw-r--r-- | src/match_four.c | 1 | ||||
| -rw-r--r-- | src/state.h | 4 |
4 files changed, 19 insertions, 10 deletions
| @@ -61,10 +61,10 @@ static struct input_absinfo *get_info(struct mtdev *dev, int code) | |||
| 61 | return NULL; | 61 | return NULL; |
| 62 | 62 | ||
| 63 | ix = mtdev_abs2mt(code); | 63 | ix = mtdev_abs2mt(code); |
| 64 | if (ix < 11) | 64 | if (ix < LEGACY_API_NUM_MT_AXES) |
| 65 | return &dev->abs[ix]; | 65 | return &dev->abs[ix]; |
| 66 | else | 66 | else |
| 67 | return &dev->state->ext_abs[ix - 11]; | 67 | return &dev->state->ext_abs[ix - LEGACY_API_NUM_MT_AXES]; |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | static void set_info(struct mtdev *dev, int code, | 70 | static void set_info(struct mtdev *dev, int code, |
| @@ -156,10 +156,10 @@ int mtdev_has_mt_event(const struct mtdev *dev, int code) | |||
| 156 | return 0; | 156 | return 0; |
| 157 | 157 | ||
| 158 | ix = mtdev_abs2mt(code); | 158 | ix = mtdev_abs2mt(code); |
| 159 | if (ix < 11) | 159 | if (ix < LEGACY_API_NUM_MT_AXES) |
| 160 | return dev->has_abs[ix]; | 160 | return dev->has_abs[ix]; |
| 161 | else | 161 | else |
| 162 | return dev->state->has_ext_abs[ix - 11]; | 162 | return dev->state->has_ext_abs[ix - LEGACY_API_NUM_MT_AXES]; |
| 163 | } | 163 | } |
| 164 | 164 | ||
| 165 | int mtdev_get_abs_minimum(const struct mtdev *dev, int code) | 165 | int mtdev_get_abs_minimum(const struct mtdev *dev, int code) |
| @@ -203,10 +203,10 @@ void mtdev_set_mt_event(struct mtdev *dev, int code, int value) | |||
| 203 | return; | 203 | return; |
| 204 | 204 | ||
| 205 | ix = mtdev_abs2mt(code); | 205 | ix = mtdev_abs2mt(code); |
| 206 | if (ix < 11) | 206 | if (ix < LEGACY_API_NUM_MT_AXES) |
| 207 | dev->has_abs[ix] = value; | 207 | dev->has_abs[ix] = value; |
| 208 | else | 208 | else |
| 209 | dev->state->has_ext_abs[ix - 11] = value; | 209 | dev->state->has_ext_abs[ix - LEGACY_API_NUM_MT_AXES] = value; |
| 210 | } | 210 | } |
| 211 | 211 | ||
| 212 | void mtdev_set_abs_maximum(struct mtdev *dev, int code, int value) | 212 | void mtdev_set_abs_maximum(struct mtdev *dev, int code, int value) |
diff --git a/src/common.h b/src/common.h index 2ec8eb8..80a3d6e 100644 --- a/src/common.h +++ b/src/common.h | |||
| @@ -87,6 +87,14 @@ static inline int bitcount(unsigned v) | |||
| 87 | /* robust system ioctl calls */ | 87 | /* robust system ioctl calls */ |
| 88 | #define SYSCALL(call) while (((call) == -1) && (errno == EINTR)) | 88 | #define SYSCALL(call) while (((call) == -1) && (errno == EINTR)) |
| 89 | 89 | ||
| 90 | /* To be compatible to the original, non-opaque mtdev API, we can only use 11 | ||
| 91 | * axes in the basic struct. Everything else is hidden in the state, see the | ||
| 92 | * use of dev->abs[idx] vs dev->state->ext_abs[idx] | ||
| 93 | * | ||
| 94 | * See MT_ABS_SIZE in include/mtdev.h | ||
| 95 | */ | ||
| 96 | #define LEGACY_API_NUM_MT_AXES 11 | ||
| 97 | |||
| 90 | /** | 98 | /** |
| 91 | * struct mtdev - represents an input MT device | 99 | * struct mtdev - represents an input MT device |
| 92 | * @has_mtdata: true if the device has MT capabilities | 100 | * @has_mtdata: true if the device has MT capabilities |
| @@ -105,9 +113,9 @@ static inline int bitcount(unsigned v) | |||
| 105 | struct mtdev { | 113 | struct mtdev { |
| 106 | int has_mtdata; | 114 | int has_mtdata; |
| 107 | int has_slot; | 115 | int has_slot; |
| 108 | int has_abs[11]; | 116 | int has_abs[LEGACY_API_NUM_MT_AXES]; |
| 109 | struct input_absinfo slot; | 117 | struct input_absinfo slot; |
| 110 | struct input_absinfo abs[11]; | 118 | struct input_absinfo abs[LEGACY_API_NUM_MT_AXES]; |
| 111 | struct mtdev_state *state; | 119 | struct mtdev_state *state; |
| 112 | }; | 120 | }; |
| 113 | 121 | ||
diff --git a/src/match_four.c b/src/match_four.c index c7d2cd3..df88afb 100644 --- a/src/match_four.c +++ b/src/match_four.c | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | #include "match.h" | 1 | #include "match.h" |
| 2 | #include <limits.h> | 2 | #include <limits.h> |
| 3 | #include <stdlib.h> | ||
| 3 | 4 | ||
| 4 | typedef unsigned char u8; | 5 | typedef unsigned char u8; |
| 5 | typedef unsigned int u32; | 6 | typedef unsigned int u32; |
diff --git a/src/state.h b/src/state.h index 256858a..06e86ae 100644 --- a/src/state.h +++ b/src/state.h | |||
| @@ -72,8 +72,8 @@ static inline void set_sval(struct mtdev_slot *slot, int ix, int value) | |||
| 72 | */ | 72 | */ |
| 73 | struct mtdev_state { | 73 | struct mtdev_state { |
| 74 | 74 | ||
| 75 | int has_ext_abs[MT_ABS_SIZE - 11]; | 75 | int has_ext_abs[MT_ABS_SIZE - LEGACY_API_NUM_MT_AXES]; |
| 76 | struct input_absinfo ext_abs[MT_ABS_SIZE - 11]; | 76 | struct input_absinfo ext_abs[MT_ABS_SIZE - LEGACY_API_NUM_MT_AXES]; |
| 77 | 77 | ||
| 78 | struct mtdev_iobuf iobuf; | 78 | struct mtdev_iobuf iobuf; |
| 79 | struct mtdev_evbuf inbuf; | 79 | struct mtdev_evbuf inbuf; |
