diff --git a/libfwupd/fwupd-enums.c b/libfwupd/fwupd-enums.c index ebc129b46..d4e660652 100644 --- a/libfwupd/fwupd-enums.c +++ b/libfwupd/fwupd-enums.c @@ -193,6 +193,8 @@ fwupd_device_flag_to_string (FwupdDeviceFlags device_flag) return "has-multiple-branches"; if (device_flag == FWUPD_DEVICE_FLAG_BACKUP_BEFORE_INSTALL) return "backup-before-install"; + if (device_flag == FWUPD_DEVICE_FLAG_WILDCARD_INSTALL) + return "wildcard-install"; if (device_flag == FWUPD_DEVICE_FLAG_UNKNOWN) return "unknown"; return NULL; @@ -297,6 +299,8 @@ fwupd_device_flag_from_string (const gchar *device_flag) return FWUPD_DEVICE_FLAG_HAS_MULTIPLE_BRANCHES; if (g_strcmp0 (device_flag, "backup-before-install") == 0) return FWUPD_DEVICE_FLAG_BACKUP_BEFORE_INSTALL; + if (g_strcmp0 (device_flag, "wildcard-install") == 0) + return FWUPD_DEVICE_FLAG_WILDCARD_INSTALL; return FWUPD_DEVICE_FLAG_UNKNOWN; } diff --git a/libfwupd/fwupd-enums.h b/libfwupd/fwupd-enums.h index 603e01623..ce6d1b925 100644 --- a/libfwupd/fwupd-enums.h +++ b/libfwupd/fwupd-enums.h @@ -449,6 +449,18 @@ typedef enum { * Deprecated 1.5.5 */ #define FWUPD_DEVICE_FLAG_MD_SET_ICON (1llu << 41) +/** + * FWUPD_DEVICE_FLAG_WILDCARD_INSTALL: + * + * All devices with matching GUIDs will be updated at the same time. + * + * For some devices it is not possible to have different versions of firmware + * for hardware of the same type. Updating one device will force update of + * others with exactly the same instance IDs. + * + * Since: 1.6.2 + */ +#define FWUPD_DEVICE_FLAG_WILDCARD_INSTALL (1llu << 42) /** * FWUPD_DEVICE_FLAG_UNKNOWN: * diff --git a/plugins/redfish/fu-redfish-backend.c b/plugins/redfish/fu-redfish-backend.c index e1a3dcfa1..59eb15b4b 100644 --- a/plugins/redfish/fu-redfish-backend.c +++ b/plugins/redfish/fu-redfish-backend.c @@ -187,6 +187,28 @@ fu_redfish_backend_coldplug_inventory (FuRedfishBackend *self, return fu_redfish_backend_coldplug_collection (self, json_obj, error); } +static void +fu_redfish_backend_check_wildcard_targets (FuRedfishBackend *self) +{ + g_autoptr(GPtrArray) devices = fu_backend_get_devices (FU_BACKEND (self)); + g_autoptr(GHashTable) device_by_id0 = g_hash_table_new (g_str_hash, g_str_equal); + + /* does the SoftwareId exist from a different device */ + for (guint i = 0; i < devices->len; i++) { + FuDevice *device_old; + FuDevice *device_tmp = g_ptr_array_index (devices, i); + GPtrArray *ids =fu_device_get_instance_ids (device_tmp); + const gchar *id0 = g_ptr_array_index (ids, 0); + device_old = g_hash_table_lookup (device_by_id0, id0); + if (device_old == NULL) { + g_hash_table_insert (device_by_id0, (gpointer) device_tmp, (gpointer) id0); + continue; + } + fu_device_add_flag (device_tmp, FWUPD_DEVICE_FLAG_WILDCARD_INSTALL); + fu_device_add_flag (device_old, FWUPD_DEVICE_FLAG_WILDCARD_INSTALL); + } +} + static gboolean fu_redfish_backend_coldplug (FuBackend *backend, GError **error) { @@ -253,6 +275,12 @@ fu_redfish_backend_coldplug (FuBackend *backend, GError **error) JsonObject *tmp = json_object_get_object_member (json_obj, "SoftwareInventory"); return fu_redfish_backend_coldplug_inventory (self, tmp, error); } + + /* work out if we have multiple devices with the same SoftwareId */ + if (self->wildcard_targets) + fu_redfish_backend_check_wildcard_targets (self); + + /* success */ return TRUE; } diff --git a/src/fu-util-common.c b/src/fu-util-common.c index cd720b24f..2098a7dca 100644 --- a/src/fu-util-common.c +++ b/src/fu-util-common.c @@ -1180,6 +1180,11 @@ fu_util_device_flag_to_string (guint64 device_flag) /* TRANSLATORS: save the old firmware to disk before installing the new one */ return _("Device will backup firmware before installing"); } + if (device_flag == FWUPD_DEVICE_FLAG_WILDCARD_INSTALL) { + /* TRANSLATORS: on some systems certain devices have to have matching versions, + * e.g. the EFI driver for a given network card cannot be different */ + return _("All devices of the same type will be updated at the same time"); + } if (device_flag == FWUPD_DEVICE_FLAG_SKIPS_RESTART) { /* skip */ return NULL;