From 3456238f0a4c707b14f7d08763566a9300ea3d39 Mon Sep 17 00:00:00 2001 From: Gary Lin Date: Wed, 25 Jul 2018 17:49:46 +0800 Subject: [PATCH] redfish: Detect the HPE DeviceClass DeviceClass in Oem/Hpe indicates the type of device in the HPE machine. In case SoftwareId is absent, we can use DeviceClass instead. Signed-off-by: Gary Lin --- plugins/redfish/fu-redfish-client.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/plugins/redfish/fu-redfish-client.c b/plugins/redfish/fu-redfish-client.c index 7a9ca5128..69d36526a 100644 --- a/plugins/redfish/fu-redfish-client.c +++ b/plugins/redfish/fu-redfish-client.c @@ -89,8 +89,17 @@ fu_redfish_client_coldplug_member (FuRedfishClient *self, if (json_object_get_boolean_member (member, "Updateable")) fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_UPDATABLE); } - if (json_object_has_member (member, "SoftwareId")) + if (json_object_has_member (member, "SoftwareId")) { fu_device_add_guid (dev, json_object_get_string_member (member, "SoftwareId")); + } else if (json_object_has_member (member, "Oem")) { + JsonObject *oem = json_object_get_object_member (member, "Oem"); + if (json_object_has_member (oem, "Hpe")) { + JsonObject *hpe = json_object_get_object_member (oem, "Hpe"); + const gchar *dev_class = json_object_get_string_member (hpe, "DeviceClass"); + if (dev_class != NULL) + fu_device_add_guid (dev, dev_class); + } + } /* success */ g_ptr_array_add (self->devices, g_steal_pointer (&dev));