diff options
author | Peter Wu <peter@lekensteyn.nl> | 2014-03-24 11:57:46 +0100 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2014-03-24 11:57:46 +0100 |
commit | 7249fb7b3ac3e05b604228314a48ad5703506c1d (patch) | |
tree | 72814886f6a9d2e3f2839632e3878a74a81e9d17 /hw | |
parent | 614a271a24d7809f56b83817d1e926a8f4897a7c (diff) | |
download | qemu-7249fb7b3ac3e05b604228314a48ad5703506c1d.tar.gz |
unifying: implement DeviceFwVersion
Based on information for M525 (entitycount == 0), and T650 (BL and HW).
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/usb/hid-logitech-hidpp20.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/hw/usb/hid-logitech-hidpp20.c b/hw/usb/hid-logitech-hidpp20.c index 9248f31bd1..eb15ab1c96 100644 --- a/hw/usb/hid-logitech-hidpp20.c +++ b/hw/usb/hid-logitech-hidpp20.c @@ -98,9 +98,58 @@ static HIDPP20_FEATURE(feat_featureset) } } +static HIDPP20_FEATURE(feat_devicefwversion) +{ + switch (fn) { + case 0: /* GetEntityCount */ + /* TODO: set supported version info in struct firmware_version */ + params[0] = 1; + return 1; + case 1: /* GetFwInfo(entity) */ + + params[8] = 0; /* placeholder? */ + /* transport-layer specific info (Wireless PID for Unifying) */ + params[9] = hd->info.wireless_pid >> 8; + params[10] = (uint8_t) hd->info.wireless_pid; + + /* There is no 1-to-1 mapping for entity number to FwType, but for + * simplicity just do it. */ + switch (params[0]) { + case 0: /* FwType: Main application */ + memcpy(params + 1, "RQM", 3); /* 1:3 FwPrefix */ + /* 4:5 BCD version number */ + params[4] = hd->info.version.fw_major; + params[5] = hd->info.version.fw_minor; + /* 6:7 FW build number */ + params[5] = hd->info.version.fw_build >> 8; + params[6] = (uint8_t) hd->info.version.fw_build; + return 11; + case 1: /* FwType: Bootloader */ + memcpy(params + 1, "BL ", 3); /* 1:3 FwPrefix */ + /* 4:5 BCD version number */ + params[4] = hd->info.version.bl_major; + params[5] = hd->info.version.bl_minor; + params[5] = params[6] = 0; /* 6:7 FW build number */ + return 11; + case 2: /* FwType: Hardware */ + memcpy(params + 1, "SYN", 3); /* 1:3 FwPrefix */ + /* 4:5 BCD version number */ + params[4] = 5; + params[5] = 0; + params[5] = params[6] = 0; /* 6:7 FW build number */ + return 11; + default: + return -HIDPP20_ERR_CODE_OUTOFRANGE; + } + default: + return -HIDPP20_ERR_CODE_INVALID_FUNCTION_ID; + } +} + /* root feature not included! */ static const HidppFeature features_m525[] = { { 0x0001, 0, feat_featureset }, + { 0x0003, 0, feat_devicefwversion }, }; void hidpp20_init_features(LHidDevice *hd) { |