Commit graph

21 commits

Author SHA1 Message Date
Peter Hutterer
8ead828e6f Fix a couple of coding style issues
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-01 12:09:57 +10:00
Hans de Goede
5c671e0375 evdev: Add support for POINTINGSTICK_CONST_ACCEL udev property
There is quite a wide spread in the delta events generated by trackpoints,
some generate deltas of 1-2 under normal use, while others generate deltas
from 1-20.

It is desirable to normalize trackpoint deltas just like we are normalizing
mouse deltas to 1000 dpi, so as to give different model laptops aprox.
the same trackpoint cursor speed ootb.

Recent versions of udev + hwdb set a POINTINGSTICK_CONST_ACCEL udev property
which can be used to adjust trackpoints which are too slow / too fast
ootb, this commit implements support for that property.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-04-22 09:35:28 +02:00
Peter Hutterer
ee376b0b56 Revert "touchpad: parse the TOUCHPAD_RESOLUTION property"
This reverts commit 0e64837f30.

Rather than a customized touchpad property, let udev handle this and set the
absinfo struct during the normal setup procedures. No need for libinput to
have a custom workaround here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-03-20 11:09:05 +10:00
Peter Hutterer
0e64837f30 touchpad: parse the TOUCHPAD_RESOLUTION property
Not all touchpad kernel drivers supply the x/y resolution. Let the udev hwdb
fix this up where possible and read the value from it.

This is intentionally only used on touchpads, touchscreen devices without
resolution should be considered buggy and fixed in the kernel.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-03-17 15:13:55 +10:00
Peter Hutterer
7f28b714d8 Replace event type check switch statements with a helper macro/function
The helper function now prints an error message if the event type passed is
not allowed.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-03-16 08:07:38 +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
c35885e87d Parse the MOUSE_WHEEL_CLICK_ANGLE udev property if present
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2015-01-13 13:35:42 +10:00
Peter Hutterer
70a34b0bc4 test: fix a clang compiler warning
misc.c:562:10: warning: missing field 'expected_dpi' initializer
[-Wmissing-field-initializers]
                { NULL }

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-01-06 09:53:30 +10:00
Derek Foreman
188d20b201 evdev: Query mouse DPI from udev
Instead of using a hard coded mouse DPI value, we query it from udev.
If it's not present or the property is obviously broken we fall back
to default.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-12-02 10:16:31 +10:00
Peter Hutterer
d7106544ea test: move device ID test to test/device.c
More appropriate here, they were in misc because this file didn't exist yet
when they were added.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-01 13:32:16 +10:00
David Herrmann
33ac7436a1 util: introduce ratelimit helpers
This adds "struct ratelimit" and "ratelimit_test()". It's a very simple
rate-limit helper modeled after Linux' lib/ratelimit.c by Dave Young.

This comes in handy to limit log-messages in possible busy loops etc..

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-11-07 08:30:50 +10:00
Peter Hutterer
748d094c9c util: add a couple of 3x3 matrix helper functions
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-09-01 11:23:53 +10:00
Peter Hutterer
d03488f4a3 test: prefix custom test devices with "litest"
Follow-up from 6c4778f891

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-07-04 07:57:59 +10:00
Peter Hutterer
4b88bf30d4 Add an enum for configuration return codes
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2014-07-03 13:48:43 +10:00
Peter Hutterer
5cecefeea0 test: fix compiler warnings for comparison int vs unsigned int
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-07-03 11:17:49 +10:00
Peter Hutterer
6b6f24ee1c Add functions to get the device name, PID and VID
Those three are the ones that matter for logging or device identification in
callers, so let's provide them.

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>
2014-07-02 08:52:33 +10:00
Jonas Ådahl
89aa3ca176 test: Add context reference counting test
This test relies on valgrind detecting the leak and use-after-free.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-06-25 10:27:03 +10:00
Jonas Ådahl
faab25c25c Make context reference counted
Instead of only allowing one owner keeping a libinput context alive,
make context reference counted, replacing libinput_destroy() with
libinput_unref() while adding another function libinput_ref().

Even though there might not be any current use cases, it doesn't mean we
should hard code this usage model in the API. The old behaviour can be
emulated by never calling libinput_ref() while replacing
libinput_destroy() with libinput_unref().

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-06-25 10:27:03 +10:00
Peter Hutterer
0d31f9e8b1 test: compiler warning fixes
misc.c: In function ‘create_simple_test_device’:
misc.c:71:54: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  while ((type = va_arg(args, unsigned int)) != -1 &&
                                                      ^
misc.c:72:54: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         (code = va_arg(args, unsigned int)) != -1) {
2014-06-03 11:01:04 +10:00
Jonas Ådahl
d4b66061b3 test: Queue two motion events in pointer event conversion test
Pointer acceleration filters may absorb the first event, so queue two,
just in case.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-05-29 13:06:26 +02:00
Peter Hutterer
daafe46cb3 test: add tests for event conversion and back
Looks a bit excessive given how simple the base is but hey, we don't want to
ever break that bit. That'd be embarrassing.

And while we're at it make sure that the 'wrong' event getters return NULL for
each event.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2014-04-10 11:11:56 +10:00