summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
Diffstat (limited to 'hw')
-rw-r--r--hw/usb/hid-logitech-hidpp20.c49
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) {