ChangeLog | 393 +++++++++++++++ configure.ac | 13 debian/changelog | 10 debian/patches/125_option_rec_revert.patch | 37 - debian/patches/126_default_speed.patch | 11 debian/patches/126_ubuntu_xi22.patch | 11 debian/patches/127_multitouch.patch | 748 ----------------------------- debian/patches/series | 3 src/Makefile.am | 3 src/alpscomm.c | 4 src/eventcomm.c | 364 +++++++++++++- src/eventcomm.h | 5 src/properties.c | 2 src/ps2comm.c | 4 src/synaptics.c | 286 ++++++++++- src/synapticsstr.h | 24 src/synproto.c | 156 ++++++ src/synproto.h | 27 + test/Makefile.am | 3 test/eventcomm-test.c | 116 +++- test/fake-symbols.c | 40 + test/fake-symbols.h | 1 tools/synclient.c | 6 23 files changed, 1390 insertions(+), 877 deletions(-)
New commits: commit ec7394cfc10d2e2d3a36c3bac6b49034ce5611c0 Author: Chase Douglas <[email protected]> Date: Fri Feb 10 18:28:04 2012 -0800 releasing version 1.5.0+git20120210-0ubuntu1 diff --git a/debian/changelog b/debian/changelog index 7d7b257..7aa89be 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -xserver-xorg-input-synaptics (1.5.0+git20120210-0ubuntu1) UNRELEASED; urgency=low +xserver-xorg-input-synaptics (1.5.0+git20120210-0ubuntu1) precise; urgency=low * Update to latest code in git (e6032c3) * Drop 127_multitouch.patch, merged upstream @@ -6,7 +6,7 @@ xserver-xorg-input-synaptics (1.5.0+git20120210-0ubuntu1) UNRELEASED; urgency=lo * Refresh 125_option_rec_revert.patch * Add 126_ubuntu_xi22.patch for ubuntu frankenserver support - -- Chase Douglas <[email protected]> Fri, 10 Feb 2012 18:24:01 -0800 + -- Chase Douglas <[email protected]> Fri, 10 Feb 2012 18:27:53 -0800 xserver-xorg-input-synaptics (1.5.0+git20120101-1ubuntu2) precise; urgency=low commit f63248aa8e7b4e767ff93806981edb2491773cc7 Author: Chase Douglas <[email protected]> Date: Fri Feb 10 18:24:20 2012 -0800 Add 126_ubuntu_xi22.patch for ubuntu frankenserver support diff --git a/debian/changelog b/debian/changelog index d0518c6..7d7b257 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,8 +4,9 @@ xserver-xorg-input-synaptics (1.5.0+git20120210-0ubuntu1) UNRELEASED; urgency=lo * Drop 127_multitouch.patch, merged upstream * Drop 126_default_speed.patch, no longer necessary * Refresh 125_option_rec_revert.patch + * Add 126_ubuntu_xi22.patch for ubuntu frankenserver support - -- Chase Douglas <[email protected]> Fri, 10 Feb 2012 18:21:47 -0800 + -- Chase Douglas <[email protected]> Fri, 10 Feb 2012 18:24:01 -0800 xserver-xorg-input-synaptics (1.5.0+git20120101-1ubuntu2) precise; urgency=low diff --git a/debian/patches/126_ubuntu_xi22.patch b/debian/patches/126_ubuntu_xi22.patch new file mode 100644 index 0000000..06e15b3 --- /dev/null +++ b/debian/patches/126_ubuntu_xi22.patch @@ -0,0 +1,11 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -64,7 +64,7 @@ AC_SUBST([sdkdir]) + DRIVER_NAME=synaptics + AC_SUBST([DRIVER_NAME]) + +-PKG_CHECK_MODULES(XI22, [inputproto >= 2.1.99.3] [xorg-server >= 1.11.99.901], HAVE_XI22="yes", HAVE_XI22="no") ++PKG_CHECK_MODULES(XI22, [inputproto >= 2.1.99.3] [xorg-server >= 1.11.3], HAVE_XI22="yes", HAVE_XI22="no") + if test "x$HAVE_XI22" = xyes; then + AC_DEFINE(HAVE_MULTITOUCH, 1, [XI2.2 available]) + fi diff --git a/debian/patches/series b/debian/patches/series index 12b44ec..ae176a5 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -16,3 +16,4 @@ #123_order_ProcessTouch_for_numFingers.patch 124_syndaemon_events.patch 125_option_rec_revert.patch +126_ubuntu_xi22.patch commit 913472072ca6a0ccb3500bc5760eb7f053190244 Author: Chase Douglas <[email protected]> Date: Fri Feb 10 18:21:55 2012 -0800 Refresh 125_option_rec_revert.patch diff --git a/debian/changelog b/debian/changelog index 4532720..d0518c6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,8 +3,9 @@ xserver-xorg-input-synaptics (1.5.0+git20120210-0ubuntu1) UNRELEASED; urgency=lo * Update to latest code in git (e6032c3) * Drop 127_multitouch.patch, merged upstream * Drop 126_default_speed.patch, no longer necessary + * Refresh 125_option_rec_revert.patch - -- Chase Douglas <[email protected]> Fri, 10 Feb 2012 18:17:35 -0800 + -- Chase Douglas <[email protected]> Fri, 10 Feb 2012 18:21:47 -0800 xserver-xorg-input-synaptics (1.5.0+git20120101-1ubuntu2) precise; urgency=low diff --git a/debian/patches/125_option_rec_revert.patch b/debian/patches/125_option_rec_revert.patch index 57b9883..a55aeeb 100644 --- a/debian/patches/125_option_rec_revert.patch +++ b/debian/patches/125_option_rec_revert.patch @@ -1,7 +1,5 @@ -diff --git b/test/fake-symbols.c a/test/fake-symbols.c -index 2d94622..71c3bc5 100644 ---- b/test/fake-symbols.c -+++ a/test/fake-symbols.c +--- a/test/fake-symbols.c ++++ b/test/fake-symbols.c @@ -26,7 +26,7 @@ xf86WaitForInput (int fd, int timeout) } @@ -65,7 +63,7 @@ index 2d94622..71c3bc5 100644 { return NULL; } -@@ -85,7 +85,7 @@ xf86NameCmp(const char *s1, const char *s2) +@@ -85,7 +85,7 @@ xf86NameCmp(const char *s1, const char * } _X_EXPORT char * @@ -74,7 +72,7 @@ index 2d94622..71c3bc5 100644 { return NULL; } -@@ -196,8 +196,8 @@ xf86DeleteInput(InputInfoPtr pInp, int flags) +@@ -196,8 +196,8 @@ xf86DeleteInput(InputInfoPtr pInp, int f return; } @@ -85,7 +83,7 @@ index 2d94622..71c3bc5 100644 { return NULL; } -@@ -225,7 +225,7 @@ xf86PostKeyboardEvent(DeviceIntPtr device, +@@ -225,7 +225,7 @@ xf86PostKeyboardEvent(DeviceIntPtr } _X_EXPORT int @@ -94,7 +92,7 @@ index 2d94622..71c3bc5 100644 { return 0; } -@@ -254,7 +254,7 @@ InitPtrFeedbackClassDeviceStruct(DeviceIntPtr dev, PtrCtrlProcPtr controlProc) +@@ -254,7 +254,7 @@ InitPtrFeedbackClassDeviceStruct(DeviceI _X_EXPORT int XIChangeDeviceProperty (DeviceIntPtr dev, Atom property, Atom type, int format, int mode, unsigned long len, @@ -103,7 +101,7 @@ index 2d94622..71c3bc5 100644 { return 0; } -@@ -367,15 +367,15 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes, Atom *labels, +@@ -367,15 +367,15 @@ InitValuatorClassDeviceStruct(DeviceIntP } @@ -123,7 +121,7 @@ index 2d94622..71c3bc5 100644 { return NULL; } -@@ -424,14 +424,14 @@ InitFocusClassDeviceStruct(DeviceIntPtr dev) +@@ -424,14 +424,14 @@ InitFocusClassDeviceStruct(DeviceIntPtr #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12 void @@ -140,11 +138,9 @@ index 2d94622..71c3bc5 100644 { } -diff --git b/test/fake-symbols.h a/test/fake-symbols.h -index a297d28..dfe1355 100644 ---- b/test/fake-symbols.h -+++ a/test/fake-symbols.h -@@ -1,38 +1,29 @@ +--- a/test/fake-symbols.h ++++ b/test/fake-symbols.h +@@ -1,37 +1,29 @@ #include <xorg-server.h> #include <xf86Xinput.h> @@ -178,7 +174,6 @@ index a297d28..dfe1355 100644 -extern char * xf86SetStrOption(OPTTYPE optlist, const char *name, CONST char *deflt); --extern _X_EXPORT char *xf86SetStrOption(XF86OptionPtr optlist, const char *name, const char *deflt); -extern int xf86SetBoolOption(OPTTYPE optlist, const char *name, int deflt); -extern OPTTYPE xf86AddNewOption(OPTTYPE head, const char *name, const char *val); -extern CONST char* xf86FindOptionValue(OPTTYPE options, const char *name); @@ -196,7 +191,7 @@ index a297d28..dfe1355 100644 extern void xf86AddEnabledDevice(InputInfoPtr pInfo); extern void xf86RemoveEnabledDevice(InputInfoPtr pInfo); extern Atom XIGetKnownProperty(char *name); -@@ -62,7 +53,7 @@ XISetDevicePropertyDeletable(DeviceIntPtr dev, Atom property, Bool deletable); +@@ -61,7 +52,7 @@ XISetDevicePropertyDeletable(DeviceIntPt extern InputInfoPtr xf86FirstLocalDevice(void); extern void xf86DeleteInput(InputInfoPtr pInp, int flags); @@ -205,7 +200,7 @@ index a297d28..dfe1355 100644 extern Bool InitButtonClassDeviceStruct(DeviceIntPtr dev, int numButtons, Atom* labels, CARD8 *map); -@@ -74,7 +65,7 @@ xf86PostKeyboardEvent(DeviceIntPtr device, +@@ -73,7 +64,7 @@ xf86PostKeyboardEvent(DeviceIntPtr unsigned int key_code, int is_down); extern int @@ -214,7 +209,7 @@ index a297d28..dfe1355 100644 extern void xf86PostButtonEventP(DeviceIntPtr device, int is_absolute, -@@ -92,7 +83,7 @@ InitPtrFeedbackClassDeviceStruct(DeviceIntPtr dev, PtrCtrlProcPtr controlProc); +@@ -91,7 +82,7 @@ InitPtrFeedbackClassDeviceStruct(DeviceI extern int XIChangeDeviceProperty (DeviceIntPtr dev, Atom property, Atom type, int format, int mode, unsigned long len, @@ -223,7 +218,7 @@ index a297d28..dfe1355 100644 extern CARD32 GetTimeInMillis (void); extern int -@@ -141,10 +132,10 @@ extern Bool +@@ -140,10 +131,10 @@ extern Bool InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes, Atom *labels, int numMotionEvents, int mode); @@ -237,7 +232,7 @@ index a297d28..dfe1355 100644 extern int XIGetDeviceProperty (DeviceIntPtr dev, Atom property, XIPropertyValuePtr *value); -@@ -168,12 +159,12 @@ extern Bool InitFocusClassDeviceStruct(DeviceIntPtr dev); +@@ -167,12 +158,12 @@ extern Bool InitFocusClassDeviceStruct(D #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12 extern void commit 76806ea7b569dbb0d5576a24299e82fc80633c0a Author: Chase Douglas <[email protected]> Date: Fri Feb 10 18:17:55 2012 -0800 Drop 126_default_speed.patch, no longer necessary diff --git a/debian/changelog b/debian/changelog index 763d6d8..4532720 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,8 +2,9 @@ xserver-xorg-input-synaptics (1.5.0+git20120210-0ubuntu1) UNRELEASED; urgency=lo * Update to latest code in git (e6032c3) * Drop 127_multitouch.patch, merged upstream + * Drop 126_default_speed.patch, no longer necessary - -- Chase Douglas <[email protected]> Fri, 10 Feb 2012 18:17:01 -0800 + -- Chase Douglas <[email protected]> Fri, 10 Feb 2012 18:17:35 -0800 xserver-xorg-input-synaptics (1.5.0+git20120101-1ubuntu2) precise; urgency=low diff --git a/debian/patches/126_default_speed.patch b/debian/patches/126_default_speed.patch deleted file mode 100644 index 62b37cb..0000000 --- a/debian/patches/126_default_speed.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/src/synaptics.c -+++ b/src/synaptics.c -@@ -581,7 +581,7 @@ static void set_default_parameters(Input - pars->press_motion_max_z = xf86SetIntOption(opts, "PressureMotionMaxZ", pressureMotionMaxZ); - pars->resolution_detect = xf86SetBoolOption(opts, "ResolutionDetect", TRUE); - -- pars->min_speed = xf86SetRealOption(opts, "MinSpeed", 0.4); -+ pars->min_speed = xf86SetRealOption(opts, "MinSpeed", 0.25); - pars->max_speed = xf86SetRealOption(opts, "MaxSpeed", 0.7); - pars->accl = xf86SetRealOption(opts, "AccelFactor", accelFactor); - pars->trackstick_speed = xf86SetRealOption(opts, "TrackstickSpeed", 40); diff --git a/debian/patches/series b/debian/patches/series index 87644a2..12b44ec 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -16,4 +16,3 @@ #123_order_ProcessTouch_for_numFingers.patch 124_syndaemon_events.patch 125_option_rec_revert.patch -126_default_speed.patch commit 942e078d7ffa76487f73c4f513b10e370c5ae247 Author: Chase Douglas <[email protected]> Date: Fri Feb 10 18:17:12 2012 -0800 Drop 127_multitouch.patch, merged upstream diff --git a/debian/changelog b/debian/changelog index f8ea55c..763d6d8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,9 @@ xserver-xorg-input-synaptics (1.5.0+git20120210-0ubuntu1) UNRELEASED; urgency=low * Update to latest code in git (e6032c3) + * Drop 127_multitouch.patch, merged upstream - -- Chase Douglas <[email protected]> Fri, 10 Feb 2012 18:14:58 -0800 + -- Chase Douglas <[email protected]> Fri, 10 Feb 2012 18:17:01 -0800 xserver-xorg-input-synaptics (1.5.0+git20120101-1ubuntu2) precise; urgency=low diff --git a/debian/patches/127_multitouch.patch b/debian/patches/127_multitouch.patch deleted file mode 100644 index 87d25f3..0000000 --- a/debian/patches/127_multitouch.patch +++ /dev/null @@ -1,748 +0,0 @@ -diff --git a/configure.ac b/configure.ac -index bb95403..166a4f8 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -64,6 +64,11 @@ AC_SUBST([sdkdir]) - DRIVER_NAME=synaptics - AC_SUBST([DRIVER_NAME]) - -+PKG_CHECK_MODULES(XI22, [inputproto >= 2.1.99.3] [xorg-server >= 1.11.3], HAVE_XI22="yes", HAVE_XI22="no") -+if test "x$HAVE_XI22" = xyes; then -+ AC_DEFINE(HAVE_MULTITOUCH, 1, [XI2.2 available]) -+fi -+ - # ----------------------------------------------------------------------------- - # Configuration options - # ----------------------------------------------------------------------------- -@@ -116,6 +121,14 @@ case "${host}" in - esac - if test "x$BUILD_EVENTCOMM" = xyes; then - AC_DEFINE(BUILD_EVENTCOMM, 1, [Optional backend eventcomm enabled]) -+ -+ if test "x$HAVE_XI22" = xyes; then -+ # Obtain compiler/linker options for mtdev -+ PKG_CHECK_MODULES(MTDEV, mtdev, HAVE_MTDEV="yes", HAVE_MTDEV="no") -+ fi -+ if test "x$HAVE_XI22" = xyes && test "x$HAVE_MTDEV" = xyes; then -+ AC_DEFINE(HAVE_MTDEV, 1, [MTDev available]) -+ fi - fi - if test "x$BUILD_PSMCOMM" = xyes; then - AC_DEFINE(BUILD_PSMCOMM, 1, [Optional backend psmcomm enabled]) -diff --git a/src/Makefile.am b/src/Makefile.am -index 5e04670..a6715e6 100644 ---- a/src/Makefile.am -+++ b/src/Makefile.am -@@ -44,6 +44,8 @@ endif - if BUILD_EVENTCOMM - @DRIVER_NAME@_drv_la_SOURCES += \ - eventcomm.c eventcomm.h -+@DRIVER_NAME@_drv_la_LIBADD = \ -+ $(MTDEV_LIBS) - endif - - if BUILD_PSMCOMM -diff --git a/src/eventcomm.c b/src/eventcomm.c -index 00dc532..2da732f 100644 ---- a/src/eventcomm.c -+++ b/src/eventcomm.c -@@ -41,6 +41,9 @@ - #include "synaptics.h" - #include "synapticsstr.h" - #include <xf86.h> -+#ifdef HAVE_MTDEV -+#include <mtdev.h> -+#endif - - - #define SYSCALL(call) while (((call) == -1) && (errno == EINTR)) -@@ -62,19 +65,133 @@ struct eventcomm_proto_data - * exists for readability of the code. - */ - BOOL need_grab; -+#ifdef HAVE_MTDEV -+ struct mtdev *mtdev; -+ int axis_map[MT_ABS_SIZE]; -+ int cur_slot; -+ enum -+ { -+ SLOTSTATE_OPEN = 0, -+ SLOTSTATE_CLOSE, -+ SLOTSTATE_UPDATE, -+ SLOTSTATE_EMPTY, -+ } slot_state; -+ ValuatorMask *mt_mask; -+ ValuatorMask **last_mt_vals; -+#endif - }; - --static Bool --EventDeviceOnHook(InputInfoPtr pInfo, SynapticsParameters *para) -+#ifdef HAVE_MTDEV -+static int -+num_slots(const struct eventcomm_proto_data *proto_data) -+{ -+ int value = proto_data->mtdev->caps.slot.maximum - -+ proto_data->mtdev->caps.slot.minimum + 1; -+ -+ /* If we don't know how many slots there are, assume at least 10 */ -+ return value > 1 ? value : 10; -+} -+ -+static int -+last_mt_vals_slot(const struct eventcomm_proto_data *proto_data) -+{ -+ int value = proto_data->cur_slot - proto_data->mtdev->caps.slot.minimum; -+ -+ return value < num_slots(proto_data) ? value : -1; -+} -+ -+static void -+UninitializeTouch(InputInfoPtr pInfo) - { - SynapticsPrivate *priv = (SynapticsPrivate *)pInfo->private; - struct eventcomm_proto_data *proto_data = (struct eventcomm_proto_data*)priv->proto_data; - -- if (!proto_data) { -- proto_data = calloc(1, sizeof(struct eventcomm_proto_data)); -- priv->proto_data = proto_data; -+ if (!proto_data->mtdev) -+ return; -+ -+ valuator_mask_free(&proto_data->mt_mask); -+ if (proto_data->last_mt_vals) -+ { -+ int i; -+ -+ for (i = 0; i < num_slots(proto_data); i++) -+ valuator_mask_free(&proto_data->last_mt_vals[i]); -+ free(proto_data->last_mt_vals); -+ proto_data->last_mt_vals = NULL; -+ } -+ -+ mtdev_close(proto_data->mtdev); -+ proto_data->mtdev = NULL; -+} -+ -+static void -+InitializeTouch(InputInfoPtr pInfo) -+{ -+ SynapticsPrivate *priv = (SynapticsPrivate *)pInfo->private; -+ struct eventcomm_proto_data *proto_data = (struct eventcomm_proto_data*)priv->proto_data; -+ int i; -+ -+ proto_data->mtdev = mtdev_new_open(pInfo->fd); -+ if (!proto_data->mtdev) -+ { -+ xf86IDrvMsg(pInfo, X_WARNING, -+ "failed to create mtdev instance, ignoring touch events\n"); -+ return; -+ } -+ -+ proto_data->cur_slot = proto_data->mtdev->caps.slot.value; -+ -+ /* Axes 0-4 are for X, Y, and scrolling. num_mt_axes does not include X and -+ * Y. */ -+ proto_data->mt_mask = valuator_mask_new(4 + priv->num_mt_axes); -+ if (!proto_data->mt_mask) -+ { -+ xf86IDrvMsg(pInfo, X_WARNING, -+ "failed to create MT valuator mask, ignoring touch " -+ "events\n"); -+ UninitializeTouch(pInfo); -+ return; -+ } -+ -+ proto_data->last_mt_vals = calloc(num_slots(proto_data), -+ sizeof(ValuatorMask *)); -+ if (!proto_data->last_mt_vals) -+ { -+ xf86IDrvMsg(pInfo, X_WARNING, -+ "failed to allocate MT last values mask array\n"); -+ UninitializeTouch(pInfo); -+ return; - } - -+ for (i = 0; i < num_slots(proto_data); i++) -+ { -+ int j; -+ -+ proto_data->last_mt_vals[i] = valuator_mask_new(4 + priv->num_mt_axes); -+ if (!proto_data->last_mt_vals[i]) -+ { -+ xf86IDrvMsg(pInfo, X_WARNING, -+ "failed to allocate MT last values mask\n"); -+ UninitializeTouch(pInfo); -+ return; -+ } -+ -+ /* Axes 0-4 are for X, Y, and scrolling. num_mt_axes does not include X -+ * and Y. */ -+ valuator_mask_set(proto_data->last_mt_vals[i], 0, 0); -+ valuator_mask_set(proto_data->last_mt_vals[i], 1, 0); -+ for (j = 4; j < priv->num_mt_axes; j++) -+ valuator_mask_set(proto_data->last_mt_vals[i], j, 0); -+ } -+} -+#endif -+ -+static Bool -+EventDeviceOnHook(InputInfoPtr pInfo, SynapticsParameters *para) -+{ -+ SynapticsPrivate *priv = (SynapticsPrivate *)pInfo->private; -+ struct eventcomm_proto_data *proto_data = (struct eventcomm_proto_data*)priv->proto_data; -+ - if (para->grab_event_device) { - /* Try to grab the event device so that data don't leak to /dev/input/mice */ - int ret; -@@ -88,9 +205,23 @@ EventDeviceOnHook(InputInfoPtr pInfo, SynapticsParameters *para) - - proto_data->need_grab = FALSE; - -+#ifdef HAVE_MTDEV -+ InitializeTouch(pInfo); -+#endif -+ - return TRUE; - } - -+static Bool -+EventDeviceOffHook(InputInfoPtr pInfo) -+{ -+#ifdef HAVE_MTDEV -+ UninitializeTouch(pInfo); -+#endif -+ -+ return Success; -+} -+ - /** - * Test if the device on the file descriptior is recognized as touchpad - * device. Required bits for touchpad recognition are: -@@ -353,10 +484,20 @@ EventQueryHardware(InputInfoPtr pInfo) - static Bool - SynapticsReadEvent(InputInfoPtr pInfo, struct input_event *ev) - { -+#ifdef HAVE_MTDEV -+ SynapticsPrivate *priv = (SynapticsPrivate *)pInfo->private; -+ struct eventcomm_proto_data *proto_data = priv->proto_data; -+#endif - int rc = TRUE; - ssize_t len; - -- len = read(pInfo->fd, ev, sizeof(*ev)); -+#ifdef HAVE_MTDEV -+ if (proto_data && proto_data->mtdev) -+ len = mtdev_get(proto_data->mtdev, pInfo->fd, ev, 1) * -+ sizeof(struct input_event); -+ else -+#endif -+ len = read(pInfo->fd, ev, sizeof(*ev)); - if (len <= 0) - { - /* We use X_NONE here because it doesn't alloc */ -@@ -370,6 +511,90 @@ SynapticsReadEvent(InputInfoPtr pInfo, struct input_event *ev) - return rc; - } - -+static void -+EventProcessTouch(InputInfoPtr pInfo) -+{ -+#ifdef HAVE_MTDEV -+ SynapticsPrivate *priv = (SynapticsPrivate *)pInfo->private; -+ struct eventcomm_proto_data *proto_data = priv->proto_data; -+ int type; -+ -+ if (!proto_data || proto_data->cur_slot < 0 || !priv->has_touch) -+ return; -+ -+ /* If the ABS_MT_SLOT is the first event we get after EV_SYN, skip this */ -+ if (proto_data->slot_state == SLOTSTATE_EMPTY) -+ return; -+ -+ switch (proto_data->slot_state) -+ { -+ case SLOTSTATE_CLOSE: -+ type = XI_TouchEnd; -+ break; -+ case SLOTSTATE_OPEN: -+ type = XI_TouchBegin; -+ break; -+ default: -+ type = XI_TouchUpdate; -+ break; -+ } -+ -+ xf86PostTouchEvent(pInfo->dev, proto_data->cur_slot, type, 0, -+ proto_data->mt_mask); -+ -+ proto_data->slot_state = SLOTSTATE_EMPTY; -+ valuator_mask_zero(proto_data->mt_mask); -+#endif -+} -+ -+static void -+EventProcessTouchEvent(InputInfoPtr pInfo, struct CommData *comm, -+ struct input_event *ev) -+{ -+#ifdef HAVE_MTDEV -+ SynapticsPrivate *priv = (SynapticsPrivate *)pInfo->private; -+ struct eventcomm_proto_data *proto_data = priv->proto_data; -+ -+ if (!proto_data) -+ return; -+ -+ if (ev->code == ABS_MT_SLOT) -+ { -+ EventProcessTouch(pInfo); -+ proto_data->cur_slot = ev->value; -+ } else -+ { -+ int slot_index = last_mt_vals_slot(proto_data); -+ -+ if (proto_data->slot_state == SLOTSTATE_EMPTY) -+ proto_data->slot_state = SLOTSTATE_UPDATE; -+ if (ev->code == ABS_MT_TRACKING_ID) -+ { -+ if (ev->value >= 0) -+ { -+ proto_data->slot_state = SLOTSTATE_OPEN; -+ -+ if (slot_index >= 0) -+ valuator_mask_copy(proto_data->mt_mask, -+ proto_data->last_mt_vals[slot_index]); -+ else -+ xf86IDrvMsg(pInfo, X_WARNING, -+ "Attempted to copy values from out-of-range " -+ "slot, touch events may be incorrect.\n"); -+ } else -+ proto_data->slot_state = SLOTSTATE_CLOSE; -+ } else -+ { -+ int map = proto_data->axis_map[ev->code - ABS_MT_TOUCH_MAJOR]; -+ valuator_mask_set(proto_data->mt_mask, map, ev->value); -+ if (slot_index >= 0) -+ valuator_mask_set(proto_data->last_mt_vals[slot_index], map, -+ ev->value); -+ } -+ } -+#endif -+} -+ - /** - * Count the number of fingers based on the CommData information. - * The CommData struct contains the event information based on previous -@@ -408,6 +633,7 @@ EventReadHwState(InputInfoPtr pInfo, - case EV_SYN: - switch (ev.code) { - case SYN_REPORT: -+ EventProcessTouch(pInfo); - hw->numFingers = count_fingers(comm); - hw->millis = 1000 * ev.time.tv_sec + ev.time.tv_usec / 1000; - *hwRet = *hw; -@@ -472,20 +698,23 @@ EventReadHwState(InputInfoPtr pInfo, - } - break; - case EV_ABS: -- switch (ev.code) { -- case ABS_X: -- hw->x = ev.value; -- break; -- case ABS_Y: -- hw->y = ev.value; -- break; -- case ABS_PRESSURE: -- hw->z = ev.value; -- break; -- case ABS_TOOL_WIDTH: -- hw->fingerWidth = ev.value; -- break; -- } -+ if (ev.code < ABS_MT_SLOT) { -+ switch (ev.code) { -+ case ABS_X: -+ hw->x = ev.value; -+ break; -+ case ABS_Y: -+ hw->y = ev.value; -+ break; -+ case ABS_PRESSURE: -+ hw->z = ev.value; -+ break; -+ case ABS_TOOL_WIDTH: -+ hw->fingerWidth = ev.value; -+ break; -+ } -+ } else -+ EventProcessTouchEvent(pInfo, comm, &ev); - break; - } - } -@@ -497,6 +726,120 @@ static int EventDevOnly(const struct dirent *dir) { - return strncmp(EVENT_DEV_NAME, dir->d_name, 5) == 0; - } - -+#ifdef HAVE_MTDEV -+static void -+event_query_touch(InputInfoPtr pInfo) -+{ -+ SynapticsPrivate *priv = (SynapticsPrivate *)pInfo->private; -+ struct eventcomm_proto_data *proto_data = priv->proto_data; -+ struct mtdev *mtdev; -+ int i; -+ -+ priv->num_touches = 0; -+ priv->num_mt_axes = 0; -+ -+ mtdev = mtdev_new_open(pInfo->fd); -+ if (!mtdev) -+ { -+ xf86IDrvMsg(pInfo, X_WARNING, -+ "failed to open mtdev when querying touch capabilities\n"); -+ return; -+ } -+ -+ for (i = 0; i < MT_ABS_SIZE; i++) -+ { -+ if (mtdev->caps.has_abs[i]) -+ { -+ switch (i) -+ { -+ /* X and Y axis info is handed by synaptics already */ -+ case ABS_MT_POSITION_X - ABS_MT_TOUCH_MAJOR: -+ case ABS_MT_POSITION_Y - ABS_MT_TOUCH_MAJOR: -+ /* Skip tracking ID info */ -+ case ABS_MT_TRACKING_ID - ABS_MT_TOUCH_MAJOR: -+ break; -+ default: -+ priv->num_mt_axes++; -+ break; -+ } -+ priv->has_touch = TRUE; -+ } -+ } -+ -+ if (priv->has_touch) -+ { -+ int axnum; -+ static const char *labels[] = -+ { -+ AXIS_LABEL_PROP_ABS_MT_TOUCH_MAJOR, -+ AXIS_LABEL_PROP_ABS_MT_TOUCH_MINOR, -+ AXIS_LABEL_PROP_ABS_MT_WIDTH_MAJOR, -+ AXIS_LABEL_PROP_ABS_MT_WIDTH_MINOR, -+ AXIS_LABEL_PROP_ABS_MT_ORIENTATION, -+ AXIS_LABEL_PROP_ABS_MT_POSITION_X, -+ AXIS_LABEL_PROP_ABS_MT_POSITION_Y, -+ AXIS_LABEL_PROP_ABS_MT_TOOL_TYPE, -+ AXIS_LABEL_PROP_ABS_MT_BLOB_ID, -+ AXIS_LABEL_PROP_ABS_MT_TRACKING_ID, -+ AXIS_LABEL_PROP_ABS_MT_PRESSURE, -+ }; -+ -+ if (mtdev->caps.slot.maximum > 0) -+ priv->num_touches = mtdev->caps.slot.maximum - -+ mtdev->caps.slot.minimum + 1; -+ -+ priv->touch_axes = malloc(priv->num_mt_axes * -+ sizeof(SynapticsTouchAxisRec)); -+ if (!priv->touch_axes) -+ { -+ priv->has_touch = FALSE; -+ goto out; -+ } -+ -+ axnum = 0; -+ for (i = 0; i < MT_ABS_SIZE; i++) -+ { -+ if (mtdev->caps.has_abs[i]) -+ { -+ switch (i) -+ { -+ /* X and Y axis info is handed by synaptics already, we just -+ * need to map the evdev codes to the valuator numbers */ -+ case ABS_MT_POSITION_X - ABS_MT_TOUCH_MAJOR: -+ proto_data->axis_map[i] = 0; -+ break; -+ -+ case ABS_MT_POSITION_Y - ABS_MT_TOUCH_MAJOR: -+ proto_data->axis_map[i] = 1; -+ break; -+ -+ /* Skip tracking ID info */ -+ case ABS_MT_TRACKING_ID - ABS_MT_TOUCH_MAJOR: -+ break; -+ -+ default: -+ priv->touch_axes[axnum].label = labels[i]; -+ priv->touch_axes[axnum].min = -+ mtdev->caps.abs[i].minimum; -+ priv->touch_axes[axnum].max = -+ mtdev->caps.abs[i].maximum; -+ /* Kernel provides units/mm, X wants units/m */ -+ priv->touch_axes[axnum].res = -+ mtdev->caps.abs[i].resolution * 1000; -+ /* Valuators 0-3 are used for X, Y, and scrolling */ -+ proto_data->axis_map[i] = 4 + axnum; -+ axnum++; -+ break; -+ } -+ } -+ } -+ } -+ -+out: -+ mtdev_close(mtdev); -+} -+#endif -+ - /** - * Probe the open device for dimensions. - */ -@@ -505,9 +848,26 @@ EventReadDevDimensions(InputInfoPtr pInfo) - { - SynapticsPrivate *priv = (SynapticsPrivate *)pInfo->private; - struct eventcomm_proto_data *proto_data = priv->proto_data; -+#ifdef HAVE_MTDEV -+ int i; -+#endif -+ -+ proto_data = calloc(1, sizeof(struct eventcomm_proto_data)); -+ priv->proto_data = proto_data; -+ -+#ifdef HAVE_MTDEV -+ for (i = 0; i < MT_ABS_SIZE; i++) -+ proto_data->axis_map[i] = -1; -+ proto_data->cur_slot = -1; -+#endif - - if (event_query_is_touchpad(pInfo->fd, (proto_data) ? proto_data->need_grab : TRUE)) -- event_query_axis_ranges(pInfo); -+ { -+ event_query_axis_ranges(pInfo); -+#ifdef HAVE_MTDEV -+ event_query_touch(pInfo); -+#endif -+ } - event_query_model(pInfo->fd, &priv->model, &priv->id_vendor, &priv->id_product); - - xf86IDrvMsg(pInfo, X_PROBED, "Vendor %#hx Product %#hx\n", -@@ -584,7 +944,7 @@ EventAutoDevProbe(InputInfoPtr pInfo, const char *device) - - struct SynapticsProtocolOperations event_proto_operations = { - EventDeviceOnHook, -- NULL, -+ EventDeviceOffHook, - EventQueryHardware, - EventReadHwState, - EventAutoDevProbe, -diff --git a/src/synaptics.c b/src/synaptics.c -index b1f2cf2..34915a2 100644 ---- a/src/synaptics.c -+++ b/src/synaptics.c -@@ -937,8 +937,13 @@ DeviceClose(DeviceIntPtr dev) - return RetValue; - } - --static void InitAxesLabels(Atom *labels, int nlabels) -+static void InitAxesLabels(Atom *labels, int nlabels, -+ const SynapticsPrivate *priv) - { -+#ifdef HAVE_MULTITOUCH -+ int i; -+#endif -+ - memset(labels, 0, nlabels * sizeof(Atom)); - switch(nlabels) - { -@@ -950,11 +955,20 @@ static void InitAxesLabels(Atom *labels, int nlabels) - labels[2] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_HSCROLL); - #endif - case 2: -- labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y); -+ labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_Y); - case 1: -- labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X); -+ labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_X); - break; - } -+ -+#ifdef HAVE_MULTITOUCH -+ for (i = 0; i < priv->num_mt_axes; i++) -+ { -+ SynapticsTouchAxisRec *axis = &priv->touch_axes[i]; -+ int axnum = nlabels - priv->num_mt_axes + i; -+ labels[axnum] = XIGetKnownProperty(axis->label); -+ } -+#endif - } - - static void InitButtonLabels(Atom *labels, int nlabels) -@@ -993,14 +1007,25 @@ DeviceInit(DeviceIntPtr dev) - int min, max; - int num_axes = 2; - Atom btn_labels[SYN_MAX_BUTTONS] = { 0 }; -- Atom axes_labels[4] = { 0 }; -+ Atom *axes_labels; - DeviceVelocityPtr pVel; - - #ifdef HAVE_SMOOTH_SCROLL - num_axes += 2; - #endif - -- InitAxesLabels(axes_labels, num_axes); -+#ifdef HAVE_MULTITOUCH -+ num_axes += priv->num_mt_axes; -+#endif -+ -+ axes_labels = calloc(num_axes, sizeof(Atom)); -+ if (!axes_labels) -+ { -+ xf86IDrvMsg(pInfo, X_ERROR, "failed to allocate axis labels\n"); -+ return !Success; -+ } -+ -+ InitAxesLabels(axes_labels, num_axes, priv); - InitButtonLabels(btn_labels, SYN_MAX_BUTTONS); - - DBG(3, "Synaptics DeviceInit called\n"); -@@ -1106,7 +1131,10 @@ DeviceInit(DeviceIntPtr dev) - priv->scroll_axis_vert = 3; - priv->scroll_events_mask = valuator_mask_new(MAX_VALUATORS); - if (!priv->scroll_events_mask) -+ { -+ free(axes_labels); - return !Success; -+ } - - SetScrollValuator(dev, priv->scroll_axis_horiz, SCROLL_TYPE_HORIZONTAL, - priv->synpara.scroll_dist_horiz, 0); -@@ -1114,6 +1142,43 @@ DeviceInit(DeviceIntPtr dev) - priv->synpara.scroll_dist_vert, 0); - #endif - -+#ifdef HAVE_MULTITOUCH -+ if (priv->has_touch) -+ { -+ if (!InitTouchClassDeviceStruct(dev, priv->num_touches, -+ XIDependentTouch, priv->num_mt_axes)) -+ { -+ xf86IDrvMsg(pInfo, X_ERROR, -+ "failed to initialize touch class device\n"); -+ priv->has_touch = 0; -+ goto no_touch; -+ } -+ -+ for (i = 0; i < priv->num_mt_axes; i++) -+ { -+ SynapticsTouchAxisRec *axis = &priv->touch_axes[i]; -+ int axnum = num_axes - priv->num_mt_axes + i; -+ Atom atom = axes_labels[axnum]; -+ -+ if (!xf86InitValuatorAxisStruct(dev, axnum, axes_labels[axnum], -+ axis->min, axis->max, axis->res, 0, -+ axis->res, Absolute)) -+ { -+ xf86IDrvMsg(pInfo, X_WARNING, -+ "failed to initialize axis %s, skipping\n", -+ axis->label); -+ continue; -+ } -+ -+ xf86InitValuatorDefaults(dev, axnum); -+ } -+ } -+ -+no_touch: -+#endif -+ -+ free(axes_labels); -+ - if (!alloc_shm_data(pInfo)) - return !Success; - -diff --git a/src/synapticsstr.h b/src/synapticsstr.h -index d74ebcd..d3b8607 100644 ---- a/src/synapticsstr.h -+++ b/src/synapticsstr.h -- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected] Archive: http://lists.debian.org/[email protected]

