Commit graph

945 commits

Author SHA1 Message Date
Peter Hutterer
79e64ce0b5 doc: document udev device tagging
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-02-23 10:28:23 +10:00
Peter Hutterer
02d8bc766b doc: add missing space
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-02-23 10:28:23 +10:00
Peter Hutterer
ca9da65cff cosmetic: fix a whitespace issue
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-02-23 09:01:25 +10:00
Peter Hutterer
ed0f0bf494 test: fix Coverity complaints
seat_button_count
seat_key_count ... uninitialized variable

t = zalloc
s = zalloc ... dereferencing potential NULL-pointer

d->ntouches_down... side-effect in assertion

Coverity run against the 0.10.0 tag, see
https://scan.coverity.com/projects/4298

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Christian Hartmann <cornogle@googlemail.com>
2015-02-20 10:03:09 +10:00
Peter Hutterer
002ef1635d cosmetic: drop double empty lines
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-02-20 09:57:39 +10:00
Peter Hutterer
413c29fef7 udev: fix a race condition if a device disappears before we get a handle
If the device disappears too quickly, the device is NULL, the sysname is NULL
and that causes a segfault in strcmp.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-02-19 06:56:23 +10:00
Peter Hutterer
a138069d5c Rename noaccel to unaccel for consistency
No functional changes, this affects the declaration only.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-02-18 15:05:56 +10:00
Peter Hutterer
65e077759b evdev: check the first parent of the event node for ID_INPUT tags
Bluetooth tablet devices' rules can't tag the event node directly, they can
only tag the first parent (the /sys/class/input/input1234 node). Check that
parent for tags too, lest we miss something important.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-02-18 10:08:35 +10:00
Benjamin Tissoires
cbeacfed13 Use LIBINPUT_DEVICE_GROUP from udev as group identifier
Store it as identifier in the device group, any two devices that have a
the same non-NULL identifier share the group.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-02-18 10:08:35 +10:00
Peter Hutterer
2b2a1b0eb9 Add udev bits to assign LIBINPUT_DEVICE_GROUP
The easiest way to get a device group is by looking at the phys path of the
input device (which looks like usb-0000:00:14.0-1/input1) and dropping the
/inputX bit. The rest is the same for devices that belong together (except on
the Cintiq 22HD Touch).

Ideally we could just take ATTRS{phys} but we can't select substrings to drop
into ENV so we need to do it ourselves. This patch adds a callout that takes a
syspath and prints the mangled path, to be used in LIBINPUT_DEVICE_GROUP.

The rule triggers on any device that has a non-zero phys attribute, this
groups devices like tablets together but also devices like mice with multiple
interfaces.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-02-18 10:08:29 +10:00
Peter Hutterer
f0d7eaf11e tools: print the device group in event-debug
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-02-18 09:47:41 +10:00
Peter Hutterer
761baeb6e6 Add libinput_device_pointer_has_button over the plain has_button
If a device has multiple capabilities, has_button is imprecise. A device with
tablet and pointer capability for example may have BTN_LEFT on the pointer
interface but not on the tablet interface.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-02-13 14:36:56 +10:00
Marek Chalupa
a9f216ab47 add simple symbols leak checker
This patch adds simple script that compares libinput.sym file to the
functions that are marked by LIBINPUT_EXPORT. This script is added
to make check target.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-02-13 10:20:44 +10:00
Peter Hutterer
d6da0e18c2 Add two missing @ref tags
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-02-11 14:54:53 +10:00
Peter Hutterer
43a3a6ced0 evdev: add missing %s for accelerometer tagging
Oh gcc warning, where are thou?

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-02-11 12:38:18 +10:00
Peter Hutterer
911059b1e7 doc: add a dot graph for device groups and two missing @refs
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-02-09 09:50:31 +10:00
Peter Hutterer
b384f2a8ab evdev: switch to using udev's device tagging system
Use ID_INPUT_FOO to assume a device is a FOO, don't decide ourselves based on
whatever bits are available. This moves the categorization out to udev's
input_id builtin by default and other bits that tag the device. libwacom tags
all known devices as ID_INPUT_TABLET and (for touch-enabled ones)
ID_INPUT_TOUCH - we can re-use that knowledge then.

Ignore anything that doesn't have ID_INPUT set, this provides for an easy way
of making devices "invisible" to libinput.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-02-09 08:36:58 +10:00
Benjamin Tissoires
1edbac96fa evdev: retrieve udev tags
udev already tags the devices by opening each of them and analyzing their
features. We are basically re-doing this in libinput.

The advantage of udev tags over the plain heuristic from libinput is that
users (or driver writers) can force some tags that are not detected by
common rules. For instance, the pad part of the Wacom tablets is difficult
to discriminate from a joystick or a pointer.

