pad: load libwacom device by path, not by usbid

to avoid conflicts with vendors reusing vid:pid try to find first by path

Signed-off-by: Alberto Fanjul <albertofanjul@gmail.com>
This commit is contained in:
Alberto Fanjul 2022-02-05 09:08:35 +01:00
parent 8e41089584
commit 748280f9de

View file

@ -556,15 +556,27 @@ pad_init_buttons_from_libwacom(struct pad_dispatch *pad,
WacomDevice *tablet = NULL;
int num_buttons;
int map = 0;
char event_path[64];
db = libinput_libwacom_ref(li);
if (!db)
goto out;
tablet = libwacom_new_from_usbid(db,
evdev_device_get_id_vendor(device),
evdev_device_get_id_product(device),
NULL);
snprintf(event_path,
sizeof(event_path),
"/dev/input/%s",
evdev_device_get_sysname(device));
tablet = libwacom_new_from_path(db,
event_path,
WFALLBACK_NONE,
NULL);
if (!tablet) {
tablet = libwacom_new_from_usbid(db,
evdev_device_get_id_vendor(device),
evdev_device_get_id_product(device),
NULL);
}
if (!tablet)
goto out;