Commit Graph

350 Commits

Author SHA1 Message Date
Peter Hutterer
88eedea281 Cope with ABI_XINPUT_VERSION 7 - requires button + axes labels.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-18 15:33:48 +10:00
Peter Hutterer
9a5a4fed3a Split axes and button labels into separate function.
We'll re-use this bit very soon.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-18 15:18:14 +10:00
Derek Upham
0a3657d2ee 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>
2009-05-28 08:53:56 +10:00
Peter Hutterer
dc2191285e 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>
2009-05-21 15:51:08 +10:00
Peter Hutterer
255b9f6bbf 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>
2009-05-21 15:51:08 +10:00
Peter Hutterer
aa117d49a5 Rename pEvdev->buttons to pEvdev->num_buttons for clarity.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-21 15:51:08 +10:00
Peter Hutterer
b358f1eb3a 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>
2009-05-21 15:51:08 +10:00
Peter Hutterer
33cc112ca1 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>
2009-05-21 15:51:08 +10:00
Peter Hutterer
3c43d880f1 Only label axes and buttons if the device has axes or buttons.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-21 15:51:08 +10:00
Peter Hutterer
5462898935 Use xf86DisableDevice instead of the DIX' DisableDevice.
DisableDevice has changed API in xi2, xf86DisableDevice hasn't. So let's use
this one so we can have one version for master and xi2.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-16 14:27:08 +10:00
Dan Nicholson
9243d338d1 Fix copy-paste error when probing type name
A minor copy and paste error was introduced in 71e9a69e leaving an "if"
where an "else if" should be. Without this, any device configured as
XI_TOUCHPAD or XI_TABLET will end up having the type_name reset to
either XI_TOUCHSCREEN or XI_MOUSE.

Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-11 08:19:04 +10:00
Peter Hutterer
71e9a69ed6 Revamp the whole "has_axes" definition.
Since we can now deal with multiple axes, etc. we might as well print it
properly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-04-29 18:27:13 +10:00
Peter Hutterer
220e2dfb8f 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>
2009-04-16 13:44:07 +10:00
Peter Hutterer
ddc1266374 Pre-allocate the reopen timer so we don't allocate during sigio handling.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-04-16 13:44:05 +10:00
Peter Hutterer
98ecb5233b 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>
2009-04-06 10:25:03 +10:00
Peter Hutterer
92ca3dc2e7 Fix wrong reference to axis and button label atom list.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-26 13:40:40 +10:00
Peter Hutterer
3fa28c8acd Remove test/ directory.
This shouldn't really be part of the driver source, it's better to just have
it as a separate repository. Code has moved to
git://people.freedesktop.org/~whot/testdevices.git

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-26 10:20:56 +10:00
Peter Hutterer
d9809d7edd 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>
2009-03-17 14:15:00 +10:00
Peter Hutterer
b11439a176 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>
2009-03-17 13:27:03 +10:00
Jeremy Jay
740dc202f7 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>
2009-03-17 13:27:03 +10:00
Peter Hutterer
7ac0c4456d 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>
2009-03-17 10:08:33 +10:00
Peter Hutterer
b4f6ab126d Move keymap/modifier initialization behind the ABI < 5 ifdefs.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-16 10:36:13 +10:00
Jeremy Jay
a3ea979c2b 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>
2009-03-16 08:43:16 +10:00
Peter Hutterer
a7fb654a68 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>
2009-03-10 16:04:49 +10:00
Peter Hutterer
3f06825a44 Bump to 2.2.99.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-09 10:01:35 +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
Peter Hutterer
978384ede7 Swap axes after scaling, not before.
If we swap before scaling, we scale with the wrong coordinate range.

Reported by Matt Helsley.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-16 14:08:12 +10:00