mirror of
https://github.com/X11Libre/xf86-input-evdev.git
synced 2026-04-14 11:44:16 +00:00
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]
This commit is contained in:
committed by
Julien Cristau
parent
49de32e70f
commit
2e9a71df5f
10
src/evdev.c
10
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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user