summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2014-04-01 19:29:38 +0200
committerPeter Wu <peter@lekensteyn.nl>2014-04-01 19:29:38 +0200
commite245f00367c79bd1cd24e31b2a8a1efdb7192f04 (patch)
tree48ff72a826b7afdf4a9e343cfbf9fd55dee7aeb3 /hw
parente23b0ffa3af705c7d9c3cc5f8559892c7392b5d1 (diff)
downloadqemu-e245f00367c79bd1cd24e31b2a8a1efdb7192f04.tar.gz
unifying: implement FeatureInfo (guessed).
It seems to be used to mark the features which got replaced by this feature? Signed-off-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'hw')
-rw-r--r--hw/usb/hid-logitech-hidpp20.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/hw/usb/hid-logitech-hidpp20.c b/hw/usb/hid-logitech-hidpp20.c
index 9795830628..c69f6fd9c0 100644
--- a/hw/usb/hid-logitech-hidpp20.c
+++ b/hw/usb/hid-logitech-hidpp20.c
@@ -238,8 +238,32 @@ static HIDPP20_FEATURE(feat_batterystatus)
static HIDPP20_FEATURE(feat_featureinfo)
{
- return -HIDPP20_ERR_CODE_UNSUPPORTED; /* TODO: figure out */
+ uint32_t feature_id;
+ const HidppFeature *feat = NULL;
+ int i;
+
switch (fn) {
+ case 0x00: /* ?? Checks whether a feature replaces another? */
+ feature_id = (params[0] << 8) | params[1];
+ params[0] = params[1] = 0;
+
+ if (feature_id != 0x0000) {
+ for (i = 0; i < hd->info.features_count; i++) {
+ feat = &hd->info.features[i];
+ if (feat->id == feature_id) {
+ break;
+ }
+ feat = NULL;
+ }
+
+ if (feat == NULL) {
+ return -HIDPP20_ERR_CODE_INVALIDARGUMENT;
+ }
+ /* The feature_id and return value seem to be related (though it is
+ * not treate specially here): 2101 -> 2100, 6110 -> 6000,
+ * 1b03 -> 1b00, 6100 -> 6000, 1b01 -> 1b00, 18e5 -> 1800 */
+ }
+ return 2;
default:
return -HIDPP20_ERR_CODE_INVALID_FUNCTION_ID;
}