Compare commits

...

6 Commits

Author SHA1 Message Date
Peter Hutterer
d5969caabe evdev 2.2.6
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-10-19 13:45:57 +10:00
Peter Hutterer
5a4b0ba33d Finalize the middle button emulation when a read error occurs (#23048)
If a read error occurs, remove the block and wakeup handlers for middle
mouse button emulation. Otherwise, they'll still be around after the device
has been reopened and overwritten with the new ones created by EvdevOn. Once
this happened, future removal of the device can lead to a server crash.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit f2dc0681fe)
2009-10-19 13:43:59 +10:00
Peter Hutterer
cd24c2cc18 evdev 2.2.5 2009-08-21 09:03:10 +10:00
Peter Hutterer
c8a0f1cf36 Only take the driver-internal button mapping to count buttons (#23405)
Regression:
    If a user has multiple buttons mapped to the same button number, the
    number of buttons counted is set to a wrong value.  e.g. a button
    mapping of 1 1 1 for a mouse with three buttons would only initialize 1
    button to the X server.

    In the future, the user cannot change this button mapping as the server
    only knows about one button.

The user-supplied button map (option ButtonMapping) shouldn't matter when
counting the buttons. Only the driver-internal mapping (BTN_0 -> button 1,
etc.) matters.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 415b6ffa95)
2009-08-20 11:10:13 +10:00
Peter Hutterer
bf356d9399 evdev 2.2.4 2009-08-06 14:08:55 +10:00
Michael Witten
4c1c4f2c83 evdev.c: Fix/improve discrimination of rel/abs axes
The relevant comment from evdev.c:

We don't allow relative and absolute axes on the same device. The
reason is that some devices (MS Optical Desktop 2000) register both
rel and abs axes for x/y.

The abs axes register min/max; this min/max then also applies to the
relative device (the mouse) and caps it at 0..255 for both axes.
So, unless you have a small screen, you won't be enjoying it much;
consequently, absolute axes are generally ignored.

However, currenly only a device with absolute axes can be registered
as a touch{pad,screen}. Thus, given such a device, absolute axes are
used and relative axes are ignored.

The code for initializing abs/rel axes has been abstracted out into
3 functions, so that initialization in EvdevInit(device) is as easy
as:

    if (pEvdev->flags & (EVDEV_TOUCHPAD | EVDEV_TOUCHSCREEN))
        EvdevInitTouchDevice(device, pEvdev);
    else if (pEvdev->flags & EVDEV_RELATIVE_EVENTS)
        EvdevInitRelClass(device, pEvdev);
    else if (pEvdev->flags & EVDEV_ABSOLUTE_EVENTS)
        EvdevInitAbsClass(device, pEvdev);

Signed-off-by: Michael Witten <mfwitten@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit f352598e45)
2009-08-06 14:08:35 +10:00
2 changed files with 79 additions and 22 deletions

View File

@@ -22,7 +22,7 @@
AC_PREREQ(2.57)
AC_INIT([xf86-input-evdev],
2.2.3,
2.2.6,
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
xf86-input-evdev)

View File

