Compare commits

...

8 Commits

Author SHA1 Message Date
Peter Hutterer
1e76b7602e evdev 2.8.4
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-05-08 09:21:56 +10:00
Peter Hutterer
62010287eb Use the server's device list for duplicate detection (#78309)
EvdevAddDevice/EvdevRemoveDevice keep a reference to the device to detect
duplicate devices based on the dev_t.

EvdevAddDevices was called during PreInit, EvdevRemoveDevice was called during
DEVICE_CLOSE. That makes it imbalanced if the device succeeds PreInit but the
server skips everything else because MAX_DEVICES is exceeded. So for all
devices after MAX_DEVICES, we'd add a reference but never remove it,
eventually reading/writing past evdev_devices.

The server keeps the list of devices for us anyway, so remove the copy of all
the pointers and instead run through the device list the server gives us.

X.Org Bug 78309 <http://bugs.freedesktop.org/show_bug.cgi?id=78309>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit 13dea90bc8)
2014-05-07 10:30:22 +10:00
Peter Hutterer
e41befa83f evdev 2.8.3
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-04-29 09:45:59 +10:00
Peter Hutterer
34619347b7 Map REL_DIAL to horizontal scrolling (#73105)
This was the original behavior introduced in
f77410e1f9 and stayed that way until smooth
scrolling erroneously added it as vertical axis in
b450efdf95. Revert to horizontal scrolling to
restore the previous behaviour - which unbreaks scrolling on Microsoft mice.

This effectively reverts 54a3120e33 too.

X.Org Bug 73105 <http://bugs.freedesktop.org/show_bug.cgi?id=73105>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit 16c85cbeac)

Conflicts:
	src/evdev.c
2014-04-29 09:44:34 +10:00
Peter Hutterer
1a031657b9 Fix wheel emulation for absolute device (#68415)
wheel emulation, for some reasons beyond time, got the value from
pEvdev->vals, then set the value back into pEvdev->vals. Alas, that value is
always 0, hence oldValue is zero and the delta is nil.

If we're not in relative (touchpad) mode, store the current value in
old_vals, so they're retrievable for the next event.

X.Org Bug 68415 <http://bugs.freedesktop.org/show_bug.cgi?id=68415>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit f6fcad8b10)
2014-04-29 09:43:14 +10:00
Peter Hutterer
51575b60b1 evdev 2.8.2
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-10-07 09:23:09 +11:00
Peter Hutterer
f285567d37 Write a SYN_REPORT after the last LED
When writing LED values to the device, append a SYN_REPORT to the list to
ensure other clients are updated immediately. Otherwise, the LED events
will be queued and not sent to other clients until the next input event
arrives.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
(cherry picked from commit 27926b3763)
2013-10-07 09:22:50 +11:00
Peter De Wachter
af1d085877 Map REL_DIAL to vertical scrolling
This makes the absolute axis codepath behave the same as the relative axis
path.

Signed-off-by: Peter De Wachter <pdewacht@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 54a3120e33)
2013-10-07 09:22:48 +11:00
3 changed files with 57 additions and 90 deletions

View File

@@ -23,7 +23,7 @@
# Initialize Autoconf
AC_PREREQ([2.60])
AC_INIT([xf86-input-evdev],
[2.8.1],
[2.8.4],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
[xf86-input-evdev])
AC_CONFIG_SRCDIR([Makefile.am])

View File

@@ -97,7 +97,6 @@ EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv)
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
WheelAxisPtr pAxis = NULL, pOtherAxis = NULL;
int value = pEv->value;
int oldValue;
/* Has wheel emulation been configured to be enabled? */
if (!pEvdev->emulateWheel.enabled)
@@ -118,9 +117,13 @@ EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv)
/* We don't want to intercept real mouse wheel events */
if(pEv->type == EV_ABS) {
int axis = pEvdev->abs_axis_map[pEv->code];
oldValue = valuator_mask_get(pEvdev->vals, axis);
valuator_mask_set(pEvdev->vals, axis, value);
value -= oldValue; /* make value into a differential measurement */
int oldValue;
if (axis > -1 && valuator_mask_fetch(pEvdev->old_vals, axis, &oldValue)) {
valuator_mask_set(pEvdev->vals, axis, value);
value -= oldValue; /* make value into a differential measurement */
} else
value = 0; /* avoid a jump on the first touch */
}
switch(pEv->code) {

View File

@@ -65,11 +65,6 @@
/* removed from server, purge when dropping support for server 1.10 */
#define XI86_SEND_DRAG_EVENTS 0x08
#ifndef MAXDEVICES
#include <inputstr.h> /* for MAX_DEVICES */
#define MAXDEVICES MAX_DEVICES
#endif
#define ArrayLength(a) (sizeof(a) / (sizeof((a)[0])))
#define MIN_KEYCODE 8
@@ -138,11 +133,6 @@ static Atom prop_btn_label;
static Atom prop_device;
static Atom prop_virtual;
/* All devices the evdev driver has allocated and knows about.
* MAXDEVICES is safe as null-terminated array, as two devices (VCP and VCK)
* cannot be used by evdev, leaving us with a space of 2 at the end. */
static EvdevPtr evdev_devices[MAXDEVICES] = {NULL};
static int EvdevSwitchMode(ClientPtr client, DeviceIntPtr device, int mode)
{
InputInfoPtr pInfo;
@@ -225,60 +215,25 @@ static BOOL
EvdevIsDuplicate(InputInfoPtr pInfo)
{
EvdevPtr pEvdev = pInfo->private;
EvdevPtr* dev = evdev_devices;
InputInfoPtr d;
if (pEvdev->min_maj)
nt_list_for_each_entry(d, xf86FirstLocalDevice(), next)
{
while(*dev)
{
if ((*dev) != pEvdev &&
(*dev)->min_maj &&
(*dev)->min_maj == pEvdev->min_maj)
return TRUE;
dev++;
}
EvdevPtr e;
if (strcmp(d->drv->driverName, "evdev") != 0)
continue;
e = (EvdevPtr)d->private;
if (e != pEvdev &&
e->min_maj &&
e->min_maj == pEvdev->min_maj)
return TRUE;
}
return FALSE;
}
/**
* Add to internal device list.
*/
static void
EvdevAddDevice(InputInfoPtr pInfo)
{
EvdevPtr pEvdev = pInfo->private;
EvdevPtr* dev = evdev_devices;
while(*dev)
dev++;
*dev = pEvdev;
}
/**
* Remove from internal device list.
*/
static void
EvdevRemoveDevice(InputInfoPtr pInfo)
{
EvdevPtr pEvdev = pInfo->private;
EvdevPtr *dev = evdev_devices;
int count = 0;
while(*dev)
{
count++;
if (*dev == pEvdev)
{
memmove(dev, dev + 1,
sizeof(evdev_devices) - (count * sizeof(EvdevPtr)));
break;
}
dev++;
}
}
static BOOL
EvdevDeviceIsVirtual(const char* devicenode)
{
@@ -493,31 +448,39 @@ EvdevProcessValuators(InputInfoPtr pInfo)
EvdevPtr pEvdev = pInfo->private;
int *delta = pEvdev->delta;
/* convert to relative motion for touchpads */
if (pEvdev->abs_queued && (pEvdev->flags & EVDEV_RELATIVE_MODE)) {
if (pEvdev->in_proximity) {
if (valuator_mask_isset(pEvdev->vals, 0))
{
if (valuator_mask_isset(pEvdev->old_vals, 0))
delta[REL_X] = valuator_mask_get(pEvdev->vals, 0) -
valuator_mask_get(pEvdev->old_vals, 0);
valuator_mask_set(pEvdev->old_vals, 0,
valuator_mask_get(pEvdev->vals, 0));
}
if (valuator_mask_isset(pEvdev->vals, 1))
{
if (valuator_mask_isset(pEvdev->old_vals, 1))
delta[REL_Y] = valuator_mask_get(pEvdev->vals, 1) -
valuator_mask_get(pEvdev->old_vals, 1);
valuator_mask_set(pEvdev->old_vals, 1,
valuator_mask_get(pEvdev->vals, 1));
if (pEvdev->abs_queued) {
/* convert to relative motion for touchpads */
if (pEvdev->flags & EVDEV_RELATIVE_MODE) {
if (pEvdev->in_proximity) {
if (valuator_mask_isset(pEvdev->vals, 0))
{
if (valuator_mask_isset(pEvdev->old_vals, 0))
delta[REL_X] = valuator_mask_get(pEvdev->vals, 0) -
valuator_mask_get(pEvdev->old_vals, 0);
valuator_mask_set(pEvdev->old_vals, 0,
valuator_mask_get(pEvdev->vals, 0));
}
if (valuator_mask_isset(pEvdev->vals, 1))
{
if (valuator_mask_isset(pEvdev->old_vals, 1))
delta[REL_Y] = valuator_mask_get(pEvdev->vals, 1) -
valuator_mask_get(pEvdev->old_vals, 1);
valuator_mask_set(pEvdev->old_vals, 1,
valuator_mask_get(pEvdev->vals, 1));
}
} else {
valuator_mask_zero(pEvdev->old_vals);
}
valuator_mask_zero(pEvdev->vals);
pEvdev->abs_queued = 0;
pEvdev->rel_queued = 1;
} else {
valuator_mask_zero(pEvdev->old_vals);
int val;
if (valuator_mask_fetch(pEvdev->vals, 0, &val))
valuator_mask_set(pEvdev->old_vals, 0, val);
if (valuator_mask_fetch(pEvdev->vals, 1, &val))
valuator_mask_set(pEvdev->old_vals, 1, val);
}
valuator_mask_zero(pEvdev->vals);
pEvdev->abs_queued = 0;
pEvdev->rel_queued = 1;
}
if (pEvdev->rel_queued) {
@@ -1157,7 +1120,7 @@ EvdevKbdCtrl(DeviceIntPtr device, KeybdCtrl *ctrl)
};
InputInfoPtr pInfo;
struct input_event ev[ArrayLength(bits)];
struct input_event ev[ArrayLength(bits) + 1];
int i;
memset(ev, 0, sizeof(ev));
@@ -1169,6 +1132,10 @@ EvdevKbdCtrl(DeviceIntPtr device, KeybdCtrl *ctrl)
ev[i].value = (ctrl->leds & bits[i].xbit) > 0;
}
ev[i].type = EV_SYN;
ev[i].code = SYN_REPORT;
ev[i].value = 0;
write(pInfo->fd, ev, sizeof ev);
}
@@ -1684,7 +1651,7 @@ EvdevAddRelValuatorClass(DeviceIntPtr device)
if (axis == REL_WHEEL)
SetScrollValuator(device, axnum, SCROLL_TYPE_VERTICAL, -1.0, SCROLL_FLAG_PREFERRED);
else if (axis == REL_DIAL)
SetScrollValuator(device, axnum, SCROLL_TYPE_VERTICAL, -1.0, SCROLL_FLAG_NONE);
SetScrollValuator(device, axnum, SCROLL_TYPE_HORIZONTAL, 1.0, SCROLL_FLAG_NONE);
else if (axis == REL_HWHEEL)
SetScrollValuator(device, axnum, SCROLL_TYPE_HORIZONTAL, 1.0, SCROLL_FLAG_NONE);
#endif
@@ -1960,7 +1927,6 @@ EvdevProc(DeviceIntPtr device, int what)
xf86IDrvMsg(pInfo, X_INFO, "Close\n");
EvdevCloseDevice(pInfo);
EvdevFreeMasks(pEvdev);
EvdevRemoveDevice(pInfo);
pEvdev->min_maj = 0;
break;
@@ -2627,8 +2593,6 @@ EvdevPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
pInfo->type_name);
pInfo->type_name = pEvdev->type_name;
EvdevAddDevice(pInfo);
if (pEvdev->flags & EVDEV_BUTTON_EVENTS)
{
EvdevMBEmuPreInit(pInfo);