SHA256
1
0
forked from pool/libinput
libinput/libinput-fix-crasher.patch

72 lines
2.4 KiB
Diff

From 7b11fef3490277317f4a794beeadf206a48844f6 Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Fri, 24 Feb 2017 10:10:44 +1000
Subject: Fix a crash when requesting invalid mode group indices
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit c787ccf270f44007dbadce72c1516b819c2ca5ce)
diff --git a/src/evdev-tablet-pad-leds.c b/src/evdev-tablet-pad-leds.c
index 209ab73..89b3b9d 100644
--- a/src/evdev-tablet-pad-leds.c
+++ b/src/evdev-tablet-pad-leds.c
@@ -645,5 +645,9 @@ evdev_device_tablet_pad_get_mode_group(struct evdev_device *device,
if (!(device->seat_caps & EVDEV_DEVICE_TABLET_PAD))
return NULL;
+ if (index >=
+ (unsigned int)evdev_device_tablet_pad_get_num_mode_groups(device))
+ return NULL;
+
return pad_get_mode_group(pad, index);
}
--
cgit v0.10.2
From 3940ab7f40a39a045e888068d199871e6d669392 Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Fri, 24 Feb 2017 10:15:23 +1000
Subject: tools: add mode group info to libinput-list-devices
We don't cater for the special case of groups having a different number of
modes, there is no hardware right now that does that.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit 38c675c9599fabeb8c530ab74898524a71cacf75)
diff --git a/tools/libinput-list-devices.c b/tools/libinput-list-devices.c
index e202388..8fd25df 100644
--- a/tools/libinput-list-devices.c
+++ b/tools/libinput-list-devices.c
@@ -245,16 +245,23 @@ rotation_default(struct libinput_device *device)
static void
print_pad_info(struct libinput_device *device)
{
- int nbuttons, nrings, nstrips;
+ int nbuttons, nrings, nstrips, ngroups, nmodes;
+ struct libinput_tablet_pad_mode_group *group;
nbuttons = libinput_device_tablet_pad_get_num_buttons(device);
nrings = libinput_device_tablet_pad_get_num_rings(device);
nstrips = libinput_device_tablet_pad_get_num_strips(device);
+ ngroups = libinput_device_tablet_pad_get_num_mode_groups(device);
+
+ group = libinput_device_tablet_pad_get_mode_group(device, 0);
+ nmodes = libinput_tablet_pad_mode_group_get_num_modes(group);
printf("Pad:\n");
printf(" Rings: %d\n", nrings);
printf(" Strips: %d\n", nstrips);
printf(" Buttons: %d\n", nbuttons);
+ printf(" Mode groups: %d (%d modes)\n", ngroups, nmodes);
+
}
static void
--
cgit v0.10.2