diff options
author | Michel Dänzer <michel@tungstengraphics.com> | 2008-07-29 10:06:07 +0200 |
---|---|---|
committer | Julien Cristau <jcristau@debian.org> | 2008-07-30 10:45:31 +0200 |
commit | 2e9a71df5f8e8cdcdb80eec9e17501a75d5bd669 (patch) | |
tree | b94180ad94757a0446a33e4f0b2f077bb0a57010 | |
parent | 49de32e70f833628554342ef4225a4174158b412 (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>
[cherry-picked from master and fixed the trivial conflict -- jcristau]
-rw-r--r-- | src/evdev.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/evdev.c b/src/evdev.c index f9c6fde..0cd016a 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -306,7 +306,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) @@ -895,9 +897,9 @@ EvdevConvert(InputInfoPtr pInfo, int first, int num, int v0, int v1, int v2, 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_buttons, has_keys; EvdevPtr pEvdev = pInfo->private; |