mirror of
https://git.proxmox.com/git/fwupd
synced 2025-07-16 08:30:32 +00:00
Allow devices to opt-in to metadata-provided vendor strings
This commit is contained in:
parent
72af1b42b4
commit
8e6a3f6bbb
@ -233,6 +233,8 @@ fu_device_internal_flag_to_string(FuDeviceInternalFlags flag)
|
||||
return "use-proxy-fallback";
|
||||
if (flag == FU_DEVICE_INTERNAL_FLAG_NO_AUTO_REMOVE)
|
||||
return "no-auto-remove";
|
||||
if (flag == FU_DEVICE_INTERNAL_FLAG_MD_SET_VENDOR)
|
||||
return "md-set-vendor";
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -289,6 +291,8 @@ fu_device_internal_flag_from_string(const gchar *flag)
|
||||
return FU_DEVICE_INTERNAL_FLAG_USE_PROXY_FALLBACK;
|
||||
if (g_strcmp0(flag, "no-auto-remove") == 0)
|
||||
return FU_DEVICE_INTERNAL_FLAG_NO_AUTO_REMOVE;
|
||||
if (g_strcmp0(flag, "md-set-vendor") == 0)
|
||||
return FU_DEVICE_INTERNAL_FLAG_MD_SET_VENDOR;
|
||||
return FU_DEVICE_INTERNAL_FLAG_UNKNOWN;
|
||||
}
|
||||
|
||||
|
@ -409,6 +409,15 @@ typedef guint64 FuDeviceInternalFlags;
|
||||
*/
|
||||
#define FU_DEVICE_INTERNAL_FLAG_NO_AUTO_REMOVE (1llu << 19)
|
||||
|
||||
/**
|
||||
* FU_DEVICE_INTERNAL_FLAG_MD_SET_VENDOR:
|
||||
*
|
||||
* Set the device vendor from the metadata `developer_name` if available.
|
||||
*
|
||||
* Since: 1.7.4
|
||||
*/
|
||||
#define FU_DEVICE_INTERNAL_FLAG_MD_SET_VENDOR (1ull << 20)
|
||||
|
||||
/* accessors */
|
||||
gchar *
|
||||
fu_device_to_string(FuDevice *self);
|
||||
|
@ -804,6 +804,7 @@ fu_redfish_device_init(FuRedfishDevice *self)
|
||||
fu_device_add_internal_flag(FU_DEVICE(self), FU_DEVICE_INTERNAL_FLAG_MD_SET_NAME);
|
||||
fu_device_add_internal_flag(FU_DEVICE(self), FU_DEVICE_INTERNAL_FLAG_MD_SET_VERFMT);
|
||||
fu_device_add_internal_flag(FU_DEVICE(self), FU_DEVICE_INTERNAL_FLAG_MD_SET_ICON);
|
||||
fu_device_add_internal_flag(FU_DEVICE(self), FU_DEVICE_INTERNAL_FLAG_MD_SET_VENDOR);
|
||||
fu_device_register_private_flag(FU_DEVICE(self),
|
||||
FU_REDFISH_DEVICE_FLAG_IS_BACKUP,
|
||||
"is-backup");
|
||||
|
@ -643,6 +643,7 @@ fu_uefi_device_probe(FuDevice *device, GError **error)
|
||||
fu_device_add_flag(device, FWUPD_DEVICE_FLAG_REQUIRE_AC);
|
||||
fu_device_add_internal_flag(device, FU_DEVICE_INTERNAL_FLAG_MD_SET_VERFMT);
|
||||
fu_device_add_internal_flag(device, FU_DEVICE_INTERNAL_FLAG_MD_SET_ICON);
|
||||
fu_device_add_internal_flag(device, FU_DEVICE_INTERNAL_FLAG_MD_SET_VENDOR);
|
||||
|
||||
/* add icons */
|
||||
if (priv->kind == FU_UEFI_DEVICE_KIND_DEVICE_FIRMWARE) {
|
||||
|
@ -3594,6 +3594,23 @@ fu_engine_md_refresh_device_name(FuEngine *self, FuDevice *device, XbNode *compo
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
fu_engine_md_refresh_device_vendor(FuEngine *self, FuDevice *device, XbNode *component)
|
||||
{
|
||||
const gchar *vendor = NULL;
|
||||
|
||||
/* require data */
|
||||
if (component == NULL)
|
||||
return;
|
||||
|
||||
/* copy 1:1 */
|
||||
vendor = xb_node_query_text(component, "developer_name", NULL);
|
||||
if (vendor != NULL) {
|
||||
fu_device_set_vendor(device, vendor);
|
||||
fu_device_remove_internal_flag(device, FU_DEVICE_INTERNAL_FLAG_MD_SET_VENDOR);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
fu_engine_md_refresh_device_icon(FuEngine *self, FuDevice *device, XbNode *component)
|
||||
{
|
||||
@ -3743,6 +3760,8 @@ fu_engine_md_refresh_device_from_component(FuEngine *self, FuDevice *device, XbN
|
||||
fu_engine_md_refresh_device_name_category(self, device, component);
|
||||
if (fu_device_has_internal_flag(device, FU_DEVICE_INTERNAL_FLAG_MD_SET_ICON))
|
||||
fu_engine_md_refresh_device_icon(self, device, component);
|
||||
if (fu_device_has_internal_flag(device, FU_DEVICE_INTERNAL_FLAG_MD_SET_VENDOR))
|
||||
fu_engine_md_refresh_device_vendor(self, device, component);
|
||||
|
||||
/* fix the version */
|
||||
if (fu_device_has_internal_flag(device, FU_DEVICE_INTERNAL_FLAG_MD_SET_VERFMT))
|
||||
|
Loading…
Reference in New Issue
Block a user