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>
This commit is contained in:
Michel Dänzer
2008-07-29 10:06:07 +02:00
committed by Peter Hutterer
parent 53e7525744
commit 72551662a0

View File

@@ -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;