aboutsummaryrefslogtreecommitdiff
path: root/src/evdev.h
diff options
context:
space:
mode:
authorZephaniah E. Hull <warp@aehallh.com>2006-05-14 11:55:50 +0000
committerZephaniah E. Hull <warp@aehallh.com>2006-05-14 11:55:50 +0000
commite9c60da89a9c55b81b2dedcf6ee3d1aefb4ff591 (patch)
tree906e82e20eb2cc084f92a060e9dec27d854e6adc /src/evdev.h
parentxf86-input-evdev v1.1.2 (diff)
downloadxf86-input-evdev-e9c60da89a9c55b81b2dedcf6ee3d1aefb4ff591.tar.gz
xf86-input-evdev-e9c60da89a9c55b81b2dedcf6ee3d1aefb4ff591.tar.bz2
xf86-input-evdev-e9c60da89a9c55b81b2dedcf6ee3d1aefb4ff591.zip
Tweak credits and references.
Change the longs to unsigned longs in the bitfields. Cleanup our includes. Stop pulling in asm/types.h and asm/bitops.h. Conditionally define the stuff that used to come from the above, including our own test_bit, set_bit and clear_bit. Change the longs to unsigned longs in the bitfields. Change the longs to unsigned longs in the bitfields. Use the bitop defines in evdev.h properly. Change the longs to unsigned longs in the bitfields. Change the longs to unsigned longs in the bitfields. Use the bitop defines in evdev.h properly. Change the longs to unsigned longs in the bitfields. Use the bitop defines in evdev.h properly. Add HPPA/HPPA64 entries. (Thanks to Fabio M. Di Nitto <fabbione@ubuntu.com>)
Diffstat (limited to 'src/evdev.h')
-rw-r--r--src/evdev.h37
1 files changed, 23 insertions, 14 deletions
diff --git a/src/evdev.h b/src/evdev.h
index ffe8cc1..757ccc7 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -72,20 +72,29 @@
#include <stdarg.h>
#include <xf86Xinput.h>
+#ifndef BITS_PER_LONG
#define BITS_PER_LONG (sizeof(long) * 8)
+#endif
+
#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1)
-#define OFF(x) ((x)%BITS_PER_LONG)
-#define LONG(x) ((x)/BITS_PER_LONG)
-#define BIT(x) (1UL<<((x)%BITS_PER_LONG))
-#define test_bit(bit, array) ((array[LONG(bit)] >> OFF(bit)) & 1)
+#define LONG(x) ((x) >> (sizeof(unsigned long) + 1))
+#define MASK(x) (1 << ((x) & (sizeof (unsigned long) * 8 - 1)))
+
+#ifndef test_bit
+#define test_bit(bit, array) (array[LONG(bit)] & MASK(bit))
+#endif
+#ifndef set_bit
+#define set_bit(bit, array) (array[LONG(bit)] |= MASK(bit))
+#endif
+#ifndef clear_bit
+#define clear_bit(bit, array) (array[LONG(bit)] &= ~MASK(bit))
+#endif
/* 2.4 compatibility */
#ifndef EVIOCGSW
#include <sys/time.h>
#include <sys/ioctl.h>
-#include <asm/types.h>
-#include <asm/bitops.h>
#define EVIOCGSW(len) _IOC(_IOC_READ, 'E', 0x1b, len) /* get all switch states */
@@ -128,14 +137,14 @@
#define EVDEV_MAXBUTTONS 96
typedef struct {
- long ev[NBITS(EV_MAX)];
- long key[NBITS(KEY_MAX)];
- long rel[NBITS(REL_MAX)];
- long abs[NBITS(ABS_MAX)];
- long msc[NBITS(MSC_MAX)];
- long led[NBITS(LED_MAX)];
- long snd[NBITS(SND_MAX)];
- long ff[NBITS(FF_MAX)];
+ unsigned long ev[NBITS(EV_MAX)];
+ unsigned long key[NBITS(KEY_MAX)];
+ unsigned long rel[NBITS(REL_MAX)];
+ unsigned long abs[NBITS(ABS_MAX)];
+ unsigned long msc[NBITS(MSC_MAX)];
+ unsigned long led[NBITS(LED_MAX)];
+ unsigned long snd[NBITS(SND_MAX)];
+ unsigned long ff[NBITS(FF_MAX)];
} evdevBitsRec, *evdevBitsPtr;
typedef struct {