For now we tread INPUT_ID_KEY and INPUT_ID_KEYBOARD as equivalent. It may
become necessary to separate them later.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-02-09 08:36:52 +10:00
Peter Hutterer
cbee7ce783 README: Add the libinput component to the bugzilla URL
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-02-09 08:12:45 +10:00
Peter Hutterer
eeac661d93 doc: document that we're ignoring position-less clicks
This can happen a lot easier on the new Lenovo series, so document that this
is intentional behavior.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-02-06 14:35:37 +10:00
Peter Hutterer
e3a43902f9 Introduce device groups to group logical devices together
Devices like Wacom tablets have multiple event nodes (touch, pad and stylus).
This requires some logical grouping, e.g. setting an Intuos 5 tablet
left-handed effectively turns it upside down. That then applies to both the
stylus and the touch device.

Merging the devices into one struct libinput_device is not feasable, it
complicates the API for little benefit. A caller would still need access to
all subdevices to get udev handles, etc. Some configuration options apply to
the whole device (left-handed) but some (may) only apply to a single subdevice
(calibration, natural scrolling).

Addressing this would make the libinput API unwieldly and hard to use.

Instead, add a device group concept. Each device is a member of a device
group - a singleton for most devices. Wacom tablets will have a single group
across multiple devices, allowing the caller to associate the devices together
if needed.

The API is intentionally very simple and requires the caller to keep track of
groups and which/how many devices are in it. The caller has more powerful
libraries available to do that than we have.

This patch does not address the actual merging of devices into the same
device group, it simply creates a new group for each new device.

[rebased on top of 0.10]
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2015-02-06 11:08:43 +10:00
Peter Hutterer
ca4e03fb11 configure.ac: libinput 0.10.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-02-06 10:33:02 +10:00
Olivier Fourdan
f420c54a99 Fix an abort if the device speed is NaN
When using libinput with xf86-input-libinput, the device speed is
represented as a float passed via X properties.

If a buggy client gives a broken value, the conversions that occur
can cause the value of speed to be NaN (not a number), aka infinity.

In C, any comparison with NaN always gives false, whatever the value.

So that test in libinput_device_config_accel_set_speed():

   (speed < 1.0 || speed > 1.0)

will necessarily return FALSE, defeating the test of range.

However, since since any comparison with NaN is false, the
opposite assert() in accelerator_set_speed():

   (speed >= 1.0 && speed <= 1.0)

will be false as well, thus triggering the abort() and the crash of
the entire X server along with it.

The solution is to use the same construct in both routines, so that
it fails gracefully in libinput_device_config_accel_set_speed().

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-02-06 10:26:04 +10:00
Peter Hutterer
65b5647076 cosmetic: fix grammar in doxygen
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-02-06 10:08:33 +10:00
Peter Hutterer
0968c067f6 touchpad: mark two switch fallthroughs with comments
Coverity pointed these out, they're false positives but mark them with
comments to make it obvious to the reader.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-02-04 09:11:46 +10:00
Peter Hutterer
bcb6f22d89 path: make sure udev devices are initialized before usage
When creating uinput devices, we get the devnode from the kernel directly
rather than through udev. When we add this to the path backend too quickly the
udev_device we get may not be fully initialized and properties may be missing.
This causes false test results.

Avoid this by making sure the handle we have is initialized. This should never
trigger on a real device anyway, even creating a device through litest is slow
enough to avoid this issue. Only affected are the tests in misc.c where we
create the uinput device directly.

Nonetheless, handle this for the generic case so we don't run into heisenbugs
later.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-02-04 08:14:50 +10:00
Peter Hutterer
26140aba23 test: switch event conversion tests to use litest devices
Makes the code use more commonly used paths, no real functional changes at
this point. This was using hand-crafted devices as it predates the
litest_add_for_device() helper.

For an upcoming patch to use the udev ID_INPUT_. tags the
event_conversion_key test requires this change: without it the device will be
tagged with ID_INPUT_KEY but not ID_INPUT_KEYBOARD. This could be fixed by
adding all normal keyboard keys to the uinput device but it's easier to just
re-use litest.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-02-04 08:14:08 +10:00
Peter Hutterer
536dd6a40f zalloc the libinput_source, don't malloc it
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2015-02-03 10:56:38 +10:00
Peter Hutterer
154b3cf749 Don't init pointer acceleration on absolute devices
Note: touchpads have a different backend, we never get here in that case. This
only applies to true absolute pointer devices.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2015-02-03 10:56:38 +10:00
Peter Hutterer
2a95a8586d test: add pointer acceleration defaults test
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2015-02-03 10:43:48 +10:00
Peter Hutterer
199cd87b07 evdev: set the default speed after initializing ptraccel
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2015-02-03 10:40:49 +10:00
Peter Hutterer
b21fbfd947 filter: zalloc the struct to make sure the speed is initialized
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2015-02-03 10:37:51 +10:00
Peter Hutterer
ecec6721d1 cosmetic: remove double empty-line
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-02-03 10:34:53 +10:00
Peter Hutterer
4ec2947cc9 test: add per-device udev rule support
Don't rely on a magic version tag, instead let a device define a udev rule and
drop that into the udev runtime directory before the device is created.

