diff options
author | Christoph Brill <egore911@egore911.de> | 2008-06-06 21:28:44 +0200 |
---|---|---|
committer | Christoph Brill <egore911@egore911.de> | 2008-06-06 21:28:44 +0200 |
commit | 7761e3903fa70aed951c0fc81b58382cf0ac6057 (patch) | |
tree | cb9d66afc4602552a002349b2cfdfd7a56545a20 | |
parent | da95796d0686b474ebd0752959e5d1706d82b1c3 (diff) |
Initial version that passes "make distcheck".
This version is able to build against latest xorg git (including xinput
changes for MPX). It incoperates many concepts stolen from xf86-input-evdev.
I'm not sure about *BSD support, but from what I understood psmcomm is only
used on *BSD whild eventcomm is only used on Linux. So I enabled the build
of these only on the given operating system. Also fix some minor issues that
are related to the old build system (VERSION_ID related).
-rw-r--r-- | .gitignore | 5 | ||||
-rw-r--r-- | ChangeLog | 14 | ||||
-rw-r--r-- | man/synaptics.man (renamed from man/synaptics.5) | 0 | ||||
-rw-r--r-- | src/Makefile.am | 17 | ||||
-rw-r--r-- | src/alpscomm.c | 4 | ||||
-rw-r--r-- | src/eventcomm.c | 8 | ||||
-rw-r--r-- | src/eventcomm.h | 6 | ||||
-rw-r--r-- | src/freebsd_mouse.h | 55 | ||||
-rw-r--r-- | src/linux_input.h | 82 | ||||
-rw-r--r-- | src/ps2comm.c | 4 | ||||
-rw-r--r-- | src/psmcomm.c | 8 | ||||
-rw-r--r-- | src/psmcomm.h | 6 | ||||
-rw-r--r-- | src/synaptics.c | 40 | ||||
-rw-r--r-- | src/synclient.c | 6 | ||||
-rw-r--r-- | src/syndaemon.c | 4 |
15 files changed, 102 insertions, 157 deletions
@@ -17,3 +17,8 @@ libtool ltmain.sh missing stamp-h1 +src/.libs +src/.deps +*.o +synclient +syndaemon @@ -1,3 +1,17 @@ 2008-06-06 Christoph Brill <egore911@egore911.de> + * src/freebsd_mouse.h, src/linux_input.h: drop and use installed + system headers + * src/alpscomm.c, src/eventcomm.c, src/ps2comm.c, src/psmcomm.c, + src/psmcomm.h, src/synaptics.c, src/synclient.c, src/syndaemon.c: Add + config.h + * src/eventcomm.c, src/eventcomm.h: Only build on Linux + * src/psmcomm.c, src/psmcomm.h: Only build on *BSD + * src/synaptics.c, src/synclient.c: Make it build on the new build + system + * src/synaptics.c: Fix build against latest git by replacing all the + xf86_ansi.h functions by the native ones + +2008-06-06 Christoph Brill <egore911@egore911.de> + * src/*.c, src/*.h: move files to a directory diff --git a/man/synaptics.5 b/man/synaptics.man index 6e99bd0..6e99bd0 100644 --- a/man/synaptics.5 +++ b/man/synaptics.man diff --git a/src/Makefile.am b/src/Makefile.am index 2221bbc..98a14c0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -28,4 +28,19 @@ @DRIVER_NAME@_drv_la_LDFLAGS = -module -avoid-version @DRIVER_NAME@_drv_ladir = @inputdir@ -@DRIVER_NAME@_drv_la_SOURCES = @DRIVER_NAME@.c +@DRIVER_NAME@_drv_la_SOURCES = @DRIVER_NAME@.c @DRIVER_NAME@.h \ + alpscomm.c alpscomm.h \ + eventcomm.c eventcomm.h \ + ps2comm.c ps2comm.h \ + psmcomm.c psmcomm.h \ + synproto.h + +bin_PROGRAMS = \ + synclient \ + syndaemon + +synclient_SOURCES = synclient.c +synclient_LDFLAGS = -lm + +syndaemon_SOURCES = syndaemon.c +syndaemon_LDFLAGS = -lXi diff --git a/src/alpscomm.c b/src/alpscomm.c index 89d2a4a..955e88f 100644 --- a/src/alpscomm.c +++ b/src/alpscomm.c @@ -19,6 +19,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "alpscomm.h" #include "synproto.h" #include "synaptics.h" diff --git a/src/eventcomm.c b/src/eventcomm.c index e3257cd..83da68b 100644 --- a/src/eventcomm.c +++ b/src/eventcomm.c @@ -17,6 +17,12 @@ * */ +#ifdef __LINUX + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "eventcomm.h" #include <errno.h> #include <sys/types.h> @@ -316,3 +322,5 @@ struct SynapticsProtocolOperations event_proto_operations = { EventReadHwState, EventAutoDevProbe }; + +#endif diff --git a/src/eventcomm.h b/src/eventcomm.h index 8a78c38..93bf34d 100644 --- a/src/eventcomm.h +++ b/src/eventcomm.h @@ -19,10 +19,14 @@ #ifndef _EVENTCOMM_H_ #define _EVENTCOMM_H_ -#include "linux_input.h" +#ifdef __LINUX + +#include <linux/input.h> /* for auto-dev: */ #define DEV_INPUT_EVENT "/dev/input" #define EVENT_DEV_NAME "event" +#endif + #endif /* _EVENTCOMM_H_ */ diff --git a/src/freebsd_mouse.h b/src/freebsd_mouse.h deleted file mode 100644 index 6c134f1..0000000 --- a/src/freebsd_mouse.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef _FREEBSD_MOUSE_H_ -#define _FREEBSD_MOUSE_H_ - - -typedef struct mousehw { - int buttons; /* -1 if unknown */ - int iftype; /* MOUSE_IF_XXX */ - int type; /* mouse/track ball/pad... */ - int model; /* I/F dependent model ID: MOUSE_MODEL_XXX */ - int hwid; /* I/F dependent hardware ID - * for the PS/2 mouse, it will be PSM_XXX_ID - */ -} mousehw_t; - -/* ioctls */ -#define MOUSE_GETSTATUS _IOR('M', 0, mousestatus_t) -#define MOUSE_GETHWINFO _IOR('M', 1, mousehw_t) -#define MOUSE_GETMODE _IOR('M', 2, mousemode_t) -#define MOUSE_SETMODE _IOW('M', 3, mousemode_t) -#define MOUSE_GETLEVEL _IOR('M', 4, int) -#define MOUSE_SETLEVEL _IOW('M', 5, int) -#define MOUSE_GETVARS _IOR('M', 6, mousevar_t) -#define MOUSE_SETVARS _IOW('M', 7, mousevar_t) -#define MOUSE_READSTATE _IOWR('M', 8, mousedata_t) -#define MOUSE_READDATA _IOWR('M', 9, mousedata_t) -#define MOUSE_SYN_GETHWINFO _IOR('M', 100, synapticshw_t) - - -typedef struct synapticshw { - int infoMajor; - int infoMinor; - int infoRot180; - int infoPortrait; - int infoSensor; - int infoHardware; - int infoNewAbs; - int capPen; - int infoSimplC; - int infoGeometry; - int capExtended; - int capSleep; - int capFourButtons; - int capMultiFinger; - int capPalmDetect; - int capPassthrough; -} synapticshw_t; - - -#define MOUSE_MODEL_SYNAPTICS 13 - -/* Synaptics Touchpad */ -#define MOUSE_SYNAPTICS_PACKETSIZE 6 - - -#endif /* _FREEBSD_MOUSE_H_ */ diff --git a/src/linux_input.h b/src/linux_input.h deleted file mode 100644 index ed7bfad..0000000 --- a/src/linux_input.h +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef _LINUX_INPUT_H_ -#define _LINUX_INPUT_H_ - -/* - * These defines are taken from input.h in the linux kernel source tree. - * Copyright (c) 1999-2002 Vojtech Pavlik - */ - -/* - * The event structure. - */ -struct input_event { - unsigned long tv_sec; - unsigned long tv_usec; - unsigned short type; - unsigned short code; - int value; -}; - -struct input_id { - unsigned short bustype; - unsigned short vendor; - unsigned short product; - unsigned short version; -}; - -struct input_absinfo { - int value; - int minimum; - int maximum; - int fuzz; - int flat; -}; - -#define EVIOCGID _IOR('E', 0x02, struct input_id) /* get device ID */ -#define EVIOCGRAB _IOW('E', 0x90, int) /* Grab/Release device */ -#define EVIOCGBIT(ev,len) _IOC(_IOC_READ, 'E', 0x20 + ev, len) /* get event bits */ -#define EVIOCGABS(abs) _IOR('E', 0x40 + abs, struct input_absinfo) /* get abs value/limits */ - -#define EV_SYN 0x00 -#define EV_KEY 0x01 -#define EV_REL 0x02 -#define EV_ABS 0x03 -#define EV_MSC 0x04 -#define EV_MAX 0x1f - -#define SYN_REPORT 0 - -#define BTN_LEFT 0x110 -#define BTN_RIGHT 0x111 -#define BTN_MIDDLE 0x112 -#define BTN_FORWARD 0x115 -#define BTN_BACK 0x116 -#define BTN_0 0x100 -#define BTN_1 0x101 -#define BTN_2 0x102 -#define BTN_3 0x103 -#define BTN_4 0x104 -#define BTN_5 0x105 -#define BTN_6 0x106 -#define BTN_7 0x107 -#define BTN_A 0x130 -#define BTN_B 0x131 -#define BTN_TOOL_PEN 0x140 -#define BTN_TOOL_FINGER 0x145 -#define BTN_TOOL_DOUBLETAP 0x14d -#define BTN_TOOL_TRIPLETAP 0x14e - -#define KEY_MAX 0x1ff - -#define REL_X 0x00 -#define REL_Y 0x01 - -#define ABS_X 0x00 -#define ABS_Y 0x01 -#define ABS_PRESSURE 0x18 -#define ABS_TOOL_WIDTH 0x1c - -#define MSC_GESTURE 0x02 - - -#endif /* _LINUX_INPUT_H_ */ diff --git a/src/ps2comm.c b/src/ps2comm.c index fe1b929..c805785 100644 --- a/src/ps2comm.c +++ b/src/ps2comm.c @@ -25,6 +25,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "ps2comm.h" #include "synproto.h" #include "synaptics.h" diff --git a/src/psmcomm.c b/src/psmcomm.c index 125ccd6..cf995b1 100644 --- a/src/psmcomm.c +++ b/src/psmcomm.c @@ -28,6 +28,12 @@ * */ +#if defined(__FreeBSD) || defined(__NetBSD__) || defined(__OpenBSD) + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "psmcomm.h" #include <errno.h> #include <string.h> @@ -169,3 +175,5 @@ struct SynapticsProtocolOperations psm_proto_operations = { PSMReadHwState, PSMAutoDevProbe }; + +#endif diff --git a/src/psmcomm.h b/src/psmcomm.h index a3162a2..72aaf83 100644 --- a/src/psmcomm.h +++ b/src/psmcomm.h @@ -1,8 +1,12 @@ #ifndef _PSMCOMM_H_ #define _PSMCOMM_H_ +#if defined(__FreeBSD) || defined(__NetBSD__) || defined(__OpenBSD) + #include <unistd.h> #include <sys/ioctl.h> -#include "freebsd_mouse.h" +#include <freebsd/mouse.h> + +#endif #endif /* _PSMCOMM_H_ */ diff --git a/src/synaptics.c b/src/synaptics.c index 802132c..78ca633 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -65,12 +65,18 @@ * Standard Headers ****************************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <unistd.h> #include <sys/ioctl.h> #include <misc.h> #include <xf86.h> -#define NEED_XF86_TYPES -#include <xf86_ansic.h> +#include <sys/shm.h> +#include <sys/ipc.h> +#include <sys/stat.h> +#include <errno.h> #include <xf86_OSproc.h> #include <xf86Xinput.h> #include "mipointer.h" @@ -78,7 +84,6 @@ #include <xf86Optrec.h> /* needed for Options */ #endif - /***************************************************************************** * Local Headers ****************************************************************************/ @@ -236,14 +241,14 @@ alloc_param_data(LocalDevicePtr local) return TRUE; /* Already allocated */ if (priv->shm_config) { - if ((shmid = xf86shmget(SHM_SYNAPTICS, 0, 0)) != -1) - xf86shmctl(shmid, XF86IPC_RMID, NULL); - if ((shmid = xf86shmget(SHM_SYNAPTICS, sizeof(SynapticsSHM), - 0777 | XF86IPC_CREAT)) == -1) { + if ((shmid = shmget(SHM_SYNAPTICS, 0, 0)) != -1) + shmctl(shmid, IPC_RMID, NULL); + if ((shmid = shmget(SHM_SYNAPTICS, sizeof(SynapticsSHM), + 0777 | IPC_CREAT)) == -1) { xf86Msg(X_ERROR, "%s error shmget\n", local->name); return FALSE; } - if ((priv->synpara = (SynapticsSHM*)xf86shmat(shmid, NULL, 0)) == NULL) { + if ((priv->synpara = (SynapticsSHM*)shmat(shmid, NULL, 0)) == NULL) { xf86Msg(X_ERROR, "%s error shmat\n", local->name); return FALSE; } @@ -270,7 +275,7 @@ free_param_data(SynapticsPrivate *priv) if (priv->shm_config) { if ((shmid = xf86shmget(SHM_SYNAPTICS, 0, 0)) != -1) - xf86shmctl(shmid, XF86IPC_RMID, NULL); + shmctl(shmid, IPC_RMID, NULL); } else { xfree(priv->synpara); } @@ -305,6 +310,7 @@ SynapticsPreInit(InputDriverPtr drv, IDevPtr dev, int flags) SynapticsSHM *pars; char *repeater; pointer opts; + int status; /* allocate memory for SynapticsPrivateRec */ priv = xcalloc(1, sizeof(SynapticsPrivate)); @@ -339,7 +345,7 @@ SynapticsPreInit(InputDriverPtr drv, IDevPtr dev, int flags) #endif local->always_core_feedback = 0; - xf86Msg(X_INFO, "Synaptics touchpad driver version %s (%d)\n", VERSION, VERSION_ID); + xf86Msg(X_INFO, "Synaptics touchpad driver version %s\n", PACKAGE_VERSION); xf86CollectInputOptions(local, NULL, NULL); @@ -372,7 +378,7 @@ SynapticsPreInit(InputDriverPtr drv, IDevPtr dev, int flags) /* read the parameters */ pars = &priv->synpara_default; - pars->version = VERSION_ID; + pars->version = (PACKAGE_VERSION_MAJOR*10000+PACKAGE_VERSION_MINOR*100+PACKAGE_VERSION_PATCHLEVEL); if (priv->maxx && priv->maxy) { int xsize = priv->maxx - priv->minx; @@ -491,8 +497,8 @@ SynapticsPreInit(InputDriverPtr drv, IDevPtr dev, int flags) priv->fifofd = -1; if (repeater) { /* create repeater fifo */ - if ((xf86mknod(repeater, 666, XF86_S_IFIFO) != 0) && - (xf86errno != xf86_EEXIST)) { + status = mknod(repeater, 666, S_IFIFO); + if ((status != 0) && (status != EEXIST)) { xf86Msg(X_ERROR, "%s can't create repeater fifo\n", local->name); } else { /* open the repeater fifo */ @@ -501,7 +507,7 @@ SynapticsPreInit(InputDriverPtr drv, IDevPtr dev, int flags) xf86Msg(X_ERROR, "%s repeater device open failed\n", local->name); } } - xf86free(repeater); + free(repeater); } if (!QueryHardware(local)) { @@ -667,11 +673,13 @@ DeviceInit(DeviceIntPtr dev) SYN_MAX_BUTTONS, #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) == 0 miPointerGetMotionEvents, +#elif GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 3 + GetMotionHistory, +#endif SynapticsCtrl, +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) == 0 miPointerGetMotionBufferSize() #else - GetMotionHistory, - SynapticsCtrl, GetMotionHistorySize(), 2 #endif ); diff --git a/src/synclient.c b/src/synclient.c index aa5479c..3834f38 100644 --- a/src/synclient.c +++ b/src/synclient.c @@ -17,6 +17,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <stdio.h> #include <stdlib.h> #include <sys/types.h> @@ -125,7 +129,7 @@ show_hw_info(SynapticsSHM *synshm) printf(" This is normal if you are running linux kernel 2.6.\n"); printf(" Check the kernel log for touchpad hardware information.\n"); } - printf("Driver version: %d\n", VERSION_ID); + printf("Driver version: %d\n", (PACKAGE_VERSION_MAJOR*10000+PACKAGE_VERSION_MINOR*100+PACKAGE_VERSION_PATCHLEVEL)); } static void diff --git a/src/syndaemon.c b/src/syndaemon.c index 4730460..c72977a 100644 --- a/src/syndaemon.c +++ b/src/syndaemon.c @@ -17,6 +17,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <X11/Xlib.h> #include <stdio.h> #include <stdlib.h> |