Commit 940658e1 authored by Peter Hutterer's avatar Peter Hutterer

tablet: print what capability is missing when rejecting a device

Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent ed52002c
......@@ -155,6 +155,22 @@ and don't send the required events. But they should all work nonetheless. If
you have a tablet that does not work with libinput, please @ref
reporting_bugs "file a bug".
@section faq_tablet_capabilities My tablet doesn't work
If you see the message
<pre>
libinput bug: device does not meet tablet criteria. Ignoring this device.
</pre>
or the message
<pre>
missing tablet capabilities [...] Ignoring this device.
</pre>
your tablet device does not have the required capabilities to be treated as
a tablet. This is usually a problem with the device and the kernel driver.
See @ref tablet-capabilities for more details.
@section faq_hwdb_changes How to apply hwdb changes
Sometimes users are asked to test updates to the <a
......
......@@ -344,4 +344,31 @@ libinput uses the @ref libinput_device_group to decide on touch arbitration
and automatically discards touch events whenever a tool is in proximity.
The exact behavior is device-dependent.
@section tablet-capabilities Required tablet capabilities
To handle a tablet correctly, libinput requires a set of capabilities
on the device. When these capabilities are missing, libinput ignores the
device and prints an error to the log. This error messages reads
<pre>
missing tablet capabilities: xy pen btn-stylus resolution. Ignoring this device.
</pre>
or in older versions of libinput simply:
<pre>
libinput bug: device does not meet tablet criteria. Ignoring this device.
</pre>
When a tablet is rejected, it is usually possible to check the issue with
the `evemu-descibe` tool.
- **xy** indicates that the tablet is missing the `ABS_X` and/or `ABS_Y`
axis. This indicates that the device is mislabelled and the udev tag
`ID_INPUT_TABLET` is applied to a device that is not a tablet.
- **pen** or **btn-stylus** indicates that the tablet does not have the
`BTN_TOOL_PEN` or `BTN_STYLUS` bit set. libinput requires either or both
of them to be present. This usually indicates a bug in the kernel driver
or the HID descriptors of the device.
- **resolution** indicates that the device does not have a resolution set
for the x and y axes. This can be fixed with a hwdb entry, locate and read
the 60-evdev.hwdb file on your machine to address this.
*/
......@@ -1980,29 +1980,26 @@ static int
tablet_reject_device(struct evdev_device *device)
{
struct libevdev *evdev = device->evdev;
int rc = -1;
double w, h;
if (!libevdev_has_event_code(evdev, EV_ABS, ABS_X) ||
!libevdev_has_event_code(evdev, EV_ABS, ABS_Y))
goto out;
if (!libevdev_has_event_code(evdev, EV_KEY, BTN_TOOL_PEN) &&
!libevdev_has_event_code(evdev, EV_KEY, BTN_STYLUS))
goto out;
if (evdev_device_get_size(device, &w, &h) != 0)
goto out;
rc = 0;
out:
if (rc) {
evdev_log_bug_libinput(device,
"device does not meet tablet criteria. "
"Ignoring this device.\n");
}
return rc;
bool has_xy, has_pen, has_btn_stylus, has_size;
has_xy = libevdev_has_event_code(evdev, EV_ABS, ABS_X) &&
libevdev_has_event_code(evdev, EV_ABS, ABS_Y);
has_pen = libevdev_has_event_code(evdev, EV_KEY, BTN_TOOL_PEN);
has_btn_stylus = libevdev_has_event_code(evdev, EV_KEY, BTN_STYLUS);
has_size = evdev_device_get_size(device, &w, &h) == 0;
if (has_xy && (has_pen || has_btn_stylus) && has_size)
return 0;
evdev_log_bug_libinput(device,
"missing tablet capabilities:%s%s%s%s."
"Ignoring this device.\n",
has_xy ? "" : " xy",
has_pen ? "" : " pen",
has_btn_stylus ? "" : " btn-stylus",
has_size ? "" : " resolution");
return -1;
}
static int
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment