summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac3
-rw-r--r--src/Makefile.am1
-rw-r--r--src/eventcomm.c112
3 files changed, 37 insertions, 79 deletions
diff --git a/configure.ac b/configure.ac
index 77edbb2..865d4b4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -116,9 +116,6 @@ case "${host}" in
esac
if test "x$BUILD_EVENTCOMM" = xyes; then
AC_DEFINE(BUILD_EVENTCOMM, 1, [Optional backend eventcomm enabled])
-
- # Obtain compiler/linker options for mtdev
- PKG_CHECK_MODULES(MTDEV, mtdev)
PKG_CHECK_MODULES(LIBEVDEV, [libevdev >= 0.4])
fi
if test "x$BUILD_PSMCOMM" = xyes; then
diff --git a/src/Makefile.am b/src/Makefile.am
index 69ef453..726c2de 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -48,7 +48,6 @@ if BUILD_EVENTCOMM
synaptics_drv_la_SOURCES += \
eventcomm.c eventcomm.h
synaptics_drv_la_LIBADD = \
- $(MTDEV_LIBS) \
$(LIBEVDEV_LIBS)
AM_CPPFLAGS += $(LIBEVDEV_CFLAGS)
endif
diff --git a/src/eventcomm.c b/src/eventcomm.c
index e76423f..858efeb 100644
--- a/src/eventcomm.c
+++ b/src/eventcomm.c
@@ -42,7 +42,6 @@
#include "synproto.h"
#include "synapticsstr.h"
#include <xf86.h>
-#include <mtdev-plumbing.h>
#include <libevdev/libevdev.h>
#ifndef INPUT_PROP_BUTTONPAD
@@ -79,7 +78,6 @@ struct eventcomm_proto_data {
BOOL need_grab;
int st_to_mt_offset[2];
double st_to_mt_scale[2];
- struct mtdev *mtdev;
int axis_map[ABS_MT_CNT];
int cur_slot;
ValuatorMask **last_mt_vals;
@@ -141,8 +139,6 @@ UninitializeTouch(InputInfoPtr pInfo)
proto_data->last_mt_vals = NULL;
}
- mtdev_close_delete(proto_data->mtdev);
- proto_data->mtdev = NULL;
proto_data->num_touches = 0;
}
@@ -157,14 +153,7 @@ InitializeTouch(InputInfoPtr pInfo)
if (!priv->has_touch)
return;
- 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;
+ proto_data->cur_slot = libevdev_get_current_slot(proto_data->evdev);
proto_data->num_touches = 0;
proto_data->last_mt_vals = calloc(priv->num_slots, sizeof(ValuatorMask *));
@@ -505,58 +494,33 @@ SynapticsReadEvent(InputInfoPtr pInfo, struct input_event *ev)
SynapticsPrivate *priv = (SynapticsPrivate *) pInfo->private;
struct eventcomm_proto_data *proto_data = priv->proto_data;
int rc;
- int have_events = TRUE;
static struct timeval last_event_time;
- /* empty mtdev queue first */
- if (proto_data->mtdev && !mtdev_empty(proto_data->mtdev)) {
- mtdev_get_event(proto_data->mtdev, ev);
- return TRUE;
- }
-
- do {
- rc = libevdev_next_event(proto_data->evdev, proto_data->read_flag, ev);
- if (rc < 0) {
- if (rc != -EAGAIN) {
- LogMessageVerbSigSafe(X_ERROR, 0, "%s: Read error %d\n", pInfo->name,
- errno);
- } else if (proto_data->read_flag == LIBEVDEV_READ_FLAG_SYNC)
- proto_data->read_flag = LIBEVDEV_READ_FLAG_NORMAL;
- have_events = FALSE;
- } else {
- have_events = TRUE;
-
- /* SYN_DROPPED received in normal mode. Create a normal EV_SYN
- so we process what's in the queue atm, then ensure we sync
- next time */
- if (rc == LIBEVDEV_READ_STATUS_SYNC &&
- proto_data->read_flag == LIBEVDEV_READ_FLAG_NORMAL) {
- proto_data->read_flag = LIBEVDEV_READ_FLAG_SYNC;
- ev->type = EV_SYN;
- ev->code = SYN_REPORT;
- ev->value = 0;
- ev->time = last_event_time;
- } else if (ev->type == EV_SYN)
- last_event_time = ev->time;
-
- /* feed mtdev. nomnomnomnom */
- if (proto_data->mtdev)
- mtdev_put_event(proto_data->mtdev, ev);
- }
- } while (have_events && proto_data->mtdev && mtdev_empty(proto_data->mtdev));
+ rc = libevdev_next_event(proto_data->evdev, proto_data->read_flag, ev);
+ if (rc < 0) {
+ if (rc != -EAGAIN) {
+ LogMessageVerbSigSafe(X_ERROR, 0, "%s: Read error %d\n", pInfo->name,
+ errno);
+ } else if (proto_data->read_flag == LIBEVDEV_READ_FLAG_SYNC)
+ proto_data->read_flag = LIBEVDEV_READ_FLAG_NORMAL;
- /* loop exits if:
- - we don't have mtdev, ev is valid, rc is TRUE, let's return it
- - we have mtdev and it has events for us, get those
- - we don't have a new event and mtdev doesn't have events either.
- */
- if (have_events && proto_data->mtdev) {
- have_events = !mtdev_empty(proto_data->mtdev);
- if (have_events)
- mtdev_get_event(proto_data->mtdev, ev);
+ return FALSE;
}
- return have_events;
+ /* SYN_DROPPED received in normal mode. Create a normal EV_SYN
+ so we process what's in the queue atm, then ensure we sync
+ next time */
+ if (rc == LIBEVDEV_READ_STATUS_SYNC &&
+ proto_data->read_flag == LIBEVDEV_READ_FLAG_NORMAL) {
+ proto_data->read_flag = LIBEVDEV_READ_FLAG_SYNC;
+ ev->type = EV_SYN;
+ ev->code = SYN_REPORT;
+ ev->value = 0;
+ ev->time = last_event_time;
+ } else if (ev->type == EV_SYN)
+ last_event_time = ev->time;
+
+ return TRUE;
}
static Bool
@@ -809,20 +773,22 @@ event_query_touch(InputInfoPtr pInfo)
#endif
- for (axis = ABS_MT_SLOT + 1; axis <= ABS_MT_MAX; axis++) {
- if (!libevdev_has_event_code(dev, EV_ABS, axis))
- continue;
+ if (libevdev_has_event_code(dev, EV_ABS, ABS_MT_SLOT)) {
+ for (axis = ABS_MT_SLOT + 1; axis <= ABS_MT_MAX; axis++) {
+ if (!libevdev_has_event_code(dev, EV_ABS, axis))
+ continue;
- priv->has_touch = TRUE;
+ priv->has_touch = TRUE;
- /* X and Y axis info is handled by synaptics already and we don't
- expose the tracking ID */
- if (axis == ABS_MT_POSITION_X ||
- axis == ABS_MT_POSITION_Y ||
- axis == ABS_MT_TRACKING_ID)
- continue;
+ /* X and Y axis info is handled by synaptics already and we don't
+ expose the tracking ID */
+ if (axis == ABS_MT_POSITION_X ||
+ axis == ABS_MT_POSITION_Y ||
+ axis == ABS_MT_TRACKING_ID)
+ continue;
- priv->num_mt_axes++;
+ priv->num_mt_axes++;
+ }
}
if (priv->has_touch) {
@@ -842,11 +808,7 @@ event_query_touch(InputInfoPtr pInfo)
AXIS_LABEL_PROP_ABS_MT_PRESSURE,
};
- if (libevdev_has_event_code(dev, EV_ABS, ABS_MT_SLOT))
- priv->max_touches = libevdev_get_num_slots(dev);
- else
- priv->max_touches = SYNAPTICS_MAX_TOUCHES;
-
+ priv->max_touches = libevdev_get_num_slots(dev);
priv->touch_axes = malloc(priv->num_mt_axes *
sizeof(SynapticsTouchAxisRec));
if (!priv->touch_axes) {