summaryrefslogtreecommitdiff
path: root/hw/usb/hid-logitech-hidpp20.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/usb/hid-logitech-hidpp20.c')
-rw-r--r--hw/usb/hid-logitech-hidpp20.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/hw/usb/hid-logitech-hidpp20.c b/hw/usb/hid-logitech-hidpp20.c
index a3a50e6cd3..b616989379 100644
--- a/hw/usb/hid-logitech-hidpp20.c
+++ b/hw/usb/hid-logitech-hidpp20.c
@@ -88,10 +88,14 @@ static HIDPP20_FEATURE(feat_featureset)
if (params[0] > hd->info.features_count) {
return -HIDPP20_ERR_CODE_OUTOFRANGE;
}
- feat = &hd->info.features[params[0]];
- params[0] = feat->id >> 8;
- params[1] = (uint8_t) feat->id;
- params[2] = feat->type;
+ if (params[0] == 0) {
+ memset(params, 0, 3);
+ } else {
+ feat = &hd->info.features[params[0] - 1];
+ params[0] = feat->id >> 8;
+ params[1] = (uint8_t) feat->id;
+ params[2] = feat->type;
+ }
return 3;
default:
return -HIDPP20_ERR_CODE_INVALID_FUNCTION_ID;