commit: 595772a0510324bb67d7fe21ccbece97a844659a
parent c678bb18e0ec6eacdd693dae3110924f327f23a2
Author: Michael Forney <mforney@mforney.org>
Date: Sat, 1 Feb 2020 00:41:40 -0800
mtdev: Update to 1.1.6
Diffstat:
5 files changed, 46 insertions(+), 101 deletions(-)
diff --git a/.gitmodules b/.gitmodules
@@ -163,7 +163,7 @@
ignore = all
[submodule "pkg/mtdev/src"]
path = pkg/mtdev/src
- url = https://github.com/rydberg/mtdev
+ url = http://bitmath.org/git/mtdev.git
ignore = all
[submodule "pkg/mupdf/src"]
path = pkg/mupdf/src
diff --git a/pkg/mtdev/patch/0001-Avoid-__builtin_ffs.patch b/pkg/mtdev/patch/0001-Avoid-__builtin_ffs.patch
@@ -0,0 +1,44 @@
+From 09e21bb5d6714687705dc8f2d00a09b3ff3b2436 Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Fri, 7 Jun 2019 11:55:26 -0700
+Subject: [PATCH] Avoid __builtin_ffs
+
+---
+ src/common.h | 5 +----
+ src/core.c | 2 +-
+ 2 files changed, 2 insertions(+), 5 deletions(-)
+
+diff --git a/src/common.h b/src/common.h
+index 80a3d6e..3c77f48 100644
+--- a/src/common.h
++++ b/src/common.h
+@@ -77,12 +77,9 @@ static inline int bitcount(unsigned v)
+ return (((v + (v>>4)) & 0xF0F0F0F) * 0x1010101) >> 24;
+ }
+
+-/* Return index of first bit [0-31], -1 on zero */
+-#define firstbit(v) (__builtin_ffs(v) - 1)
+-
+ /* boost-style foreach bit */
+ #define foreach_bit(i, m) \
+- for (i = firstbit(m); i >= 0; i = firstbit((m) & (~0U << (i + 1))))
++ for (i = -1; (m) & ~0U << (i + 1);) if ((m) & 1U << ++i)
+
+ /* robust system ioctl calls */
+ #define SYSCALL(call) while (((call) == -1) && (errno == EINTR))
+diff --git a/src/core.c b/src/core.c
+index 0d91c0b..20ce0c6 100644
+--- a/src/core.c
++++ b/src/core.c
+@@ -304,7 +304,7 @@ static void apply_typeA_changes(struct mtdev_state *state,
+ break;
+ }
+ if (id != MT_ID_NULL) {
+- slot = firstbit(unused);
++ foreach_bit(slot, unused) break;
+ push_slot_changes(state, &data[i], prop[i], slot, syn);
+ SETBIT(used, slot);
+ CLEARBIT(unused, slot);
+--
+2.25.0
+
diff --git a/pkg/mtdev/patch/0001-Use-a-macro-for-nlongs-so-it-can-be-used-in-constant.patch b/pkg/mtdev/patch/0001-Use-a-macro-for-nlongs-so-it-can-be-used-in-constant.patch
@@ -1,55 +0,0 @@
-From 43c6faf96712324bea4121157d292b84a86b0d45 Mon Sep 17 00:00:00 2001
-From: Michael Forney <mforney@mforney.org>
-Date: Fri, 7 Jun 2019 10:36:05 -0700
-Subject: [PATCH] Use a macro for `nlongs` so it can be used in constant
- expression
-
-This way, it can be used to specify the `absbits` array size (in
-`mtdev_configure`) without making it a VLA.
-
-VLAs are an optional feature in C11, and in this case we can determine
-the array size statically.
-
-This also matches the macros used in libevdev and libinput.
-
-Signed-off-by: Michael Forney <mforney@mforney.org>
----
- src/caps.c | 12 ++++--------
- 1 file changed, 4 insertions(+), 8 deletions(-)
-
-diff --git a/src/caps.c b/src/caps.c
-index 2e6b0d4..b493425 100644
---- a/src/caps.c
-+++ b/src/caps.c
-@@ -32,16 +32,12 @@ static const int SN_COORD = 250; /* coordinate signal-to-noise ratio */
- static const int SN_WIDTH = 100; /* width signal-to-noise ratio */
- static const int SN_ORIENT = 10; /* orientation signal-to-noise ratio */
-
--static const int bits_per_long = 8 * sizeof(long);
--
--static inline int nlongs(int nbit)
--{
-- return (nbit + bits_per_long - 1) / bits_per_long;
--}
-+#define LONG_BITS (sizeof(long) * 8)
-+#define NLONGS(x) (((x) + LONG_BITS - 1) / LONG_BITS)
-
- static inline int getbit(const unsigned long *map, int key)
- {
-- return (map[key / bits_per_long] >> (key % bits_per_long)) & 0x01;
-+ return (map[key / LONG_BITS] >> (key % LONG_BITS)) & 0x01;
- }
-
- static int getabs(struct input_absinfo *abs, int key, int fd)
-@@ -106,7 +102,7 @@ int mtdev_set_slots(struct mtdev *dev, int fd)
-
- int mtdev_configure(struct mtdev *dev, int fd)
- {
-- unsigned long absbits[nlongs(ABS_MAX)];
-+ unsigned long absbits[NLONGS(ABS_MAX)];
- int rc, i;
-
- SYSCALL(rc = ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(absbits)), absbits));
---
-2.20.1
-
diff --git a/pkg/mtdev/patch/0002-Avoid-__builtin_ffs.patch b/pkg/mtdev/patch/0002-Avoid-__builtin_ffs.patch
@@ -1,44 +0,0 @@
-From 365d628a9c944989cab0bfa6ae39d1df0ec5a905 Mon Sep 17 00:00:00 2001
-From: Michael Forney <mforney@mforney.org>
-Date: Fri, 7 Jun 2019 11:55:26 -0700
-Subject: [PATCH] Avoid __builtin_ffs
-
----
- src/common.h | 5 +----
- src/core.c | 2 +-
- 2 files changed, 2 insertions(+), 5 deletions(-)
-
-diff --git a/src/common.h b/src/common.h
-index 80a3d6e..3c77f48 100644
---- a/src/common.h
-+++ b/src/common.h
-@@ -77,12 +77,9 @@ static inline int bitcount(unsigned v)
- return (((v + (v>>4)) & 0xF0F0F0F) * 0x1010101) >> 24;
- }
-
--/* Return index of first bit [0-31], -1 on zero */
--#define firstbit(v) (__builtin_ffs(v) - 1)
--
- /* boost-style foreach bit */
- #define foreach_bit(i, m) \
-- for (i = firstbit(m); i >= 0; i = firstbit((m) & (~0U << (i + 1))))
-+ for (i = -1; (m) & ~0U << (i + 1);) if ((m) & 1U << ++i)
-
- /* robust system ioctl calls */
- #define SYSCALL(call) while (((call) == -1) && (errno == EINTR))
-diff --git a/src/core.c b/src/core.c
-index 87ef420..f5b6272 100644
---- a/src/core.c
-+++ b/src/core.c
-@@ -298,7 +298,7 @@ static void apply_typeA_changes(struct mtdev_state *state,
- break;
- }
- if (id != MT_ID_NULL) {
-- slot = firstbit(unused);
-+ foreach_bit(slot, unused) break;
- push_slot_changes(state, &data[i], prop[i], slot, syn);
- SETBIT(used, slot);
- CLEARBIT(unused, slot);
---
-2.20.1
-
diff --git a/pkg/mtdev/ver b/pkg/mtdev/ver
@@ -1 +1 @@
-1.1.5 r1
+1.1.6 r0