summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2014-03-31 12:50:40 +0200
committerPeter Wu <peter@lekensteyn.nl>2014-03-31 13:07:27 +0200
commit19e9d59b8d9c13ea75992058dd94387edb68a262 (patch)
tree803d259b6846335c1ac9d7f9608b2b8f46af8df4 /hw
parent8d61d8cd7379be99075e674894a89e144ef20b91 (diff)
downloadqemu-19e9d59b8d9c13ea75992058dd94387edb68a262.tar.gz
unifying: fix HID++ 2.0 GetFeatureId indexing
Diffstat (limited to 'hw')
-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;