Bug 105342 - Default resolution fallback for libinput missing / devices changing resolution
Summary: Default resolution fallback for libinput missing / devices changing resolution
Status: RESOLVED WONTFIX
Alias: None
Product: Wayland
Classification: Unclassified
Component: libinput (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Wayland bug list
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-03-05 09:27 UTC by Simon
Modified: 2018-03-06 03:58 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
evemu-describe for gfxtablet using motorola zoom tablet. (2.33 KB, text/plain)
2018-03-05 09:29 UTC, Simon
Details

Description Simon 2018-03-05 09:27:37 UTC
Hi I tried to use gfxtablet (https://github.com/rfc2822/GfxTablet) to use my android tablet as an input device, but libinput-1.9.4 says:

[ 39879.453] (II) config/udev: Adding input device Network Tablet (/dev/input/mouse3)
[ 39879.453] (**) Network Tablet: Applying InputClass "joystick-all"
[ 39879.453] (II) No input driver specified, ignoring this device.
[ 39879.453] (II) This device may have been added with another device file.
[ 39879.490] (II) config/udev: Adding input device Network Tablet (/dev/input/event17)
[ 39879.490] (**) Network Tablet: Applying InputClass "evdev tablet catchall"
[ 39879.490] (**) Network Tablet: Applying InputClass "libinput tablet catchall"
[ 39879.490] (**) Network Tablet: Applying InputClass "joystick-all"
[ 39879.490] (**) Network Tablet: Applying InputClass "libinput tablet catchall"
[ 39879.490] (II) Using input driver 'libinput' for 'Network Tablet'
[ 39879.490] (**) Network Tablet: always reports core events
[ 39879.490] (**) Option "Device" "/dev/input/event17"
[ 39879.490] (**) Option "_source" "server/udev"
[ 39879.490] (II) event17 - (II) Network Tablet: (II) is tagged by udev as: Tablet
[ 39879.490] (EE) event17 - (EE) Network Tablet: (EE) libinput bug: missing tablet capabilities: resolution.Ignoring this device.
[ 39879.490] (II) event17 - (II) Network Tablet: (II) device is a tablet
[ 39879.529] (II) event17 - failed to create input device '/dev/input/event17'.
[ 39879.529] (EE) libinput: Network Tablet: Failed to create a device for /dev/input/event17
[ 39879.529] (EE) PreInit returned 2 for "Network Tablet"
[ 39879.529] (II) UnloadModule: "libinput"
[ 41531.488] (II) Axis 0x1 value 1236 is outside expected range [1237, 4990]
See https://wayland.freedesktop.org/libinput/doc/1.9.4//absolute_coordinate_ranges.html for details

So libinput ignores the device because of missing resolution, but actually it should instead fall back to a default resolution.
Also this absolute coordinates out outside range confuses me, can't libinput handle devices with a bigger range?

touchpad-edge-detector gave me this results for my motorola zoom, but other android devices have of course other screen dimensions..
evdev:name:Network Tablet:dmi:bvnLENOVO:bvr83ET76WW(1.46):bd07/05/2013:svnLENOVO:pn4180CE9:pvrThinkPadT420:rvnLENOVO:rn4180CE9:rvrNotAvailable:cvnLENOVO:ct10:cvrNotAvailable:*
 EVDEV_ABS_00=12:65534:596
 EVDEV_ABS_01=0:65533:312

I think libinput should add devices anyway with a default resolution and provide a user interface to change resolutions on the fly, e.g. to change between different android devices.
Comment 1 Simon 2018-03-05 09:29:07 UTC
Created attachment 137790 [details]
evemu-describe for gfxtablet using motorola zoom tablet.
Comment 2 Peter Hutterer 2018-03-05 10:30:51 UTC
libinput makes a few promises in its API that make using libinput more useful. One of these is that some calls return the data in mm - and for that we need to know the resolution of the tablet. There is no good reason for a tablet to not have a resolution set. We have the 60-evdev.hwdb now for physical devices that lack it (or have wrong values set) and in the case of networked tablets like this  - just set it in the software that creates the tablet. This is a one-liner to set in gfxtablet but it's many lines of code, APIs set in stone, required configuration interfaces, etc. in libinput. Not a good trade-off, tbh.
There is no default resolution, some touchpads have 12 units/mm some tablets have hundreds of units/mm.

The 'outside expected range' is just a warning and indicates that the ranges are set up wrongly. For physical devices this would require a 60-evdev.hwdb fix, but in this case it's a uinput device and can just be fixed in code there.

> I think libinput should add devices anyway with a default resolution and 
> provide a user interface to change resolutions on the fly, e.g. to change 
> between different android devices.

config interfaces in libinput are difficult. libinput has no GUI, so it relies on the caller to implement any actual user-facing bits. which means implementing it in gnome, kde, enlightenment, xorg, ... unless there's a reasonable chance this will happen, there's little point in putting it in libinput. And quite frankly, libinput right now is not set up to deal with changing resolution on the fly so the best you could do would be to have it as static configuration on startup. But this is all moot because the other side of the device is a uinput device and there's really no excuse for sending garbage data here.

sorry, definitely a wontfix on the libinput side, this needs to be addressed in gfxtablet.
Comment 3 Simon 2018-03-05 10:42:07 UTC
I looked into the gfxtablet code and it is using "struct uinput_user_dev" to set the devices properties, but struct uinput_user_dev does not have a resolution setting.. https://github.com/torvalds/linux/blob/master/include/uapi/linux/uinput.h#L223
So I suppose every device using old uinput interface will have problems using libinput then if libinput expects a resolution.. :-/
Comment 4 Peter Hutterer 2018-03-06 03:58:57 UTC
using libevdev instead of straight uinput ioctls would've helped with that in gfxtablet, it handles that case transparently (albeit with a potential race condition in old clients). and yes, libinput will not work with those tablets. 

We have, over the last years, added infrastructure to fix those tablets in userspace where the kernel drivers or firmware cannot be fixed. But we're not talking about physical hardware here that got released once and now has to work. This is a software package, expecting it to use an interface that's now 2 years old is not too much to ask (kernel 4.5 and later).


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.