mirror of
https://git.proxmox.com/git/fwupd
synced 2025-05-29 20:32:50 +00:00
redfish: Identify hardware that needs to be updated to the same version
For instance, the EFI driver for a given network card cannot be different for identical hardware.
This commit is contained in:
parent
a8206b2bf6
commit
25c93aa7ca
@ -193,6 +193,8 @@ fwupd_device_flag_to_string (FwupdDeviceFlags device_flag)
|
|||||||
return "has-multiple-branches";
|
return "has-multiple-branches";
|
||||||
if (device_flag == FWUPD_DEVICE_FLAG_BACKUP_BEFORE_INSTALL)
|
if (device_flag == FWUPD_DEVICE_FLAG_BACKUP_BEFORE_INSTALL)
|
||||||
return "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)
|
if (device_flag == FWUPD_DEVICE_FLAG_UNKNOWN)
|
||||||
return "unknown";
|
return "unknown";
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -297,6 +299,8 @@ fwupd_device_flag_from_string (const gchar *device_flag)
|
|||||||
return FWUPD_DEVICE_FLAG_HAS_MULTIPLE_BRANCHES;
|
return FWUPD_DEVICE_FLAG_HAS_MULTIPLE_BRANCHES;
|
||||||
if (g_strcmp0 (device_flag, "backup-before-install") == 0)
|
if (g_strcmp0 (device_flag, "backup-before-install") == 0)
|
||||||
return FWUPD_DEVICE_FLAG_BACKUP_BEFORE_INSTALL;
|
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;
|
return FWUPD_DEVICE_FLAG_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -449,6 +449,18 @@ typedef enum {
|
|||||||
* Deprecated 1.5.5
|
* Deprecated 1.5.5
|
||||||
*/
|
*/
|
||||||
#define FWUPD_DEVICE_FLAG_MD_SET_ICON (1llu << 41)
|
#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:
|
* FWUPD_DEVICE_FLAG_UNKNOWN:
|
||||||
*
|
*
|
||||||
|
@ -187,6 +187,28 @@ fu_redfish_backend_coldplug_inventory (FuRedfishBackend *self,
|
|||||||
return fu_redfish_backend_coldplug_collection (self, json_obj, error);
|
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
|
static gboolean
|
||||||
fu_redfish_backend_coldplug (FuBackend *backend, GError **error)
|
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");
|
JsonObject *tmp = json_object_get_object_member (json_obj, "SoftwareInventory");
|
||||||
return fu_redfish_backend_coldplug_inventory (self, tmp, error);
|
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;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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 */
|
/* TRANSLATORS: save the old firmware to disk before installing the new one */
|
||||||
return _("Device will backup firmware before installing");
|
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) {
|
if (device_flag == FWUPD_DEVICE_FLAG_SKIPS_RESTART) {
|
||||||
/* skip */
|
/* skip */
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user