summaryrefslogtreecommitdiff
path: root/package/x11r7/xdriver_xf86-input-evdev/xdriver_xf86-input-evdev-1.1.2-10-bitfield-fixes.patch
blob: e2748724a1ffa8d62cd30e6699da77e687365bd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
From: Zephaniah E. Hull <warp@aehallh.com>
Date: Sun, 14 May 2006 11:55:50 +0000 (+0000)
Subject: Tweak credits and references.
X-Git-Tag: xf86-video-impact-0_2_0
X-Git-Url: http://gitweb.freedesktop.org/?p=xorg/driver/xf86-input-evdev.git;a=commitdiff;h=e9c60da89a9c55b81b2dedcf6ee3d1aefb4ff591

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>)
---

--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,37 @@
+2006-05-14  Zephaniah E. Hull  <warp@aehallh.com>
+
+	* man/evdev.man:
+	Tweak credits and references.
+	* src/evdev.c: (EvdevParseBits), (EvdevParseBitOption),
+	(EvdevCorePreInit):
+	Change the longs to unsigned longs in the bitfields.
+
+	Cleanup our includes.
+	* src/evdev.h:
+	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.
+	* src/evdev_axes.c: (EvdevAxisAbsNew), (EvdevAxisRelNew):
+	Change the longs to unsigned longs in the bitfields.
+
+	Use the bitop defines in evdev.h properly.
+	* src/evdev_brain.c: (MatchAll), (MatchNot), (MatchAny):
+	Change the longs to unsigned longs in the bitfields.
+	* src/evdev_btn.c: (EvdevBtnNew):
+	Change the longs to unsigned longs in the bitfields.
+
+	Use the bitop defines in evdev.h properly.
+	* src/evdev_key.c: (EvdevKeyNew):
+	Change the longs to unsigned longs in the bitfields.
+
+	Use the bitop defines in evdev.h properly.
+	* src/inotify-syscalls.h:
+	Add HPPA/HPPA64 entries. (Thanks to Fabio M. Di Nitto
+	<fabbione@ubuntu.com>)
+
 2006-04-30  Zephaniah E. Hull  <warp@aehallh.com>
 
 	* configure.ac:
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -61,8 +61,6 @@
 #include <X11/XF86keysym.h>
 #include <X11/extensions/XIproto.h>
 
-#include <string.h>
-
 #include "evdev.h"
 
 #include <xf86.h>
@@ -328,7 +326,7 @@ EvdevNew(evdevDriverPtr driver, evdevDev
 }
 
 static void
