Commit Graph

351 Commits

Author SHA1 Message Date
Peter Hutterer
bf356d9399 evdev 2.2.4 xf86-input-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
Peter Hutterer
c0bee1b4d6 evdev 2.2.3
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
xf86-input-evdev-2.2.3
2009-07-30 11:11:43 +10:00
Peter Hutterer
8acc999d40 Evdev doesn't require inputproto.
None of the inputproto headers seem to be included anywhere.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 6f4634111a)

Conflicts:

	configure.ac
2009-07-30 09:44:34 +10:00
Peter Hutterer
3cce7fa38a If a device fails to initialize relative axes, init the abs. axes instead.
Some devices have relative axes that don't count (scroll wheels). In this
case, don't claim we've initialized relative axes, continue with the
absolute axes instead.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit b07ab6ea97)
2009-07-30 09:44:34 +10:00
Peter Hutterer
c793aa2738 Don't register middle mouse button emulation handlers for keyboards.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 2994825665)
2009-07-30 09:44:34 +10:00
Oliver McFadden
9f3632c0b6 Coverity Prevent: NO_EFFECT in EvdevWheelEmuSetProperty:
Event unsigned_compare: Comparing unsigned less than zero is never true. "pEvdev->emulateWheel.timeout < 0UL"
342  	            if (pEvdev->emulateWheel.timeout < 0)

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 9bfd9e8a36)
2009-07-30 09:44:34 +10:00
Asbjrn Sannes
06b303f26d evdev: Fix spelling of property in man page to match source code. #22571
Signed-off-by: Asbj�rn Sannes <ace@sannes.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit db8b1ca5cf)
2009-07-30 09:44:34 +10:00
Derek Upham
4dda242d56 evdev: Prevent driver from processing motion events that it has not configured. #21832
The current implementation initializes itself to support relative
motion events, or absolute motion events, or neither.  But the
event-handling code attempts to process all events, no matter what the
initialization was.  This patch reproduces the flag tests found during
init, to skip events that the driver doesn't support.

Signed-off-by: Derek Upham <sand@blarg.net>
Signed-off-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 0a3657d2ee)
2009-07-30 09:44:33 +10:00
Peter Hutterer
4efe0d272e Deal with BTN_3 to BTN_9 buttons.
These buttons were previously mapped to 0, i.e. inactive. This patch
slightly improves things in that the buttons are now mapped to 8+.

Devices that have both BTN_3 and BTN_SIDE (or a similar pair in that
sequence) have both mapped to the same button number though.
Devices that have BTN_LEFT, BTN_0, BTN_3 and BTN_SIDE have the last three
mapped to 8 (and their followers have double-mappings too). We'll fix that
once we actually see devices affected by this.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit dc2191285e)
2009-07-30 09:44:33 +10:00
Peter Hutterer
1432b5153e Only initialize the number of buttons we actually have.
This takes into account driver-configured button mappings, i.e. if device
with one button has this button mapped to 25 through the ButtonMapping
option, the X server will think the device has result 25 buttons.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 255b9f6bbf)
2009-07-30 09:44:33 +10:00
Peter Hutterer
b8519930e4 Ensure enough buttons are advertised to pass the button mapping.
Some buttons are mapped to higher button numbers. For example, BTN_0 is
posted as button 8 if BTN_LEFT is present. On top of that, the
driver-specific button mapping may map the button to something else again.
We need to take these mappings into account when counting the number of
buttons on the device.

Example: A device with BTN_LEFT and BTN_0 and a mapping from 1 -> 7 and 8 ->
2.

BTN_LEFT is mapped to 1. 1 is mapped to 7. num_buttons is 7.
BTN_0 is mapped to 8. 8 is mapped to 2. num_buttons remains 7.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit b358f1eb3a)
2009-07-30 09:44:33 +10:00
Peter Hutterer
6d43a45b99 Up the number of button labels atoms to EVDEV_MAXBUTTONS.
Button labels would smash memory if the device had less than 4 buttons and
did not advertise a wheel event. In this case the hard-coded wheel button
labels would write past the atoms[] boundary.