@@ -576,6 +576,7 @@ EvdevReadInput(InputInfoPtr pInfo)
{
if (errno == ENODEV) /* May happen after resume */
{
EvdevMBEmuFinalize(pInfo);
xf86RemoveEnabledDevice(pInfo);
close(pInfo->fd);
pInfo->fd = -1;
@@ -1163,6 +1164,64 @@ EvdevInitButtonMapping(InputInfoPtr pInfo)
}
static void
EvdevInitAbsClass(DeviceIntPtr device, EvdevPtr pEvdev)
{
if (EvdevAddAbsClass(device) == Success) {
xf86Msg(X_INFO,"%s: initialized for absolute axes.\n", device->name);
} else {
xf86Msg(X_ERROR,"%s: failed to initialize for absolute axes.\n",
device->name);
pEvdev->flags &= ~EVDEV_ABSOLUTE_EVENTS;
}
}
static void
EvdevInitRelClass(DeviceIntPtr device, EvdevPtr pEvdev)
{
int has_abs_axes = pEvdev->flags & EVDEV_ABSOLUTE_EVENTS;
if (EvdevAddRelClass(device) == Success) {
xf86Msg(X_INFO,"%s: initialized for relative axes.\n", device->name);
if (has_abs_axes) {
xf86Msg(X_WARNING,"%s: ignoring absolute axes.\n", device->name);
pEvdev->flags &= ~EVDEV_ABSOLUTE_EVENTS;
}
} else {
xf86Msg(X_ERROR,"%s: failed to initialize for relative axes.\n",
device->name);
pEvdev->flags &= ~EVDEV_RELATIVE_EVENTS;
if (has_abs_axes)
EvdevInitAbsClass(device, pEvdev);
}
}
static void
EvdevInitTouchDevice(DeviceIntPtr device, EvdevPtr pEvdev)
{
if (pEvdev->flags & EVDEV_RELATIVE_EVENTS) {
xf86Msg(X_WARNING,"%s: touchpads and touchscreens ignore relative "
"axes.\n", device->name);
pEvdev->flags &= ~EVDEV_RELATIVE_EVENTS;
}
EvdevInitAbsClass(device, pEvdev);
}
static int
EvdevInit(DeviceIntPtr device)
{
@@ -1181,28 +1240,27 @@ EvdevInit(DeviceIntPtr device)
EvdevAddKeyClass(device);
if (pEvdev->flags & EVDEV_BUTTON_EVENTS)
EvdevAddButtonClass(device);
/* We don't allow relative and absolute axes on the same device. Reason
Reason being that some devices (MS Optical Desktop 2000) register both
rel and abs axes for x/y.
The abs axes register min/max, this min/max then also applies to the
relative device (the mouse) and caps it at 0..255 for both axis.
So unless you have a small screen, you won't be enjoying it much.
FIXME: somebody volunteer to fix this.
/* We don't allow relative and absolute axes on the same device. The
* reason is that some devices (MS Optical Desktop 2000) register both
* rel and abs axes for x/y.
*
* The abs axes register min/max; this min/max then also applies to the
* relative device (the mouse) and caps it at 0..255 for both axes.
* So, unless you have a small screen, you won't be enjoying it much;
* consequently, absolute axes are generally ignored.
*
* However, currenly only a device with absolute axes can be registered
* as a touch{pad,screen}. Thus, given such a device, absolute axes are
* used and relative axes are ignored.
*/
if (pEvdev->flags & EVDEV_RELATIVE_EVENTS) {
if (EvdevAddRelClass(device) == Success)
{
if (pEvdev->flags & EVDEV_ABSOLUTE_EVENTS)
xf86Msg(X_INFO,"%s: relative axes found, ignoring absolute "
"axes.\n", device->name);
pEvdev->flags &= ~EVDEV_ABSOLUTE_EVENTS;
} else
pEvdev->flags &= ~EVDEV_RELATIVE_EVENTS;
}
if (pEvdev->flags & EVDEV_ABSOLUTE_EVENTS)
EvdevAddAbsClass(device);
if (pEvdev->flags & (EVDEV_TOUCHPAD | EVDEV_TOUCHSCREEN))
EvdevInitTouchDevice(device, pEvdev);
else if (pEvdev->flags & EVDEV_RELATIVE_EVENTS)
EvdevInitRelClass(device, pEvdev);
else if (pEvdev->flags & EVDEV_ABSOLUTE_EVENTS)
EvdevInitAbsClass(device, pEvdev);
#ifdef HAVE_PROPERTIES
/* We drop the return value, the only time we ever want the handlers to
@@ -1487,8 +1545,7 @@ EvdevProbe(InputInfoPtr pInfo)
int mapping = 0;
if (TestBit(i, pEvdev->key_bitmask))
{
mapping =
pEvdev->btnmap[EvdevUtilButtonEventToButtonNumber(pEvdev, i)];
mapping = EvdevUtilButtonEventToButtonNumber(pEvdev, i);
if (mapping > num_buttons)
num_buttons = mapping;
}