hidpp20: make sure getZoneEffect (8070) is supported

Signed-off-by: Filipe Laíns <lains@archlinux.org>
This commit is contained in:
Filipe Laíns
2020-01-28 15:10:17 +00:00
committed by Benjamin Tissoires
parent afb85f868c
commit 0012853a1d
2 changed files with 8 additions and 0 deletions

View File

@@ -895,6 +895,7 @@ hidpp20_color_led_effects_get_info(struct hidpp20_device *device,
return rc;
*info = *(struct hidpp20_color_led_info *)msg.msg.parameters;
device->led_ext_caps = info->ext_caps;
return 0;
}
@@ -1061,6 +1062,10 @@ hidpp20_color_led_effects_get_zone_effect(struct hidpp20_device *device,
struct hidpp20_internal_led *internal_led;
int rc;
/* hidpp20_color_led_effects_get_info() must be called first to set the capabilities */
if (!(device->led_ext_caps & HIDPP20_COLOR_LED_INFO_EXT_CAP_HAS_ZONE_EFFECT))
return -ENOTSUP;
feature_index = hidpp_root_get_feature_idx(device,
HIDPP_PAGE_COLOR_LED_EFFECTS);
if (feature_index == 0)
@@ -3022,6 +3027,8 @@ hidpp20_device_new(const struct hidpp_device *base, unsigned int idx, struct hid
dev->proto_major = 1;
dev->proto_minor = 0;
dev->led_ext_caps = 0;
hidpp_get_supported_report_types(&(dev->base), reports, num_reports);
if (!(dev->base.supported_report_types & HIDPP_REPORT_SHORT) &&

View File

@@ -65,6 +65,7 @@ struct hidpp20_device {
unsigned feature_count;
struct hidpp20_feature *feature_list;
enum hidpp20_quirk quirk;
unsigned int led_ext_caps;
};
int hidpp20_request_command(struct hidpp20_device *dev, union hidpp20_message *msg);