Compare commits

..

13 Commits

Author SHA1 Message Date
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
Peter Hutterer
8a9b1ec6b5 evdev 2.8.1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-07-11 11:09:24 +10:00
Peter Hutterer
356565111a Don't allow a wheel emulation inertia of 0 (#66125)
Inertia of 0 results in an infinite loop of events being sent to the server.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-06-27 06:58:27 +10:00
Peter Hutterer
fff3a60fbf Use EvdevBitIsSet, not the server's BitIsOn
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-05-31 06:57:22 +10:00
Peter Hutterer
8f209ac60d Drop cached name and led_bitmask - nothing reads this
Both fields are write-only as of xf86-input-evdev-2.5.99.902-1-g1ced7ec

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-05-31 06:57:22 +10:00
Peter Hutterer
a0d41af896 Switch default model to pc104.
As of xkeyboard-config 1.9, the evdev model is hidden (c887d2876)
The server switched to pc105 with version 1.8 (1df4bd601).

The evdev model resolves to pc104 anyway, so this commit has no real effect
other than to switch from a catch-all rule to explicit.
Use pc104 so this is easy to find for those investigating the code and
wondering why. pc104 is the 'correct' geometry for the us layout, which is
the default after all. Switching to pc105 would show keys missing if no
model is set (e.g. on uk/de layouts) but it would be the wrong layout for
the default.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Daniel Stone <daniel@fooishbar.org>
2013-05-31 06:57:16 +10:00
Peter Hutterer
dea1d1a390 Fail to set up axes for devices that only have MT axes but no ABS_X/Y equivalents (#64029)
The kernel should give us ABS_X/Y for backwards compat but some devices
don't. For now, ignore these devices as evdev is not suited to handle this
yet and will crash if a device is set up without axes (i.e.
pEvdev->vals == NULL) and later receives an event from an MT axis.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2013-05-01 15:05:43 +10:00
Peter Hutterer
b59a1a25da Add option TypeName (#62831)
evdev tries to assign the right XI 1.x type-name based on various device
capabilities. In some cases, that fails. e.g. the Mionix Naos 5000 mouse
looks like a keyboard. And we assign a keyboard type in that case since
there are plenty of keyboards that also advertise some axes or others.

Add a new option TypeName to allow for system-wide configuration of such
devices in a quirks file.

This can also be used to address #55867

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-04-16 10:25:02 +10:00
5 changed files with 77 additions and 52 deletions

View File

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

View File

@@ -220,6 +220,12 @@ is mapped to the negative Y axis motion and button number
.I N2
is mapped to the positive Y axis motion. Default: "4 5". Property:
"Evdev Wheel Emulation Axes".
.TP 7
.BI "Option \*qTypeName\*q \*q"type"\*q
Specify the X Input 1.x type (see XListInputDevices(__libmansuffix__)).
There is rarely a need to use this option, evdev will guess the device type
based on the device's capabilities. This option is provided for devices that
need quirks.
.SH SUPPORTED PROPERTIES
The following properties are provided by the

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) {
@@ -392,7 +395,7 @@ EvdevWheelEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
inertia = *((CARD16*)val->data);
if (inertia < 0)
if (inertia <= 0)
return BadValue;
if (!checkonly)

View File

@@ -96,7 +96,7 @@
static const char *evdevDefaults[] = {
"XkbRules", "evdev",
"XkbModel", "evdev",
"XkbModel", "pc104", /* the right model for 'us' */
"XkbLayout", "us",
NULL
};
@@ -493,31 +493,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 +1165,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 +1177,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);
}
@@ -1267,7 +1279,7 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device, int want_scroll_axes)
for (j = 0; j < ArrayLength(mt_axis_mappings); j++)
{
if (mt_axis_mappings[j].mt_code == axis &&
BitIsOn(pEvdev->abs_bitmask, mt_axis_mappings[j].code))
EvdevBitIsSet(pEvdev->abs_bitmask, mt_axis_mappings[j].code))
{
mt_axis_mappings[j].needs_mapping = TRUE;
skip = TRUE;
@@ -1283,6 +1295,15 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device, int want_scroll_axes)
num_axes--;
}
}
/* device only has mt-axes. the kernel should give us ABS_X etc for
backwards compat but some devices don't have it. */
if (num_axes == 0 && num_mt_axes > 0) {
xf86IDrvMsg(pInfo, X_ERROR,
"found only multitouch-axes. That shouldn't happen.\n");
goto out;
}
#endif
#ifdef HAVE_SMOOTH_SCROLLING
@@ -1675,7 +1696,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
@@ -1974,12 +1995,10 @@ EvdevCache(InputInfoPtr pInfo)
int i, len;
struct input_id id;
char name[1024] = {0};
unsigned long bitmask[NLONGS(EV_CNT)] = {0};
unsigned long key_bitmask[NLONGS(KEY_CNT)] = {0};
unsigned long rel_bitmask[NLONGS(REL_CNT)] = {0};
unsigned long abs_bitmask[NLONGS(ABS_CNT)] = {0};
unsigned long led_bitmask[NLONGS(LED_CNT)] = {0};
if (ioctl(pInfo->fd, EVIOCGID, &id) < 0)
@@ -1991,13 +2010,6 @@ EvdevCache(InputInfoPtr pInfo)
pEvdev->id_vendor = id.vendor;
pEvdev->id_product = id.product;
if (ioctl(pInfo->fd, EVIOCGNAME(sizeof(name) - 1), name) < 0) {
xf86IDrvMsg(pInfo, X_ERROR, "ioctl EVIOCGNAME failed: %s\n", strerror(errno));
goto error;
}
strcpy(pEvdev->name, name);
len = ioctl(pInfo->fd, EVIOCGBIT(0, sizeof(bitmask)), bitmask);
if (len < 0) {
xf86IDrvMsg(pInfo, X_ERROR, "ioctl EVIOCGBIT for bitmask failed: %s\n",
@@ -2025,15 +2037,6 @@ EvdevCache(InputInfoPtr pInfo)
memcpy(pEvdev->abs_bitmask, abs_bitmask, len);
len = ioctl(pInfo->fd, EVIOCGBIT(EV_LED, sizeof(led_bitmask)), led_bitmask);
if (len < 0) {
xf86IDrvMsg(pInfo, X_ERROR, "ioctl EVIOCGBIT for EV_LED failed: %s\n",
strerror(errno));
goto error;
}
memcpy(pEvdev->led_bitmask, led_bitmask, len);
/*
* Do not try to validate absinfo data since it is not expected
* to be static, always refresh it in evdev structure.
@@ -2548,6 +2551,9 @@ EvdevUnInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
/* Release string allocated in EvdevOpenDevice. */
free(pEvdev->device);
pEvdev->device = NULL;
free(pEvdev->type_name);
pEvdev->type_name = NULL;
}
xf86DeleteInput(pInfo, flags);
}
@@ -2579,6 +2585,8 @@ EvdevAlloc(void)
pEvdev->rel_axis_map[0] = 0;
pEvdev->rel_axis_map[1] = 1;
pEvdev->type_name = NULL;
return pEvdev;
}
@@ -2623,6 +2631,14 @@ EvdevPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
goto error;
}
/* Overwrite type_name with custom-defined one (#62831).
Note: pInfo->type_name isn't freed so we need to manually do this
*/
pEvdev->type_name = xf86SetStrOption(pInfo->options,
"TypeName",
pInfo->type_name);
pInfo->type_name = pEvdev->type_name;
EvdevAddDevice(pInfo);
if (pEvdev->flags & EVDEV_BUTTON_EVENTS)

View File

@@ -235,12 +235,10 @@ typedef struct {
OsTimerPtr reopen_timer;
/* Cached info from device. */
char name[1024];
unsigned long bitmask[NLONGS(EV_CNT)];
unsigned long key_bitmask[NLONGS(KEY_CNT)];
unsigned long rel_bitmask[NLONGS(REL_CNT)];
unsigned long abs_bitmask[NLONGS(ABS_CNT)];
unsigned long led_bitmask[NLONGS(LED_CNT)];
struct input_absinfo absinfo[ABS_CNT];
/* minor/major number */
@@ -251,6 +249,8 @@ typedef struct {
EventQueueRec queue[EVDEV_MAXQUEUE];
enum fkeymode fkeymode;
char *type_name;
} EvdevRec, *EvdevPtr;
/* Event posting functions */