mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-15 13:59:15 +00:00
trivial: Add a device flag specifying it is emulated
This commit is contained in:
parent
3824af4756
commit
296fe5fb46
@ -209,6 +209,8 @@ fwupd_device_flag_to_string(FwupdDeviceFlags device_flag)
|
||||
return "signed-payload";
|
||||
if (device_flag == FWUPD_DEVICE_FLAG_UNSIGNED_PAYLOAD)
|
||||
return "unsigned-payload";
|
||||
if (device_flag == FWUPD_DEVICE_FLAG_EMULATED)
|
||||
return "emulated";
|
||||
if (device_flag == FWUPD_DEVICE_FLAG_UNKNOWN)
|
||||
return "unknown";
|
||||
return NULL;
|
||||
@ -328,6 +330,8 @@ fwupd_device_flag_from_string(const gchar *device_flag)
|
||||
return FWUPD_DEVICE_FLAG_SIGNED_PAYLOAD;
|
||||
if (g_strcmp0(device_flag, "unsigned-payload") == 0)
|
||||
return FWUPD_DEVICE_FLAG_UNSIGNED_PAYLOAD;
|
||||
if (g_strcmp0(device_flag, "emulated") == 0)
|
||||
return FWUPD_DEVICE_FLAG_EMULATED;
|
||||
return FWUPD_DEVICE_FLAG_UNKNOWN;
|
||||
}
|
||||
|
||||
|
@ -527,6 +527,14 @@ typedef enum {
|
||||
* Since: 1.7.6
|
||||
*/
|
||||
#define FWUPD_DEVICE_FLAG_UNSIGNED_PAYLOAD (1llu << 48)
|
||||
/**
|
||||
* FWUPD_DEVICE_FLAG_EMULATED:
|
||||
*
|
||||
* The device is emulated and should not be recorded by the backend.
|
||||
*
|
||||
* Since: 1.8.11
|
||||
*/
|
||||
#define FWUPD_DEVICE_FLAG_EMULATED (1llu << 49)
|
||||
/**
|
||||
* FWUPD_DEVICE_FLAG_UNKNOWN:
|
||||
*
|
||||
|
@ -695,6 +695,12 @@ fu_usb_device_set_dev(FuUsbDevice *device, GUsbDevice *usb_device)
|
||||
}
|
||||
|
||||
#ifdef HAVE_GUSB
|
||||
#if G_USB_CHECK_VERSION(0, 4, 4)
|
||||
/* propagate emulated flag */
|
||||
if (usb_device != NULL && g_usb_device_is_emulated(usb_device))
|
||||
fu_device_add_flag(FU_DEVICE(device), FWUPD_DEVICE_FLAG_EMULATED);
|
||||
#endif
|
||||
|
||||
/* set device ID automatically */
|
||||
fu_device_set_physical_id(FU_DEVICE(device), g_usb_device_get_platform_id(usb_device));
|
||||
#endif
|
||||
|
@ -1312,6 +1312,10 @@ fu_util_device_flag_to_string(guint64 device_flag)
|
||||
/* TRANSLATORS: firmware payload is unsigned and it is possible to modify it */
|
||||
return _("Unsigned Payload");
|
||||
}
|
||||
if (device_flag == FWUPD_DEVICE_FLAG_EMULATED) {
|
||||
/* TRANSLATORS: this device is not actually real */
|
||||
return _("Emulated");
|
||||
}
|
||||
if (device_flag == FWUPD_DEVICE_FLAG_SKIPS_RESTART) {
|
||||
/* skip */
|
||||
return NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user