backend/libinput: check bus type before setting tablet USB IDs

References: https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/977
This commit is contained in:
Simon Ser 2024-02-29 12:29:28 +01:00
parent edbf8bf2ce
commit 94dbb3cfb5
2 changed files with 10 additions and 2 deletions

View File

@ -31,3 +31,4 @@ wlr_deps += libinput
# libinput hold gestures and high resolution scroll are available since 1.19.0 # libinput hold gestures and high resolution scroll are available since 1.19.0
internal_config.set10('HAVE_LIBINPUT_HOLD_GESTURES', libinput.version().version_compare('>=1.19.0')) internal_config.set10('HAVE_LIBINPUT_HOLD_GESTURES', libinput.version().version_compare('>=1.19.0'))
internal_config.set10('HAVE_LIBINPUT_SCROLL_VALUE120', libinput.version().version_compare('>=1.19.0')) internal_config.set10('HAVE_LIBINPUT_SCROLL_VALUE120', libinput.version().version_compare('>=1.19.0'))
internal_config.set10('HAVE_LIBINPUT_BUSTYPE', libinput.version().version_compare('>=1.26.0'))

View File

@ -1,6 +1,7 @@
#include <string.h> #include <string.h>
#include <assert.h> #include <assert.h>
#include <libinput.h> #include <libinput.h>
#include <linux/input.h>
#include <stdlib.h> #include <stdlib.h>
#include <wlr/interfaces/wlr_tablet_tool.h> #include <wlr/interfaces/wlr_tablet_tool.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
@ -20,8 +21,14 @@ void init_device_tablet(struct wlr_libinput_input_device *dev) {
const char *name = get_libinput_device_name(dev->handle); const char *name = get_libinput_device_name(dev->handle);
struct wlr_tablet *wlr_tablet = &dev->tablet; struct wlr_tablet *wlr_tablet = &dev->tablet;
wlr_tablet_init(wlr_tablet, &libinput_tablet_impl, name); wlr_tablet_init(wlr_tablet, &libinput_tablet_impl, name);
#if HAVE_LIBINPUT_BUSTYPE
if (libinput_device_get_id_bustype(dev->handle) == BUS_USB)
#endif
{
wlr_tablet->usb_vendor_id = libinput_device_get_id_vendor(dev->handle); wlr_tablet->usb_vendor_id = libinput_device_get_id_vendor(dev->handle);
wlr_tablet->usb_product_id = libinput_device_get_id_product(dev->handle); wlr_tablet->usb_product_id = libinput_device_get_id_product(dev->handle);
}
libinput_device_get_size(dev->handle, &wlr_tablet->width_mm, libinput_device_get_size(dev->handle, &wlr_tablet->width_mm,
&wlr_tablet->height_mm); &wlr_tablet->height_mm);