From 94dbb3cfb5293e58580083cd26f059669030956d Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 29 Feb 2024 12:29:28 +0100 Subject: [PATCH] backend/libinput: check bus type before setting tablet USB IDs References: https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/977 --- backend/libinput/meson.build | 1 + backend/libinput/tablet_tool.c | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/backend/libinput/meson.build b/backend/libinput/meson.build index f4592891..0dfac5dd 100644 --- a/backend/libinput/meson.build +++ b/backend/libinput/meson.build @@ -31,3 +31,4 @@ wlr_deps += libinput # 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_SCROLL_VALUE120', libinput.version().version_compare('>=1.19.0')) +internal_config.set10('HAVE_LIBINPUT_BUSTYPE', libinput.version().version_compare('>=1.26.0')) diff --git a/backend/libinput/tablet_tool.c b/backend/libinput/tablet_tool.c index af50ba9f..cc9e6096 100644 --- a/backend/libinput/tablet_tool.c +++ b/backend/libinput/tablet_tool.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -20,8 +21,14 @@ void init_device_tablet(struct wlr_libinput_input_device *dev) { const char *name = get_libinput_device_name(dev->handle); struct wlr_tablet *wlr_tablet = &dev->tablet; wlr_tablet_init(wlr_tablet, &libinput_tablet_impl, name); - wlr_tablet->usb_vendor_id = libinput_device_get_id_vendor(dev->handle); - wlr_tablet->usb_product_id = libinput_device_get_id_product(dev->handle); + +#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_product_id = libinput_device_get_id_product(dev->handle); + } libinput_device_get_size(dev->handle, &wlr_tablet->width_mm, &wlr_tablet->height_mm);