summaryrefslogtreecommitdiff
path: root/driver/xf86-input-synaptics/src
diff options
context:
space:
mode:
authorAlexandr Shadchin <shadchin@cvs.openbsd.org>2015-01-24 17:44:00 +0000
committerAlexandr Shadchin <shadchin@cvs.openbsd.org>2015-01-24 17:44:00 +0000
commitdeae71546a938004105b6d505e8050fbe5068b05 (patch)
treebc6ee11856166f13a5117dcbb70baabb171b4a78 /driver/xf86-input-synaptics/src
parent1118a3a89c99f788f4626e1e5ee4a5a743961f52 (diff)
Update to xf86-input-synaptics 1.8.1.
ok matthieu@
Diffstat (limited to 'driver/xf86-input-synaptics/src')
-rw-r--r--driver/xf86-input-synaptics/src/eventcomm.c26
-rw-r--r--driver/xf86-input-synaptics/src/eventcomm.h2
-rw-r--r--driver/xf86-input-synaptics/src/ps2comm.h2
-rw-r--r--driver/xf86-input-synaptics/src/synaptics.c23
-rw-r--r--driver/xf86-input-synaptics/src/synproto.h2
-rw-r--r--driver/xf86-input-synaptics/src/wsconscomm.c2
6 files changed, 49 insertions, 8 deletions
diff --git a/driver/xf86-input-synaptics/src/eventcomm.c b/driver/xf86-input-synaptics/src/eventcomm.c
index 37de38a54..9e81b86c3 100644
--- a/driver/xf86-input-synaptics/src/eventcomm.c
+++ b/driver/xf86-input-synaptics/src/eventcomm.c
@@ -39,6 +39,7 @@
#include <dirent.h>
#include <string.h>
#include <stdio.h>
+#include <time.h>
#include "synproto.h"
#include "synapticsstr.h"
#include <xf86.h>
@@ -88,6 +89,8 @@ struct eventcomm_proto_data {
struct libevdev *evdev;
enum libevdev_read_flag read_flag;
+
+ int have_monotonic_clock;
};
static void
@@ -217,6 +220,7 @@ EventDeviceOnHook(InputInfoPtr pInfo, SynapticsParameters * para)
SynapticsPrivate *priv = (SynapticsPrivate *) pInfo->private;
struct eventcomm_proto_data *proto_data =
(struct eventcomm_proto_data *) priv->proto_data;
+ int ret;
set_libevdev_log_handler();
@@ -238,7 +242,6 @@ EventDeviceOnHook(InputInfoPtr pInfo, SynapticsParameters * para)
if (para->grab_event_device) {
/* Try to grab the event device so that data don't leak to /dev/input/mice */
- int ret;
ret = libevdev_grab(proto_data->evdev, LIBEVDEV_GRAB);
if (ret < 0) {
@@ -250,6 +253,9 @@ EventDeviceOnHook(InputInfoPtr pInfo, SynapticsParameters * para)
proto_data->need_grab = FALSE;
+ ret = libevdev_set_clock_id(proto_data->evdev, CLOCK_MONOTONIC);
+ proto_data->have_monotonic_clock = (ret == 0);
+
InitializeTouch(pInfo);
return TRUE;
@@ -686,7 +692,10 @@ EventReadHwState(InputInfoPtr pInfo,
switch (ev.code) {
case SYN_REPORT:
hw->numFingers = count_fingers(pInfo, comm);
- hw->millis = 1000 * ev.time.tv_sec + ev.time.tv_usec / 1000;
+ if (proto_data->have_monotonic_clock)
+ hw->millis = 1000 * ev.time.tv_sec + ev.time.tv_usec / 1000;
+ else
+ hw->millis = GetTimeInMillis();
SynapticsCopyHwState(hwRet, hw);
return TRUE;
}
@@ -836,7 +845,7 @@ event_query_touch(InputInfoPtr pInfo)
if (priv->has_touch) {
int axnum;
- static const char *labels[] = {
+ static const char *labels[ABS_MT_MAX] = {
AXIS_LABEL_PROP_ABS_MT_TOUCH_MAJOR,
AXIS_LABEL_PROP_ABS_MT_TOUCH_MINOR,
AXIS_LABEL_PROP_ABS_MT_WIDTH_MAJOR,
@@ -848,6 +857,9 @@ event_query_touch(InputInfoPtr pInfo)
AXIS_LABEL_PROP_ABS_MT_BLOB_ID,
AXIS_LABEL_PROP_ABS_MT_TRACKING_ID,
AXIS_LABEL_PROP_ABS_MT_PRESSURE,
+ AXIS_LABEL_PROP_ABS_MT_DISTANCE,
+ AXIS_LABEL_PROP_ABS_MT_TOOL_X,
+ AXIS_LABEL_PROP_ABS_MT_TOOL_Y,
};
priv->max_touches = libevdev_get_num_slots(dev);
@@ -881,7 +893,13 @@ event_query_touch(InputInfoPtr pInfo)
break;
default:
- priv->touch_axes[axnum].label = labels[axis_idx];
+ if (axis_idx >= sizeof(labels)/sizeof(labels[0])) {
+ xf86IDrvMsg(pInfo, X_ERROR,
+ "Axis %d out of label range. This is a bug\n",
+ axis);
+ priv->touch_axes[axnum].label = NULL;
+ } else
+ priv->touch_axes[axnum].label = labels[axis_idx];
priv->touch_axes[axnum].min = libevdev_get_abs_minimum(dev, axis);
priv->touch_axes[axnum].max = libevdev_get_abs_maximum(dev, axis);
/* Kernel provides units/mm, X wants units/m */
diff --git a/driver/xf86-input-synaptics/src/eventcomm.h b/driver/xf86-input-synaptics/src/eventcomm.h
index 4d759ffb7..e0f8743e5 100644
--- a/driver/xf86-input-synaptics/src/eventcomm.h
+++ b/driver/xf86-input-synaptics/src/eventcomm.h
@@ -27,6 +27,8 @@
#ifndef _EVENTCOMM_H_
#define _EVENTCOMM_H_
+#include <xorg-server.h>
+
#include <linux/input.h>
#include <linux/version.h>
#include <xf86Xinput.h>
diff --git a/driver/xf86-input-synaptics/src/ps2comm.h b/driver/xf86-input-synaptics/src/ps2comm.h
index 2be55e427..fa71d109d 100644
--- a/driver/xf86-input-synaptics/src/ps2comm.h
+++ b/driver/xf86-input-synaptics/src/ps2comm.h
@@ -22,6 +22,8 @@
#ifndef _PS2COMM_H_
#define _PS2COMM_H_
+#include <xorg-server.h>
+
#include <unistd.h>
#include <sys/ioctl.h>
#include "xf86_OSproc.h"
diff --git a/driver/xf86-input-synaptics/src/synaptics.c b/driver/xf86-input-synaptics/src/synaptics.c
index d711ff836..ffdaa11d0 100644
--- a/driver/xf86-input-synaptics/src/synaptics.c
+++ b/driver/xf86-input-synaptics/src/synaptics.c
@@ -772,6 +772,16 @@ set_default_parameters(InputInfoPtr pInfo)
xf86SetIntOption(opts, "HorizResolution", horizResolution);
pars->resolution_vert =
xf86SetIntOption(opts, "VertResolution", vertResolution);
+ if (pars->resolution_horiz <= 0) {
+ xf86IDrvMsg(pInfo, X_ERROR,
+ "Invalid X resolution, using 1 instead.\n");
+ pars->resolution_horiz = 1;
+ }
+ if (pars->resolution_vert <= 0) {
+ xf86IDrvMsg(pInfo, X_ERROR,
+ "Invalid Y resolution, using 1 instead.\n");
+ pars->resolution_vert = 1;
+ }
/* Warn about (and fix) incorrectly configured TopEdge/BottomEdge parameters */
if (pars->top_edge > pars->bottom_edge) {
@@ -1029,6 +1039,8 @@ error:
static void
SynapticsReset(SynapticsPrivate * priv)
{
+ int i;
+
SynapticsResetHwState(priv->hwState);
SynapticsResetHwState(priv->local_hw_state);
SynapticsResetHwState(priv->comm.hwState);
@@ -1058,7 +1070,9 @@ SynapticsReset(SynapticsPrivate * priv)
priv->prev_z = 0;
priv->prevFingers = 0;
priv->num_active_touches = 0;
- memset(priv->open_slots, 0, priv->num_slots * sizeof(int));
+
+ for (i = 0; i < priv->num_slots; i++)
+ priv->open_slots[i] = -1;
}
static int
@@ -1355,6 +1369,8 @@ DeviceInit(DeviceIntPtr dev)
InitDeviceProperties(pInfo);
XIRegisterPropertyHandler(pInfo->dev, SetProperty, NULL, NULL);
+ SynapticsReset(priv);
+
return Success;
fail:
@@ -1963,8 +1979,9 @@ HandleTapProcessing(SynapticsPrivate * priv, struct SynapticsHwState *hw,
(priv->tap_max_fingers <=
((priv->horiz_scroll_twofinger_on ||
priv->vert_scroll_twofinger_on) ? 2 : 1)) &&
- ((abs(hw->x - priv->touch_on.x) >= para->tap_move) ||
- (abs(hw->y - priv->touch_on.y) >= para->tap_move)));
+ (priv->prevFingers == hw->numFingers &&
+ ((abs(hw->x - priv->touch_on.x) >= para->tap_move) ||
+ (abs(hw->y - priv->touch_on.y) >= para->tap_move))));
press = (hw->left || hw->right || hw->middle);
if (touch) {
diff --git a/driver/xf86-input-synaptics/src/synproto.h b/driver/xf86-input-synaptics/src/synproto.h
index 9db93f83d..099a9110f 100644
--- a/driver/xf86-input-synaptics/src/synproto.h
+++ b/driver/xf86-input-synaptics/src/synproto.h
@@ -31,6 +31,8 @@
#include "config.h"
#endif
+#include <xorg-server.h>
+
#include <unistd.h>
#include <sys/ioctl.h>
#include <xf86.h>
diff --git a/driver/xf86-input-synaptics/src/wsconscomm.c b/driver/xf86-input-synaptics/src/wsconscomm.c
index df3512d71..64489588f 100644
--- a/driver/xf86-input-synaptics/src/wsconscomm.c
+++ b/driver/xf86-input-synaptics/src/wsconscomm.c
@@ -292,7 +292,7 @@ WSConsReadDevDimensions(InputInfoPtr pInfo)
case WSMOUSE_TYPE_SYNAP_SBTN:
para->clickpad = TRUE;
para->has_secondary_buttons = TRUE;
- /* FALLTHROUGH */
+ /* FALLTHROUGH */
case WSMOUSE_TYPE_SYNAPTICS:
priv->model = MODEL_SYNAPTICS;
priv->has_width = TRUE;