There are a couple of caveats with this approach: first, since this changes
system-wide state it may cause issues on the device the test suite is run on.
This can be avoided if the udev rules have filter patterns that ensure only
test devices are affected.

Second, the check test suite aborts but it doesn't run the teardown() function
if a test fails. So far this wasn't a problem since uinput devices disappear
whenever we exit. The rules files will hang around though, so an unchecked
fixture was added to delete all litest-foo.rules files before and after a test
case starts. Unchecked fixtures are run regardless of the exit status of the
test but run in the same address space - i.e. no ck_assert() usage.

Also unchecked fixtures are only run once per test-case, not once per test
function. For us, that means they're only run once per device (we use the
devices as test case), i.e. if a test fails and the udev rule isn't tidied up,
the next test may be unpredictable. This shouldn't matter too much though.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-02-03 10:34:26 +10:00
Peter Hutterer
7d7ea4ec2e Add missing doxygen ingroup tag for libinput_device_get_udev_device
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-01-30 15:39:41 +10:00
Peter Hutterer
fd8a29fb69 configure.ac: libinput 0.9.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-01-30 14:05:01 +10:00
Peter Hutterer
149f711fcc test: add tests for new lenovo touchpads
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-01-29 14:44:35 +10:00
Peter Hutterer
428614bb24 touchpad: re-route trackpoint buttons on the *50 Lenovo series
The laptops on this series have the physical trackpoint buttons back but
wired them up to the touchpad instead of the trackpoint device and they appear
as BTN_0, BTN_1 and BTN_2 for left, right, middle.

The udev hwdb marks these for us with the TOUCHPAD_HAS_TRACKPOINT_BUTTONS tag
[1]. Use that tag to identify them and re-route the events through the
trackstick device after mangling the event codes to represent the actual
buttons.

[1] http://cgit.freedesktop.org/systemd/systemd/tree/hwdb/70-touchpad.hwdb

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-01-29 14:43:57 +10:00
Peter Hutterer
82bb5841a2 test: add a test device for the Lenovo X1 Carbon 3rd
Notable: sends BTN_0/1/2 instead of the trackpoint

This device currently has the INPUT_PROP_TOPBUTTONPAD property set, kernel
patches [1] and [2] are pending to remove this. This test device already lacks
the property.

[1] https://patchwork.kernel.org/patch/5730371/
[2] https://patchwork.kernel.org/patch/5730451/

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-01-29 14:40:26 +10:00
Peter Hutterer
c411de1078 test: set the input_id->version as well in litest devices
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-01-28 16:28:01 +10:00
Friedrich Schöller
529ce8e4ac tools: Check if axis value is available in debugging GUI
libinput complained with lots of "client bug" messages because the GUI tool
did not check which axis values were available.

Signed-off-by: Friedrich Schöller <code@schoeller.se>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-01-27 13:34:23 +10:00
Friedrich Schöller
4a90910895 tools: Use correct event axis in debugging GUI
Vertical axis values were used for the horizontal axis as well.

Introduced 1baf109b40

Signed-off-by: Friedrich Schöller <code@schoeller.se>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-01-27 12:29:52 +10:00
Hans de Goede
0afd0b792f evdev: Be more careful about what we consider a joystick
After switching my main workstation over to using xf86-input-libinput, I
noticed that the multi-media keys like play/pause on my keyboard no longer
worked.

It turns out that the second hid interface on my keyboard which has the
multimedia-keys, also declares having: BTN_BASE6 and BTN_MODE which both
fell into the range we were using to test for something being a joystick.

The commit makes our joystick test mode strict, restoring functionality
of the multi-media keys on the keyboard in question.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-01-22 13:29:26 +10:00
Marek Chalupa
594bbb01af Remove libinput_event_pointer_get_axis from symbols
This function was removed in 1baf109b40

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-01-22 11:57:13 +10:00
Peter Hutterer
82c2b78313 Move the new click method configuration tools to the right symbol version set
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-01-20 11:32:55 +10:00
Peter Hutterer
7ce25592d9 tools: add click method config to the tools
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-01-16 10:35:00 +10:00
Peter Hutterer
5c7f2a1949 tests: add a few clickfinger tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-01-16 10:34:24 +10:00
Peter Hutterer
5adf0aa2ad test: run clickfinger test for all clickpad-capable devices
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-01-16 10:34:24 +10:00
Peter Hutterer
fb451d4816 test: add tests for clickfinger defaults
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-01-16 10:34:24 +10:00
Peter Hutterer
0c50e186a0 touchpad: hook up click method configuration
Allow switching between softbuttons and clickfinger on any mt-capable
clickpad.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
[hdegoede@redhat.com] Keep top softbuttons working when enabling clickfinger
[hdegoede@redhat.com] Simply touchpad click method switching
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2015-01-16 10:34:24 +10:00