Available in kernel 4.5 and later (uinput version 5), these ioctls allow us to
set the absinfo correctly, i.e. including the resolution.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
No functional changes. This is prep work for supporting the new
UIDEV_DEV_SETUP ioctl.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
The kernel has split most of the event codes out to a new header but the FF_
bits are missing from that header. Until this is fixed upstream, change the
event code parsing so it can take two files (using cat and stdin) so we can
update the kernel headers again.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
We abort if anything goes wrong anyway, so we never returned anything but
success.
Found by coverity.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
In theory, the device could change between stat() call and open(), resulting
in us opening the new device. Change to open() first, then fstat() on the fd.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
tools/libevdev-tweak-device.c:390: uninit_use_in_call: Using uninitialized
value "changes" when calling "parse_options_abs".
tools/libevdev-tweak-device.c:376: warning: 'led' may be used uninitialized in
this function
tools/libevdev-tweak-device.c:375: warning: 'axis' may be used uninitialized
in this function
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This is the caller's responsibility, for two reasons:
* we don't know if O_NONBLOCK is set, so draining the fd isn't a simple matter
of read() until EAGAIN. A select() + read() could work around this of
course.
* for stateless information, keys and relative data, it is not a problem when
there are events waiting on the fd already, they are processed correctly,
albeit with a delay.
So punt this decision to the caller, they openend the fd, they know if they
care about delayed events, they can drain the fd before handing it to us.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Acked-by: David Herrmann <dh.herrmann@gmail.com>
This change will only affect certain touch screens, for which the driver
integration code does not provide meaningful values for the allowed range
of ABS_MT_TRACKING_IDs. The reported range [0, 0] will be overwritten with
[-1, 0xFFFF]
Signed-off-by: Andreas Pokorny <andreas.pokorny@canonical.com>
[Changed from INT_MAX to 0xFFFF to match the kernel, add device name to log
message]
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
We're starting to collect overrides for custom devices, making this easier for
users and saves us time. Once we measured everything, print out a
guesstimated udev rule and instructions on how to calculate the resolution.
Extra output now is:
Touchpad size as listed by the kernel: 132x111mm
Calculate resolution as:
x axis: 6076/<width in mm>
y axis: 5021/<height in mm>
Suggested udev rule:
# <Laptop model description goes here>
evdev:input:b0005v05ACp030E*
EVDEV_ABS_01=-2694:2862:<x resolution>
EVDEV_ABS_02=-20:121:<y resolution>
EVDEV_ABS_35=-2694:2862:<x resolution>
EVDEV_ABS_36=-20:121:<y resolution>
The ABS_MT_ axes are only printed if the device have them, if the device isn't
bluetooth/usb we print the dmi modalias instead.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
So far, 100% of the usages for tweak-tool was to set the x/y resolution of a
device. Make --resolution a shortcut for this.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Make the code base a bit more modular so it's easier to add new commands.
Main change here is: options are parsed twice now, first time for the mode
(abs/led) and the device path, then again for the mode-specific options.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
The returned errno from libevdev_input_create_from_device was returned
incorrectly because libevdev_uinput_destroy() would try to close the
unset value of ->fd, overwriting errno.
That was fixed in debe9b030c, this patch avoids
the ioctl/close calls if the fd isn't set.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Some devices scale the frequency based on the input and will provide
recordings with different frequencies each time. Recommend to measure multiple
times since we can only know what the highest frequency is.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>