-EvdevParseBits (char *in, long *out, int len)
+EvdevParseBits (char *in, unsigned long *out, int len)
 {
     unsigned long v[2];
     int n, i, max_bits = len * BITS_PER_LONG;
@@ -351,7 +349,7 @@ EvdevParseBits (char *in, long *out, int
 }
 
 static void
-EvdevParseBitOption (char *opt, long *all, long *not, long *any, int len)
+EvdevParseBitOption (char *opt, unsigned long *all, unsigned long *not, unsigned long *any, int len)
 {
     char *cur, *next;
 
@@ -395,7 +393,7 @@ EvdevCorePreInit(InputDriverPtr drv, IDe
 	EvdevParseBitOption (tmp, pEvdev->all_bits.field,			\
 		pEvdev->not_bits.field,					\
 		pEvdev->any_bits.field,					\
-		sizeof(pEvdev->not_bits.field) / sizeof (long));		\
+		sizeof(pEvdev->not_bits.field) / sizeof (unsigned long));	\
 	free (tmp);								\
     }
     bitoption(ev);
--- 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 {
--- a/src/evdev_axes.c
+++ b/src/evdev_axes.c
@@ -49,14 +49,6 @@
 
 #include <xf86_OSproc.h>
 
-#define ArrayLength(a) (sizeof(a) / (sizeof((a)[0])))
-
-#define BITS_PER_LONG (sizeof(long) * 8)
-#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1)
-#define OFF(x)  ((x)%BITS_PER_LONG)
-#define LONG(x) ((x)/BITS_PER_LONG)
-#define TestBit(bit, array)    ((array[LONG(bit)] >> OFF(bit)) & 1)
-
 static char *rel_axis_names[] = {
     "X",
     "Y",
@@ -328,7 +320,7 @@ EvdevAxisAbsNew(InputInfoPtr pInfo)
 
     real_axes = 0;
     for (i = 0; i < ABS_MAX; i++)
-	if (TestBit (i, pEvdev->bits.abs))
+	if (test_bit (i, pEvdev->bits.abs))
 	    real_axes++;
 
     if (!real_axes)
@@ -344,7 +336,7 @@ EvdevAxisAbsNew(InputInfoPtr pInfo)
     pInfo->conversion_proc = EvdevConvert;
 
     for (i = 0, j = 0; i < ABS_MAX; i++) {
-	if (!TestBit (i, pEvdev->bits.abs))
+	if (!test_bit (i, pEvdev->bits.abs))
 	    continue;
 
 	snprintf(option, sizeof(option), "%sAbsoluteAxisMap", abs_axis_names[i]);
@@ -389,7 +381,7 @@ EvdevAxisAbsNew(InputInfoPtr pInfo)
 	xf86Msg(X_CONFIG, "%s: Unknown Mode: %s.\n", pInfo->name, s);
     }
 
-    if (TestBit (ABS_X, pEvdev->bits.abs) && TestBit (ABS_Y, pEvdev->bits.abs))
+    if (test_bit (ABS_X, pEvdev->bits.abs) && test_bit (ABS_Y, pEvdev->bits.abs))
 	k = xf86SetIntOption(pInfo->options, "AbsoluteScreen", 0);
     else
 	k = xf86SetIntOption(pInfo->options, "AbsoluteScreen", -1);
@@ -417,7 +409,7 @@ EvdevAxisRelNew(InputInfoPtr pInfo)
 
     real_axes = 0;
     for (i = 0; i < REL_MAX; i++)
-	if (TestBit (i, pEvdev->bits.rel))
+	if (test_bit (i, pEvdev->bits.rel))
 	    real_axes++;
 
     if (!real_axes && (!state->abs || state->abs->axes < 2))
@@ -434,7 +426,7 @@ EvdevAxisRelNew(InputInfoPtr pInfo)
     pInfo->conversion_proc = EvdevConvert;
 
     for (i = 0, j = 0; i < REL_MAX; i++) {
-	if (!TestBit (i, pEvdev->bits.rel))
+	if (!test_bit (i, pEvdev->bits.rel))
 	    continue;
 
 	snprintf(option, sizeof(option), "%sRelativeAxisMap", rel_axis_names[i]);
--- a/src/evdev_brain.c
+++ b/src/evdev_brain.c
@@ -86,7 +86,7 @@ typedef struct {
 } evdevDevInfoRec, *evdevDevInfoPtr;
 
 static Bool
-MatchAll (long *dev, long *match, int len)
+MatchAll (unsigned long *dev, unsigned long *match, int len)
 {
     int i;
 
@@ -98,7 +98,7 @@ MatchAll (long *dev, long *match, int le
 }
 
 static Bool
-MatchNot (long *dev, long *match, int len)
+MatchNot (unsigned long *dev, unsigned long *match, int len)
 {
     int i;
 
@@ -110,7 +110,7 @@ MatchNot (long *dev, long *match, int le
 }
 
 static Bool
-MatchAny (long *dev, long *match, int len)
+MatchAny (unsigned long *dev, unsigned long *match, int len)
 {
     int i, found = 0;
 
--- a/src/evdev_btn.c
+++ b/src/evdev_btn.c
@@ -51,15 +51,6 @@
 
 #include <xf86Module.h>
 
-
-#define ArrayLength(a) (sizeof(a) / (sizeof((a)[0])))
-
-#define BITS_PER_LONG (sizeof(long) * 8)
-#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1)
-#define OFF(x)  ((x)%BITS_PER_LONG)
-#define LONG(x) ((x)/BITS_PER_LONG)
-#define TestBit(bit, array)    ((array[LONG(bit)] >> OFF(bit)) & 1)
-
 void
 EvdevBtnPostFakeClicks(InputInfoPtr pInfo, int button, int count)
 {
@@ -186,7 +177,7 @@ EvdevBtnNew(InputInfoPtr pInfo)
     state->btn = Xcalloc (sizeof (evdevBtnRec));
 
     for (i = BTN_MISC; i < (KEY_OK - 1); i++)
-	if (TestBit (i, pEvdev->bits.key)) {
+	if (test_bit (i, pEvdev->bits.key)) {
 	    bit = i;
 	    if ((bit >= BTN_MOUSE) && (bit < BTN_JOYSTICK)) {
 		bit -= BTN_MOUSE - BTN_MISC;
--- a/src/evdev_key.c
+++ b/src/evdev_key.c
@@ -81,11 +81,6 @@
 
 
 #define ArrayLength(a) (sizeof(a) / (sizeof((a)[0])))
-#define BITS_PER_LONG (sizeof(long) * 8)
-#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1)
-#define OFF(x)  ((x)%BITS_PER_LONG)
-#define LONG(x) ((x)/BITS_PER_LONG)
-#define TestBit(bit, array)    ((array[LONG(bit)] >> OFF(bit)) & 1)
 
 #define MIN_KEYCODE 8
 #define GLYPHS_PER_KEY 2
@@ -356,13 +351,13 @@ EvdevKeyNew (InputInfoPtr pInfo)
     int i, keys = 0;
 
     for (i = 0; i <= KEY_UNKNOWN; i++)
-	if (TestBit (i, pEvdev->bits.key)) {
+	if (test_bit (i, pEvdev->bits.key)) {
 	    keys = 1;
 	    break;
 	}
     if (!keys)
 	for (i = KEY_OK; i <= KEY_MAX; i++)
-	    if (TestBit (i, pEvdev->bits.key)) {
+	    if (test_bit (i, pEvdev->bits.key)) {
 		keys = 1;
 		break;
 	    }
--- a/src/inotify-syscalls.h
+++ b/src/inotify-syscalls.h
@@ -39,6 +39,10 @@
 # define __NR_inotify_init	290
 # define __NR_inotify_add_watch	291
 # define __NR_inotify_rm_watch	292
+#elif defined (__hppa__) || defined (__hppa64__)
+# define __NR_inotify_init	269
+# define __NR_inotify_add_watch	270
+# define __NR_inotify_rm_watch	271
 #else
 # error "Unsupported architecture!"
 #endif