From ab2dae47af58bca50d53ebfd2b5114973cf5ae1e Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 29 Sep 2017 11:17:50 +1000 Subject: [PATCH] hidpp20: require HIDPP_PAGE_COLOR_LED_EFFECTS for LEDs to work If HIDPP_PAGE_COLOR_LED_EFFECTS fails but the profile returns a nonzero LED count we crash later in hidpp20drv_read_led() because all the led info is null. Signed-off-by: Peter Hutterer --- src/driver-hidpp20.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/driver-hidpp20.c b/src/driver-hidpp20.c index 1dd7c79d..bc85ab1a 100644 --- a/src/driver-hidpp20.c +++ b/src/driver-hidpp20.c @@ -1016,7 +1016,9 @@ hidpp20drv_init_feature(struct ratbag_device *device, uint16_t feature) drv_data->num_profiles = drv_data->profiles->num_profiles; drv_data->num_resolutions = drv_data->profiles->num_modes; drv_data->num_buttons = drv_data->profiles->num_buttons; - drv_data->num_leds = drv_data->profiles->num_leds; + /* We ignore the profile's num_leds and require + * HIDPP_PAGE_COLOR_LED_EFFECTS to succeed instead + */ break; }