Potential memory smash if a device had a BTN_LEFT and BTN_0, since the
latter would map to 8, regardless of the the number of actual buttons
(same with BTN_MIDDLE and BTN_1 or BTN_RIGHT and BTN_2).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 33cc112ca1)
2009-07-30 09:44:33 +10:00
Peter Hutterer
40d3ad3ac0 Only label axes and buttons if the device has axes or buttons.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 3c43d880f1)
2009-07-30 09:44:33 +10:00
Peter Hutterer
cf887a2b7c evdev 2.2.2 xf86-input-evdev-2.2.2 2009-04-30 16:39:15 +10:00
Peter Hutterer
1cc0651e1b Print read errors as X_NONE to avoid mallocs in the server.
Messages of type X_NONE are just passed down to the log files, everything else
gets the (EE) or (II) prefixed. Since this mallocs, we can't use it in the
signal handler.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 220e2dfb8f)
2009-04-30 16:38:43 +10:00
Peter Hutterer
48a747ea86 Pre-allocate the reopen timer so we don't allocate during sigio handling.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit ddc1266374)
2009-04-30 16:38:41 +10:00
Peter Hutterer
aa58eb6096 Trigger read error handling if len is <= 0.
Red Hat Bug 494245 <https://bugzilla.redhat.com/show_bug.cgi?id=494245>

Reported-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 98ecb5233b)
2009-04-06 10:44:55 +10:00
Peter Hutterer
aff7228d97 evdev 2.2.1 xf86-input-evdev-2.2.1 2009-03-24 15:13:23 +10:00
Peter Hutterer
c695234c5c Fix jumpy touchpads by updating old_vals only when reported by the device.
Remember whether ABS_X or ABS_Y were reported before the SYN event and only
update the old_vals[0, 1] if we got data for them.
Touchpads that reported pressure data before x/y would otherwise update
old_x/y with bogus values, leading to jumps when the first x/y coordinates
were actually reported.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit d9809d7edd)
2009-03-23 16:36:15 +10:00
Peter Hutterer
79d4956add If we have a touchpad, print so, don't claim we're configuring a tablet.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit b11439a176)
2009-03-23 16:36:13 +10:00
Jeremy Jay
7e9809837c make sure to clear all axis_map entries
don't use uninitialized axis_map entries, ie axis_map[ABS_PRESSURE]

