diff options
-rw-r--r-- | Makefile | 43 | ||||
-rw-r--r-- | driver/multitouch.c (renamed from src/multitouch.c) | 0 | ||||
-rw-r--r-- | include/button.h | 43 | ||||
-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.h | 13 | ||||
-rw-r--r-- | match/test.c | 3 | ||||
-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.c | 2 | ||||
-rw-r--r-- | src/test.c | 3 |
20 files changed, 127 insertions, 64 deletions
@@ -1,40 +1,42 @@ VERSION = 1 PATCHLEVEL = 0 -EXTRAVERSION = alpha2 +EXTRAVERSION = alpha3 LIBRARY = multitouch.so FDIS = 11-multitouch.fdi -MODULES = match src +MODULES = match mtdev src +XMODULES = driver o_match = match -o_src = capabilities \ - iobuffer \ - hwdata \ - hwstate \ - mtstate \ - memory \ - mtouch \ - gestures \ - multitouch +o_mtdev = iobuf caps hwdata -TARGETS = $(addsuffix /test,$(MODULES)) +o_src = hwstate mtstate memory mtouch gestures + +o_driver= multitouch + +TARGETS += match/test +TARGETS += src/test OBJECTS = $(addsuffix .o,\ $(foreach mod,$(MODULES),\ $(addprefix $(mod)/,$(o_$(mod))))) +XOBJECTS= $(addsuffix .o,\ + $(foreach mod,$(XMODULES),\ + $(addprefix $(mod)/,$(o_$(mod))))) TBIN = $(addprefix bin/,$(TARGETS)) TLIB = $(addprefix obj/,$(LIBRARY)) TOBJ = $(addprefix obj/,$(addsuffix .o,$(TARGETS))) TFDI = $(addprefix fdi/,$(FDIS)) OBJS = $(addprefix obj/,$(OBJECTS)) -LIBS = -lX11 -lpixman-1 +XOBJS = $(addprefix obj/,$(XOBJECTS)) +LIBS = -lm DLIB = usr/lib/xorg/modules/input DFDI = usr/share/hal/fdi/policy/20thirdparty -INCLUDE = -I. -I/usr/include/xorg -I/usr/include/pixman-1 +INCLUDE = -Iinclude -I/usr/include/xorg -I/usr/include/pixman-1 OPTS = -O3 -fPIC .PHONY: all clean @@ -42,13 +44,13 @@ OPTS = -O3 -fPIC all: $(OBJS) $(TLIB) $(TOBJ) $(TBIN) -bin/%: obj/%.o +bin/%: obj/%.o $(OBJS) @mkdir -p $(@D) - gcc $< -o $@ + gcc $< -o $@ $(OBJS) $(LIBS) -$(TLIB): $(OBJS) +$(TLIB): $(OBJS) $(XOBJS) @rm -f $(TLIB) - gcc -shared $(OBJS) -Wl,-soname -Wl,$(LIBRARY) -o $@ + gcc -shared $(OBJS) $(XOBJS) -Wl,-soname -Wl,$(LIBRARY) -o $@ obj/%.o: %.c @mkdir -p $(@D) @@ -69,8 +71,3 @@ install: $(TLIB) $(TFDI) install -d "$(DESTDIR)/$(DFDI)" install -m 755 $(TLIB) "$(DESTDIR)/$(DLIB)" install -m 644 $(TFDI) "$(DESTDIR)/$(DFDI)" - -test: - gcc $< $(OBJS) -o LINKTEST - -obj/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 @@ +/*************************************************************************** + * + * Multitouch X driver + * Copyright (C) 2008 Henrik Rydberg <rydberg@euromail.se> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + **************************************************************************/ + +#ifndef BUTTON_H +#define BUTTON_H + +#define DIM_BUTTON 15 + +#define MT_BUTTON_LEFT 0 +#define MT_BUTTON_MIDDLE 1 +#define MT_BUTTON_RIGHT 2 +#define MT_BUTTON_WHEEL_UP 3 +#define MT_BUTTON_WHEEL_DOWN 4 +#define MT_BUTTON_HWHEEL_LEFT 5 +#define MT_BUTTON_HWHEEL_RIGHT 6 +#define MT_BUTTON_SWIPE_UP 7 +#define MT_BUTTON_SWIPE_DOWN 8 +#define MT_BUTTON_SWIPE_LEFT 9 +#define MT_BUTTON_SWIPE_RIGHT 10 +#define MT_BUTTON_SCALE_DOWN 11 +#define MT_BUTTON_SCALE_UP 12 +#define MT_BUTTON_ROTATE_LEFT 13 +#define MT_BUTTON_ROTATE_RIGHT 14 + +#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 @@ #include <xf86Xinput.h> #include <linux/input.h> #include <errno.h> -#include <match/match.h> /* includes available in 2.6.30-rc5 */ @@ -43,6 +42,7 @@ #define ABS_MT_POSITION_Y 0x36 /* Center Y ellipse position */ #define ABS_MT_TOOL_TYPE 0x37 /* Type of touching device */ #define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */ +#define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */ #define SYN_MT_REPORT 2 #define MT_TOOL_FINGER 0 #define MT_TOOL_PEN 1 @@ -53,13 +53,43 @@ #define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */ #endif -#define SYSCALL(call) while (((call) == -1) && (errno == EINTR)) +/* includes available in 2.6.36 */ +#ifndef ABS_MT_SLOT +#define ABS_MT_SLOT 0x2f /* MT slot being modified */ +#define MT_ABS_SIZE 11 /* Size of MT_SLOT_ABS_EVENTS */ +#define MT_SLOT_ABS_EVENTS { \ + ABS_MT_TOUCH_MAJOR, \ + ABS_MT_TOUCH_MINOR, \ + ABS_MT_WIDTH_MAJOR, \ + ABS_MT_WIDTH_MINOR, \ + ABS_MT_ORIENTATION, \ + ABS_MT_POSITION_X, \ + ABS_MT_POSITION_Y, \ + ABS_MT_TOOL_TYPE, \ + ABS_MT_BLOB_ID, \ + ABS_MT_TRACKING_ID, \ + ABS_MT_PRESSURE, \ +} +#endif + +#define DIM_FINGER 32 +#define DIM2_FINGER (DIM_FINGER * DIM_FINGER) + +/* event buffer size (must be a power of two) */ +#define DIM_EVENTS 64 + +/* year-proof millisecond event time */ +typedef __u64 mstime_t; + +/* all bit masks have this type */ +typedef unsigned int bitmask_t; #define BITMASK(x) (1U << (x)) #define BITONES(x) (BITMASK(x) - 1U) #define GETBIT(m, x) (((m) >> (x)) & 1U) #define SETBIT(m, x) (m |= BITMASK(x)) #define CLEARBIT(m, x) (m &= ~BITMASK(x)) +#define MODBIT(m, x, b) ((b) ? SETBIT(m, x) : CLEARBIT(m, x)) static inline int maxval(int x, int y) { return x > y ? x : y; } static inline int minval(int x, int y) { return x < y ? x : y; } @@ -92,4 +122,7 @@ static inline int bitcount(unsigned v) #define foreach_bit(i, m) \ for (i = firstbit(m); i >= 0; i = firstbit((m) & (~0U << i + 1))) +/* robust system ioctl calls */ +#define SYSCALL(call) while (((call) == -1) && (errno == EINTR)) + #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 @@ #define HWDATA_H #include "common.h" - -#define DIM_BUTTON 15 - -#define MT_BUTTON_LEFT 0 -#define MT_BUTTON_MIDDLE 1 -#define MT_BUTTON_RIGHT 2 -#define MT_BUTTON_WHEEL_UP 3 -#define MT_BUTTON_WHEEL_DOWN 4 -#define MT_BUTTON_HWHEEL_LEFT 5 -#define MT_BUTTON_HWHEEL_RIGHT 6 -#define MT_BUTTON_SWIPE_UP 7 -#define MT_BUTTON_SWIPE_DOWN 8 -#define MT_BUTTON_SWIPE_LEFT 9 -#define MT_BUTTON_SWIPE_RIGHT 10 -#define MT_BUTTON_SCALE_DOWN 11 -#define MT_BUTTON_SCALE_UP 12 -#define MT_BUTTON_ROTATE_LEFT 13 -#define MT_BUTTON_ROTATE_RIGHT 14 +#include "button.h" #define BIT_MT_TOUCH_MAJOR 0 #define BIT_MT_TOUCH_MINOR 1 @@ -59,9 +42,6 @@ struct FingerData { int position_x, position_y; }; -/* year-proof millisecond event time */ -typedef __u64 mstime_t; - /** * struct HWData - hardware reads * 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 @@ * **************************************************************************/ -#ifndef MTEVENT_H -#define MTEVENT_H +#ifndef HWSTATE_H +#define HWSTATE_H -#include "capabilities.h" +#include "mtdev-caps.h" #include "hwdata.h" /* 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 @@ * Bitmasks are used extensively. */ -#define DIM_FINGER 32 -#define DIM2_FINGER (DIM_FINGER * DIM_FINGER) +#include "common.h" void match_fingers(int index[DIM_FINGER], int A[DIM2_FINGER], 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 @@ * **************************************************************************/ -#ifndef CAPABILITIES_H -#define CAPABILITIES_H +#ifndef MTDEV_CAPS_H +#define MTDEV_CAPS_H #include "common.h" 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 @@ * **************************************************************************/ -#ifndef IOBUFFER_H -#define IOBUFFER_H +#ifndef MTDEV_IOBUF_H +#define MTDEV_IOBUF_H #include "common.h" #define EVENT_SIZE sizeof(struct input_event) -#define DIM_EVENTS 64 #define DIM_BUFFER (DIM_EVENTS * EVENT_SIZE) struct 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 @@ #ifndef MTOUCH_H #define MTOUCH_H -#include "capabilities.h" -#include "iobuffer.h" +#include "mtdev-iobuf.h" #include "hwdata.h" #include "hwstate.h" #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 @@ +#ifndef XBYPASS_H +#define XBYPASS_H + +#include <stdarg.h> +void xf86Msg(int type, const char *format, ...) +{ + va_list args; + va_start(args, format); + vfprintf(stderr, format, args); + va_end(args); +} + +#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 @@ * **************************************************************************/ +#include <match.h> +#include <xbypass.h> #include <stdio.h> #include <time.h> -#include "match.c" #define ITS 1000000 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 @@ * **************************************************************************/ -#include "capabilities.h" +#include <mtdev-caps.h> #define SETABS(c, x, map, key, fd) \ (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 @@ * **************************************************************************/ -#include "iobuffer.h" +#include <mtdev-iobuf.h> void init_iobuf(struct IOBuffer *buf) { 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 @@ **************************************************************************/ #include "hwstate.h" -#include <stdlib.h> -#include <limits.h> #define NOTOUCH(hw, c) ((hw)->touch_major == 0 && (c)->has_touch_major) @@ -19,7 +19,8 @@ * **************************************************************************/ -#include "common.h" +#include <common.h> +#include <xbypass.h> #include <stdio.h> #include <time.h> |