summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichel Dänzer <michel@tungstengraphics.com>2008-07-29 10:06:07 +0200
committerPeter Hutterer <peter.hutterer@who-t.net>2008-07-30 11:26:23 +0930
commit72551662a09eedf696508aaacf6aa02c0254e4de (patch)
tree903410c9aedb6848aa6a0ffe314ba2d199b1c73d /src
parent53e7525744cd7c47707c7339f0b771f59f99b97c (diff)
xf86-input-evdev: Fix EVIOCGBIT ioctl usage on big endian platforms.
With this fix, on my PowerBook HAL hotplugging correctly detects my USB mouse, and no longer thinks keyboards have random numbers of mouse buttons. :) The LONG_BITS and NBITS macro definitions are stolen from xf86-input-synaptics. Signed-off-by: Michel Dänzer <michel@tungstengraphics.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'src')
-rw-r--r--src/evdev.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/evdev.c b/src/evdev.c
index f831081..58aa3dc 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -346,7 +346,9 @@ EvdevReadInput(InputInfoPtr pInfo)
}
}
-#define TestBit(bit, array) (array[(bit) / 8] & (1 << ((bit) % 8)))
+#define LONG_BITS (sizeof(long) * 8)
+#define NBITS(x) (((x) + LONG_BITS - 1) / LONG_BITS)
+#define TestBit(bit, array) (array[(bit) / LONG_BITS]) & (1 << ((bit) % LONG_BITS))
static void
EvdevPtrCtrlProc(DeviceIntPtr device, PtrCtrl *ctrl)
@@ -980,9 +982,9 @@ EvdevProc(DeviceIntPtr device, int what)
static int
EvdevProbe(InputInfoPtr pInfo)
{
- char key_bitmask[(KEY_MAX + 7) / 8];
- char rel_bitmask[(REL_MAX + 7) / 8];
- char abs_bitmask[(ABS_MAX + 7) / 8];
+ long key_bitmask[NBITS(KEY_MAX)];
+ long rel_bitmask[NBITS(REL_MAX)];
+ long abs_bitmask[NBITS(ABS_MAX)];
int i, has_axes, has_keys, num_buttons;
EvdevPtr pEvdev = pInfo->private;