Signed-off-by: Jeremy Jay <dinkumator@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 740dc202f7)
2009-03-23 16:36:06 +10:00
Peter Hutterer
d07692a4af Assume touchscreen/touchpad if we have _either_ ABS_PRESSURE or BTN_TOUCH
Touchpads have pressure or touch and also BTN_TOOL_FINGER.
Touchscreens have either pressure or touch, but no finger.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 7ac0c4456d)
2009-03-23 16:36:03 +10:00
Jeremy Jay
1073cd4fdc Set "rel" when converting absolute touchpad coordinates to relative (#20661)
We unset "abs" and convert to relative, but never set "rel" so the events
don't get posted. This bit got broken in 43dd2a9592.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit a3ea979c2b)
2009-03-23 16:35:50 +10:00
Peter Hutterer
486bbdc481 Restore repeat-filtering for server 1.5 and earlier.
Letting the server deal with key repeats is fine if we have server 1.6. For
earlier servers, we need to pass on the repeat events (except for modifier
keys).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Marty Jack <martyj19@comcast.net>
(cherry picked from commit a7fb654a68)
2009-03-23 16:35:46 +10:00
Peter Hutterer
73e5eba8cd evdev 2.2.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
xf86-input-evdev-2.2.0
2009-03-09 10:02:23 +10:00
Peter Hutterer
31853c39bf Define MAX_VALUATORS if it's missing to allow for builds against 1.5.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-09 09:31:16 +10:00
Peter Hutterer
2c49e21a81 Check button label before fetching the Atom from the server. (#20524)
The server doesn't like NULL names, so don't call XIGetKnownProperty for
labels that don't exist.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Peter Henriksson
2009-03-09 09:23:57 +10:00
Peter Hutterer
4361b3efa0 Fix duplicate wheel button up mapping.
Reported by Simon Thum.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Simon Thum <simon.thum@gmx.de>
2009-03-06 19:45:28 +10:00
Peter Hutterer
281a7b4b88 evdev 2.1.99.1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
xf86-input-evdev-2.1.99.1
2009-03-02 16:27:57 +10:00
Peter Hutterer
051cb8b528 Add support for button labelling.
Buttons 4/5 and 6/7 are hardcoded for wheel buttons.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-02 16:16:59 +10:00
Peter Hutterer
1abcc88171 Rename prop_label to prop_axis_label. 2009-03-02 16:16:58 +10:00
Peter Hutterer
c89bbf80be Don't double-assign the UKNOWN axis label.
All labels default to unknown anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-26 14:36:07 +10:00
Peter Hutterer
178435832f If scrollwheels are found, bump the button number by 4 (or up to 7).
Scrollwheel data is always posted as buttons, so we need to advertise at least
enough buttons to accommodate for 6/7 (horizontal wheel).

Note that this may mean that if you have a device that has scroll wheels and
axes, but no buttons, it may be interpreted as a mouse.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-26 14:35:46 +10:00
Peter Hutterer
c9cab83bac Ignore REL_WHEEL, REL_HWHEEL and REL_DIAL during axis initialisation.
We don't post the events for them anyway, so lets ignore them completely.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-26 09:11:14 +10:00
Peter Hutterer
43dd2a9592 Pass on all relative events, not just x/y.
9620fe776 added generic axes support for relativ values, but values from such
axes didn't get passed on to the server. Fix this.

Note that wheel events are not posted as motion events.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-26 09:11:14 +10:00
Adam Jackson
7977947e0d Reduce the number of read calls in ReadInput.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2009-02-26 09:11:02 +10:00
Peter Hutterer
11a56d4a17 Split ReadInput into ReadInput and ProcessEvent.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-26 09:11:01 +10:00
Adam Jackson
7b0f613c7f Move relative motion and other magic up to EV_SYN processing.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2009-02-26 09:10:47 +10:00
Adam Jackson
75af278861 Open with O_NONBLOCK, and simplify EvdevReadInput to match.
xf86WaitForInput() would call select() with zero timeout to discover if
more input was ready.  But we know that's always true at least once,
since we're only ever called from the sigio handler (if silken is
active) or from the main loop (if it's not and we selected readable).
With nonblocking IO we can just spin around until we hit EAGAIN, which
gets us down to n+1 syscalls per event instead of 2n.
2009-02-23 16:01:14 -05:00
Peter Hutterer
4fd9cd2ea8 Revert "Remove useless include directive."
Necessary for builds against 1.6, but let's at least get rid of XKB defines.

This reverts commit aa5dfa1d6a.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-19 10:04:34 +10:00
Peter Hutterer
12c287df89 Label axes conditional on actual support.
Server 1.6 has device properties, but not axis labels.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-18 09:38:13 +10:00
Peter Hutterer
9f1b9aa6eb Accommodate for holes in the ABS label defines.
abs_labels[] has to be aligned with the defines in linux/input.h, but the
latter does not have continuous range. Pad the holes with
AXIS_LABEL_PROP_ABS_MISC.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-18 09:20:18 +10:00
Peter Hutterer
acb1d557e2 Add support for arbitrary relative axis labels.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-17 15:24:57 +10:00
Peter Hutterer
6a1f8f463d Remove superfluous (and duplicate) call to xf86MotionHistoryAllocate.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-17 14:55:11 +10:00
Peter Hutterer
9620fe7765 Add generic axis support for relative axes.
Just query the kernel what axes we actually have, rather than hard-coding x/y.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-17 14:54:17 +10:00
Peter Hutterer
a1714cac52 Add dynamic axis labelling for absolute devices.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-17 14:42:56 +10:00
Peter Hutterer
5a99ef7ed2 remove duplicate (code > 255) check. 2009-02-16 15:11:20 +10:00
Peter Hutterer
3b22e4703f man: list the options and properties in alphabetical order.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-16 14:48:45 +10:00
Peter Hutterer
0de20a8f1b man: Fix two minor typos in man page.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-16 14:48:40 +10:00