summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile43
-rw-r--r--driver/multitouch.c (renamed from src/multitouch.c)0
-rw-r--r--include/button.h43
-rw-r--r--include/common.h (renamed from src/common.h)37
-rw-r--r--include/gestures.h (renamed from src/gestures.h)0
-rw-r--r--include/hwdata.h (renamed from src/hwdata.h)22
-rw-r--r--include/hwstate.h (renamed from src/hwstate.h)6
-rw-r--r--include/match.h (renamed from match/match.h)3
-rw-r--r--include/memory.h (renamed from src/memory.h)0
-rw-r--r--include/mtdev-caps.h (renamed from src/capabilities.h)4
-rw-r--r--include/mtdev-iobuf.h (renamed from src/iobuffer.h)5
-rw-r--r--include/mtouch.h (renamed from src/mtouch.h)3
-rw-r--r--include/mtstate.h (renamed from src/mtstate.h)0
-rw-r--r--include/xbypass.h13
-rw-r--r--match/test.c3
-rw-r--r--mtdev/caps.c (renamed from src/capabilities.c)2
-rw-r--r--mtdev/hwdata.c (renamed from src/hwdata.c)0
-rw-r--r--mtdev/iobuf.c (renamed from src/iobuffer.c)2
-rw-r--r--src/hwstate.c2
-rw-r--r--src/test.c3
20 files changed, 127 insertions, 64 deletions
diff --git a/Makefile b/Makefile
index 294e034..f364845 100644
--- a/Makefile
+++ b/Makefile
@@ -1,40 +1,42 @@
1VERSION = 1 1VERSION = 1
2PATCHLEVEL = 0 2PATCHLEVEL = 0
3EXTRAVERSION = alpha2 3EXTRAVERSION = alpha3
4 4
5LIBRARY = multitouch.so 5LIBRARY = multitouch.so
6FDIS = 11-multitouch.fdi 6FDIS = 11-multitouch.fdi
7MODULES = match src 7MODULES = match mtdev src
8XMODULES = driver
8 9
9o_match = match 10o_match = match
10 11
11o_src = capabilities \ 12o_mtdev = iobuf caps hwdata
12 iobuffer \
13 hwdata \
14 hwstate \
15 mtstate \
16 memory \
17 mtouch \
18 gestures \
19 multitouch
20 13
21TARGETS = $(addsuffix /test,$(MODULES)) 14o_src = hwstate mtstate memory mtouch gestures
15
16o_driver= multitouch
17
18TARGETS += match/test
19TARGETS += src/test
22 20
23OBJECTS = $(addsuffix .o,\ 21OBJECTS = $(addsuffix .o,\
24 $(foreach mod,$(MODULES),\ 22 $(foreach mod,$(MODULES),\
25 $(addprefix $(mod)/,$(o_$(mod))))) 23 $(addprefix $(mod)/,$(o_$(mod)))))
24XOBJECTS= $(addsuffix .o,\
25 $(foreach mod,$(XMODULES),\
26 $(addprefix $(mod)/,$(o_$(mod)))))
26 27
27TBIN = $(addprefix bin/,$(TARGETS)) 28TBIN = $(addprefix bin/,$(TARGETS))
28TLIB = $(addprefix obj/,$(LIBRARY)) 29TLIB = $(addprefix obj/,$(LIBRARY))
29TOBJ = $(addprefix obj/,$(addsuffix .o,$(TARGETS))) 30TOBJ = $(addprefix obj/,$(addsuffix .o,$(TARGETS)))
30TFDI = $(addprefix fdi/,$(FDIS)) 31TFDI = $(addprefix fdi/,$(FDIS))
31OBJS = $(addprefix obj/,$(OBJECTS)) 32OBJS = $(addprefix obj/,$(OBJECTS))
32LIBS = -lX11 -lpixman-1 33XOBJS = $(addprefix obj/,$(XOBJECTS))
34LIBS = -lm
33 35
34DLIB = usr/lib/xorg/modules/input 36DLIB = usr/lib/xorg/modules/input
35DFDI = usr/share/hal/fdi/policy/20thirdparty 37DFDI = usr/share/hal/fdi/policy/20thirdparty
36 38
37INCLUDE = -I. -I/usr/include/xorg -I/usr/include/pixman-1 39INCLUDE = -Iinclude -I/usr/include/xorg -I/usr/include/pixman-1
38OPTS = -O3 -fPIC 40OPTS = -O3 -fPIC
39 41
40.PHONY: all clean 42.PHONY: all clean
@@ -42,13 +44,13 @@ OPTS = -O3 -fPIC
42 44
43all: $(OBJS) $(TLIB) $(TOBJ) $(TBIN) 45all: $(OBJS) $(TLIB) $(TOBJ) $(TBIN)
44 46
45bin/%: obj/%.o 47bin/%: obj/%.o $(OBJS)
46 @mkdir -p $(@D) 48 @mkdir -p $(@D)
47 gcc $< -o $@ 49 gcc $< -o $@ $(OBJS) $(LIBS)
48 50
49$(TLIB): $(OBJS) 51$(TLIB): $(OBJS) $(XOBJS)
50 @rm -f $(TLIB) 52 @rm -f $(TLIB)
51 gcc -shared $(OBJS) -Wl,-soname -Wl,$(LIBRARY) -o $@ 53 gcc -shared $(OBJS) $(XOBJS) -Wl,-soname -Wl,$(LIBRARY) -o $@
52 54
53obj/%.o: %.c 55obj/%.o: %.c
54 @mkdir -p $(@D) 56 @mkdir -p $(@D)
@@ -69,8 +71,3 @@ install: $(TLIB) $(TFDI)
69 install -d "$(DESTDIR)/$(DFDI)" 71 install -d "$(DESTDIR)/$(DFDI)"
70 install -m 755 $(TLIB) "$(DESTDIR)/$(DLIB)" 72 install -m 755 $(TLIB) "$(DESTDIR)/$(DLIB)"
71 install -m 644 $(TFDI) "$(DESTDIR)/$(DFDI)" 73 install -m 644 $(TFDI) "$(DESTDIR)/$(DFDI)"
72
73test:
74 gcc $< $(OBJS) -o LINKTEST
75
76obj/match/test.o: match/match.c
diff --git a/src/multitouch.c b/driver/multitouch.c
index 7e275b3..7e275b3 100644
--- a/src/multitouch.c
+++ b/driver/multitouch.c
diff --git a/include/button.h b/include/button.h
new file mode 100644
index 0000000..0ebfbc7
--- /dev/null
+++ b/include/button.h
@@ -0,0 +1,43 @@
1/***************************************************************************
2 *
3 * Multitouch X driver
4 * Copyright (C) 2008 Henrik Rydberg <rydberg@euromail.se>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 **************************************************************************/
21
22#ifndef BUTTON_H
23#define BUTTON_H
24
25#define DIM_BUTTON 15
26
27#define MT_BUTTON_LEFT 0
28#define MT_BUTTON_MIDDLE 1
29#define MT_BUTTON_RIGHT 2
30#define MT_BUTTON_WHEEL_UP 3
31#define MT_BUTTON_WHEEL_DOWN 4
32#define MT_BUTTON_HWHEEL_LEFT 5
33#define MT_BUTTON_HWHEEL_RIGHT 6
34#define MT_BUTTON_SWIPE_UP 7
35#define MT_BUTTON_SWIPE_DOWN 8
36#define MT_BUTTON_SWIPE_LEFT 9
37#define MT_BUTTON_SWIPE_RIGHT 10
38#define MT_BUTTON_SCALE_DOWN 11
39#define MT_BUTTON_SCALE_UP 12
40#define MT_BUTTON_ROTATE_LEFT 13
41#define MT_BUTTON_ROTATE_RIGHT 14
42
43#endif
diff --git a/src/common.h b/include/common.h
index 32be48d..09582ce 100644
--- a/src/common.h
+++ b/include/common.h
@@ -28,7 +28,6 @@
28#include <xf86Xinput.h> 28#include <xf86Xinput.h>
29#include <linux/input.h> 29#include <linux/input.h>
30#include <errno.h> 30#include <errno.h>
31#include <match/match.h>
32 31
33/* includes available in 2.6.30-rc5 */ 32/* includes available in 2.6.30-rc5 */
34 33
@@ -43,6 +42,7 @@
43#define ABS_MT_POSITION_Y 0x36 /* Center Y ellipse position */ 42#define ABS_MT_POSITION_Y 0x36 /* Center Y ellipse position */
44#define ABS_MT_TOOL_TYPE 0x37 /* Type of touching device */ 43#define ABS_MT_TOOL_TYPE 0x37 /* Type of touching device */
45#define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */ 44#define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */
45#define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */
46#define SYN_MT_REPORT 2 46#define SYN_MT_REPORT 2
47#define MT_TOOL_FINGER 0 47#define MT_TOOL_FINGER 0
48#define MT_TOOL_PEN 1 48#define MT_TOOL_PEN 1
@@ -53,13 +53,43 @@
53#define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */ 53#define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */
54#endif 54#endif
55 55
56#define SYSCALL(call) while (((call) == -1) && (errno == EINTR)) 56/* includes available in 2.6.36 */
57#ifndef ABS_MT_SLOT
58#define ABS_MT_SLOT 0x2f /* MT slot being modified */
59#define MT_ABS_SIZE 11 /* Size of MT_SLOT_ABS_EVENTS */
60#define MT_SLOT_ABS_EVENTS { \
61 ABS_MT_TOUCH_MAJOR, \
62 ABS_MT_TOUCH_MINOR, \
63 ABS_MT_WIDTH_MAJOR, \
64 ABS_MT_WIDTH_MINOR, \
65 ABS_MT_ORIENTATION, \
66 ABS_MT_POSITION_X, \
67 ABS_MT_POSITION_Y, \
68 ABS_MT_TOOL_TYPE, \
69 ABS_MT_BLOB_ID, \
70 ABS_MT_TRACKING_ID, \
71 ABS_MT_PRESSURE, \
72}
73#endif
74
75#define DIM_FINGER 32
76#define DIM2_FINGER (DIM_FINGER * DIM_FINGER)
77
78/* event buffer size (must be a power of two) */
79#define DIM_EVENTS 64
80
81/* year-proof millisecond event time */
82typedef __u64 mstime_t;
83
84/* all bit masks have this type */
85typedef unsigned int bitmask_t;
57 86
58#define BITMASK(x) (1U << (x)) 87#define BITMASK(x) (1U << (x))
59#define BITONES(x) (BITMASK(x) - 1U) 88#define BITONES(x) (BITMASK(x) - 1U)
60#define GETBIT(m, x) (((m) >> (x)) & 1U) 89#define GETBIT(m, x) (((m) >> (x)) & 1U)
61#define SETBIT(m, x) (m |= BITMASK(x)) 90#define SETBIT(m, x) (m |= BITMASK(x))
62#define CLEARBIT(m, x) (m &= ~BITMASK(x)) 91#define CLEARBIT(m, x) (m &= ~BITMASK(x))
92#define MODBIT(m, x, b) ((b) ? SETBIT(m, x) : CLEARBIT(m, x))
63 93
64static inline int maxval(int x, int y) { return x > y ? x : y; } 94static inline int maxval(int x, int y) { return x > y ? x : y; }
65static inline int minval(int x, int y) { return x < y ? x : y; } 95static inline int minval(int x, int y) { return x < y ? x : y; }
@@ -92,4 +122,7 @@ static inline int bitcount(unsigned v)
92#define foreach_bit(i, m) \ 122#define foreach_bit(i, m) \
93 for (i = firstbit(m); i >= 0; i = firstbit((m) & (~0U << i + 1))) 123 for (i = firstbit(m); i >= 0; i = firstbit((m) & (~0U << i + 1)))
94 124
125/* robust system ioctl calls */
126#define SYSCALL(call) while (((call) == -1) && (errno == EINTR))
127
95#endif 128#endif
diff --git a/src/gestures.h b/include/gestures.h
index 2866ba4..2866ba4 100644
--- a/src/gestures.h
+++ b/include/gestures.h
diff --git a/src/hwdata.h b/include/hwdata.h
index 42d0a19..21864dc 100644
--- a/src/hwdata.h
+++ b/include/hwdata.h
@@ -23,24 +23,7 @@
23#define HWDATA_H 23#define HWDATA_H
24 24
25#include "common.h" 25#include "common.h"
26 26#include "button.h"
27#define DIM_BUTTON 15
28
29#define MT_BUTTON_LEFT 0
30#define MT_BUTTON_MIDDLE 1
31#define MT_BUTTON_RIGHT 2
32#define MT_BUTTON_WHEEL_UP 3
33#define MT_BUTTON_WHEEL_DOWN 4
34#define MT_BUTTON_HWHEEL_LEFT 5
35#define MT_BUTTON_HWHEEL_RIGHT 6
36#define MT_BUTTON_SWIPE_UP 7
37#define MT_BUTTON_SWIPE_DOWN 8
38#define MT_BUTTON_SWIPE_LEFT 9
39#define MT_BUTTON_SWIPE_RIGHT 10
40#define MT_BUTTON_SCALE_DOWN 11
41#define MT_BUTTON_SCALE_UP 12
42#define MT_BUTTON_ROTATE_LEFT 13
43#define MT_BUTTON_ROTATE_RIGHT 14
44 27
45#define BIT_MT_TOUCH_MAJOR 0 28#define BIT_MT_TOUCH_MAJOR 0
46#define BIT_MT_TOUCH_MINOR 1 29#define BIT_MT_TOUCH_MINOR 1
@@ -59,9 +42,6 @@ struct FingerData {
59 int position_x, position_y; 42 int position_x, position_y;
60}; 43};
61 44
62/* year-proof millisecond event time */
63typedef __u64 mstime_t;
64
65/** 45/**
66 * struct HWData - hardware reads 46 * struct HWData - hardware reads
67 * 47 *
diff --git a/src/hwstate.h b/include/hwstate.h
index b8c2ba0..76ed016 100644
--- a/src/hwstate.h
+++ b/include/hwstate.h
@@ -19,10 +19,10 @@
19 * 19 *
20 **************************************************************************/ 20 **************************************************************************/
21 21
22#ifndef MTEVENT_H 22#ifndef HWSTATE_H
23#define MTEVENT_H 23#define HWSTATE_H
24 24
25#include "capabilities.h" 25#include "mtdev-caps.h"
26#include "hwdata.h" 26#include "hwdata.h"
27 27
28/* zero id means not mapped (not touching) */ 28/* zero id means not mapped (not touching) */
diff --git a/match/match.h b/include/match.h
index ec44a24..25842fc 100644
--- a/match/match.h
+++ b/include/match.h
@@ -28,8 +28,7 @@
28 * Bitmasks are used extensively. 28 * Bitmasks are used extensively.
29 */ 29 */
30 30
31#define DIM_FINGER 32 31#include "common.h"
32#define DIM2_FINGER (DIM_FINGER * DIM_FINGER)
33 32
34void match_fingers(int index[DIM_FINGER], int A[DIM2_FINGER], 33void match_fingers(int index[DIM_FINGER], int A[DIM2_FINGER],
35 int nrow, int ncol); 34 int nrow, int ncol);
diff --git a/src/memory.h b/include/memory.h
index 8ffbdab..8ffbdab 100644
--- a/src/memory.h
+++ b/include/memory.h
diff --git a/src/capabilities.h b/include/mtdev-caps.h
index 23086bd..8f88404 100644
--- a/src/capabilities.h
+++ b/include/mtdev-caps.h
@@ -19,8 +19,8 @@
19 * 19 *
20 **************************************************************************/ 20 **************************************************************************/
21 21
22#ifndef CAPABILITIES_H 22#ifndef MTDEV_CAPS_H
23#define CAPABILITIES_H 23#define MTDEV_CAPS_H
24 24
25#include "common.h" 25#include "common.h"
26 26
diff --git a/src/iobuffer.h b/include/mtdev-iobuf.h
index 2e3d0c8..976b85b 100644
--- a/src/iobuffer.h
+++ b/include/mtdev-iobuf.h
@@ -19,13 +19,12 @@
19 * 19 *
20 **************************************************************************/ 20 **************************************************************************/
21 21
22#ifndef IOBUFFER_H 22#ifndef MTDEV_IOBUF_H
23#define IOBUFFER_H 23#define MTDEV_IOBUF_H
24 24
25#include "common.h" 25#include "common.h"
26 26
27#define EVENT_SIZE sizeof(struct input_event) 27#define EVENT_SIZE sizeof(struct input_event)
28#define DIM_EVENTS 64
29#define DIM_BUFFER (DIM_EVENTS * EVENT_SIZE) 28#define DIM_BUFFER (DIM_EVENTS * EVENT_SIZE)
30 29
31struct IOBuffer { 30struct IOBuffer {
diff --git a/src/mtouch.h b/include/mtouch.h
index aab35bd..a495960 100644
--- a/src/mtouch.h
+++ b/include/mtouch.h
@@ -22,8 +22,7 @@
22#ifndef MTOUCH_H 22#ifndef MTOUCH_H
23#define MTOUCH_H 23#define MTOUCH_H
24 24
25#include "capabilities.h" 25#include "mtdev-iobuf.h"
26#include "iobuffer.h"
27#include "hwdata.h" 26#include "hwdata.h"
28#include "hwstate.h" 27#include "hwstate.h"
29#include "mtstate.h" 28#include "mtstate.h"
diff --git a/src/mtstate.h b/include/mtstate.h
index ac0b18d..ac0b18d 100644
--- a/src/mtstate.h
+++ b/include/mtstate.h
diff --git a/include/xbypass.h b/include/xbypass.h
new file mode 100644
index 0000000..35c65e1
--- /dev/null
+++ b/include/xbypass.h
@@ -0,0 +1,13 @@
1#ifndef XBYPASS_H
2#define XBYPASS_H
3
4#include <stdarg.h>
5void xf86Msg(int type, const char *format, ...)
6{
7 va_list args;
8 va_start(args, format);
9 vfprintf(stderr, format, args);
10 va_end(args);
11}
12
13#endif
diff --git a/match/test.c b/match/test.c
index f9f2a27..dabc083 100644
--- a/match/test.c
+++ b/match/test.c
@@ -19,9 +19,10 @@
19 * 19 *
20 **************************************************************************/ 20 **************************************************************************/
21 21
22#include <match.h>
23#include <xbypass.h>
22#include <stdio.h> 24#include <stdio.h>
23#include <time.h> 25#include <time.h>
24#include "match.c"
25 26
26#define ITS 1000000 27#define ITS 1000000
27 28
diff --git a/src/capabilities.c b/mtdev/caps.c
index cd96e8e..51e7f5b 100644
--- a/src/capabilities.c
+++ b/mtdev/caps.c
@@ -19,7 +19,7 @@
19 * 19 *
20 **************************************************************************/ 20 **************************************************************************/
21 21
22#include "capabilities.h" 22#include <mtdev-caps.h>
23 23
24#define SETABS(c, x, map, key, fd) \ 24#define SETABS(c, x, map, key, fd) \
25 (c->has_##x = getbit(map, key) && getabs(&c->abs_##x, key, fd)) 25 (c->has_##x = getbit(map, key) && getabs(&c->abs_##x, key, fd))
diff --git a/src/hwdata.c b/mtdev/hwdata.c
index 689418e..689418e 100644
--- a/src/hwdata.c
+++ b/mtdev/hwdata.c
diff --git a/src/iobuffer.c b/mtdev/iobuf.c
index 35b61e9..8e367b8 100644
--- a/src/iobuffer.c
+++ b/mtdev/iobuf.c
@@ -19,7 +19,7 @@
19 * 19 *
20 **************************************************************************/ 20 **************************************************************************/
21 21
22#include "iobuffer.h" 22#include <mtdev-iobuf.h>
23 23
24void init_iobuf(struct IOBuffer *buf) 24void init_iobuf(struct IOBuffer *buf)
25{ 25{
diff --git a/src/hwstate.c b/src/hwstate.c
index a68b81a..81f4b8b 100644
--- a/src/hwstate.c
+++ b/src/hwstate.c
@@ -20,8 +20,6 @@
20 **************************************************************************/ 20 **************************************************************************/
21 21
22#include "hwstate.h" 22#include "hwstate.h"
23#include <stdlib.h>
24#include <limits.h>
25 23
26#define NOTOUCH(hw, c) ((hw)->touch_major == 0 && (c)->has_touch_major) 24#define NOTOUCH(hw, c) ((hw)->touch_major == 0 && (c)->has_touch_major)
27 25
diff --git a/src/test.c b/src/test.c
index fc16201..7d983a0 100644
--- a/src/test.c
+++ b/src/test.c
@@ -19,7 +19,8 @@
19 * 19 *
20 **************************************************************************/ 20 **************************************************************************/
21 21
22#include "common.h" 22#include <common.h>
23#include <xbypass.h>
23#include <stdio.h> 24#include <stdio.h>
24#include <time.h> 25#include <time.h>
25 26