summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2013-07-31 19:25:50 +0200
committerHenrik Rydberg <rydberg@euromail.se>2013-07-31 19:25:50 +0200
commit72bbb5f42fe8e47d6314eb92a0ada6554644305c (patch)
tree1c3e5141d8f78260dff3078a3883cf34d69633cd
parentb5d8e8e26c0116e4b6e556a0f6da8777bc55c590 (diff)
parenta9ea3168615056360cdb21d6f1576d66be2a43fe (diff)
downloadmtdev-git-72bbb5f42fe8e47d6314eb92a0ada6554644305c.tar.gz
Merge more build fixes from Peter Hutterer, along with a more explicit
declaration of the backwards compatibility constraints on the API. Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
-rw-r--r--configure.ac1
-rw-r--r--src/caps.c12
-rw-r--r--src/common.h12
-rw-r--r--src/match_four.c1
-rw-r--r--src/state.h4
-rw-r--r--test/mtdev-kernel.c1
6 files changed, 21 insertions, 10 deletions
diff --git a/configure.ac b/configure.ac
index 070b861..c4b36ac 100644
--- a/configure.ac
+++ b/configure.ac
@@ -10,6 +10,7 @@ AC_CONFIG_AUX_DIR([config-aux])
# Initialize Automake
AM_INIT_AUTOMAKE([foreign dist-bzip2])
+AM_SILENT_RULES([yes])
LIB_VERSION=1:0:0
AC_SUBST([LIB_VERSION])
diff --git a/src/caps.c b/src/caps.c
index 45c185c..2e6b0d4 100644
--- a/src/caps.c
+++ b/src/caps.c
@@ -61,10 +61,10 @@ static struct input_absinfo *get_info(struct mtdev *dev, int code)
return NULL;
ix = mtdev_abs2mt(code);
- if (ix < 11)
+ if (ix < LEGACY_API_NUM_MT_AXES)
return &dev->abs[ix];
else
- return &dev->state->ext_abs[ix - 11];
+ return &dev->state->ext_abs[ix - LEGACY_API_NUM_MT_AXES];
}
static void set_info(struct mtdev *dev, int code,
@@ -156,10 +156,10 @@ int mtdev_has_mt_event(const struct mtdev *dev, int code)
return 0;
ix = mtdev_abs2mt(code);
- if (ix < 11)
+ if (ix < LEGACY_API_NUM_MT_AXES)
return dev->has_abs[ix];
else
- return dev->state->has_ext_abs[ix - 11];
+ return dev->state->has_ext_abs[ix - LEGACY_API_NUM_MT_AXES];
}
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)
return;
ix = mtdev_abs2mt(code);
- if (ix < 11)
+ if (ix < LEGACY_API_NUM_MT_AXES)
dev->has_abs[ix] = value;
else
- dev->state->has_ext_abs[ix - 11] = value;
+ dev->state->has_ext_abs[ix - LEGACY_API_NUM_MT_AXES] = value;
}
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)
/* robust system ioctl calls */
#define SYSCALL(call) while (((call) == -1) && (errno == EINTR))
+/* To be compatible to the original, non-opaque mtdev API, we can only use 11
+ * axes in the basic struct. Everything else is hidden in the state, see the
+ * use of dev->abs[idx] vs dev->state->ext_abs[idx]
+ *
+ * See MT_ABS_SIZE in include/mtdev.h
+ */
+#define LEGACY_API_NUM_MT_AXES 11
+
/**
* struct mtdev - represents an input MT device
* @has_mtdata: true if the device has MT capabilities
@@ -105,9 +113,9 @@ static inline int bitcount(unsigned v)
struct mtdev {
int has_mtdata;
int has_slot;
- int has_abs[11];
+ int has_abs[LEGACY_API_NUM_MT_AXES];
struct input_absinfo slot;
- struct input_absinfo abs[11];
+ struct input_absinfo abs[LEGACY_API_NUM_MT_AXES];
struct mtdev_state *state;
};
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 @@
#include "match.h"
#include <limits.h>
+#include <stdlib.h>
typedef unsigned char u8;
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)
*/
struct mtdev_state {
- int has_ext_abs[MT_ABS_SIZE - 11];
- struct input_absinfo ext_abs[MT_ABS_SIZE - 11];
+ int has_ext_abs[MT_ABS_SIZE - LEGACY_API_NUM_MT_AXES];
+ struct input_absinfo ext_abs[MT_ABS_SIZE - LEGACY_API_NUM_MT_AXES];
struct mtdev_iobuf iobuf;
struct mtdev_evbuf inbuf;
diff --git a/test/mtdev-kernel.c b/test/mtdev-kernel.c
index 1f33c3e..eaa65f4 100644
--- a/test/mtdev-kernel.c
+++ b/test/mtdev-kernel.c
@@ -28,6 +28,7 @@
#include <../src/common.h>
#include <stdio.h>
+#include <stdlib.h>
#include <time.h>
/*