mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-15 06:33:49 +00:00
Only auto-add counterpart GUIDs when required
Doing this unconditionally means we accidentally 'bleed' one device mode into another in a non-obvious way. For instance, a device might have two operating modes with different GUIDs. If firmware is supplied for both modes in the same cabinet archive then we might accidentally match the 'wrong' firmware when the daemon has observed a mode switch and added the counterpart GUIDs. We only really need the counterpart GUIDs when switching between Jabra, 8bitdo and DFU devices where the DFU bootloader VID:PID is not manually tagged with `CounterpartGuid` in a quirk file. In the general case lets keep it simple to avoid difficult to find bugs.
This commit is contained in:
parent
372565aef8
commit
cddf5b5b89
@ -189,6 +189,8 @@ fwupd_device_flag_to_string (FwupdDeviceFlags device_flag)
|
|||||||
return "md-set-name-category";
|
return "md-set-name-category";
|
||||||
if (device_flag == FWUPD_DEVICE_FLAG_MD_SET_VERFMT)
|
if (device_flag == FWUPD_DEVICE_FLAG_MD_SET_VERFMT)
|
||||||
return "md-set-verfmt";
|
return "md-set-verfmt";
|
||||||
|
if (device_flag == FWUPD_DEVICE_FLAG_ADD_COUNTERPART_GUIDS)
|
||||||
|
return "add-counterpart-guids";
|
||||||
if (device_flag == FWUPD_DEVICE_FLAG_UNKNOWN)
|
if (device_flag == FWUPD_DEVICE_FLAG_UNKNOWN)
|
||||||
return "unknown";
|
return "unknown";
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -279,6 +281,8 @@ fwupd_device_flag_from_string (const gchar *device_flag)
|
|||||||
return FWUPD_DEVICE_FLAG_MD_SET_NAME_CATEGORY;
|
return FWUPD_DEVICE_FLAG_MD_SET_NAME_CATEGORY;
|
||||||
if (g_strcmp0 (device_flag, "md-set-verfmt") == 0)
|
if (g_strcmp0 (device_flag, "md-set-verfmt") == 0)
|
||||||
return FWUPD_DEVICE_FLAG_MD_SET_VERFMT;
|
return FWUPD_DEVICE_FLAG_MD_SET_VERFMT;
|
||||||
|
if (g_strcmp0 (device_flag, "add-counterpart-guids") == 0)
|
||||||
|
return FWUPD_DEVICE_FLAG_ADD_COUNTERPART_GUIDS;
|
||||||
return FWUPD_DEVICE_FLAG_UNKNOWN;
|
return FWUPD_DEVICE_FLAG_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,6 +102,7 @@ typedef enum {
|
|||||||
* @FWUPD_DEVICE_FLAG_MD_SET_NAME: Set the device name from the metadata <name> if available
|
* @FWUPD_DEVICE_FLAG_MD_SET_NAME: Set the device name from the metadata <name> if available
|
||||||
* @FWUPD_DEVICE_FLAG_MD_SET_NAME_CATEGORY: Set the device name from the metadata <category> if available
|
* @FWUPD_DEVICE_FLAG_MD_SET_NAME_CATEGORY: Set the device name from the metadata <category> if available
|
||||||
* @FWUPD_DEVICE_FLAG_MD_SET_VERFMT: Set the device version format from the metadata if available
|
* @FWUPD_DEVICE_FLAG_MD_SET_VERFMT: Set the device version format from the metadata if available
|
||||||
|
* @FWUPD_DEVICE_FLAG_ADD_COUNTERPART_GUIDS: Add counterpart GUIDs from an alternate mode like bootloader
|
||||||
*
|
*
|
||||||
* The device flags.
|
* The device flags.
|
||||||
**/
|
**/
|
||||||
@ -141,6 +142,7 @@ typedef enum {
|
|||||||
#define FWUPD_DEVICE_FLAG_MD_SET_NAME (1llu << 32) /* Since: 1.4.0 */
|
#define FWUPD_DEVICE_FLAG_MD_SET_NAME (1llu << 32) /* Since: 1.4.0 */
|
||||||
#define FWUPD_DEVICE_FLAG_MD_SET_NAME_CATEGORY (1llu << 33) /* Since: 1.4.0 */
|
#define FWUPD_DEVICE_FLAG_MD_SET_NAME_CATEGORY (1llu << 33) /* Since: 1.4.0 */
|
||||||
#define FWUPD_DEVICE_FLAG_MD_SET_VERFMT (1llu << 34) /* Since: 1.4.0 */
|
#define FWUPD_DEVICE_FLAG_MD_SET_VERFMT (1llu << 34) /* Since: 1.4.0 */
|
||||||
|
#define FWUPD_DEVICE_FLAG_ADD_COUNTERPART_GUIDS (1llu << 35) /* Since: 1.4.0 */
|
||||||
#define FWUPD_DEVICE_FLAG_UNKNOWN G_MAXUINT64 /* Since: 0.7.3 */
|
#define FWUPD_DEVICE_FLAG_UNKNOWN G_MAXUINT64 /* Since: 0.7.3 */
|
||||||
typedef guint64 FwupdDeviceFlags;
|
typedef guint64 FwupdDeviceFlags;
|
||||||
|
|
||||||
|
@ -459,6 +459,7 @@ fu_colorhug_device_init (FuColorhugDevice *self)
|
|||||||
fu_device_set_version_format (FU_DEVICE (self), FWUPD_VERSION_FORMAT_TRIPLET);
|
fu_device_set_version_format (FU_DEVICE (self), FWUPD_VERSION_FORMAT_TRIPLET);
|
||||||
fu_device_set_remove_delay (FU_DEVICE (self),
|
fu_device_set_remove_delay (FU_DEVICE (self),
|
||||||
FU_DEVICE_REMOVE_DELAY_RE_ENUMERATE);
|
FU_DEVICE_REMOVE_DELAY_RE_ENUMERATE);
|
||||||
|
fu_device_add_flag (FU_DEVICE (self), FWUPD_DEVICE_FLAG_ADD_COUNTERPART_GUIDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1837,5 +1837,6 @@ dfu_device_init (DfuDevice *device)
|
|||||||
priv->transfer_size = 64;
|
priv->transfer_size = 64;
|
||||||
fu_device_add_icon (FU_DEVICE (device), "drive-harddisk-usb");
|
fu_device_add_icon (FU_DEVICE (device), "drive-harddisk-usb");
|
||||||
fu_device_add_flag (FU_DEVICE (device), FWUPD_DEVICE_FLAG_UPDATABLE);
|
fu_device_add_flag (FU_DEVICE (device), FWUPD_DEVICE_FLAG_UPDATABLE);
|
||||||
|
fu_device_add_flag (FU_DEVICE (device), FWUPD_DEVICE_FLAG_ADD_COUNTERPART_GUIDS);
|
||||||
fu_device_set_remove_delay (FU_DEVICE (device), FU_DEVICE_REMOVE_DELAY_RE_ENUMERATE);
|
fu_device_set_remove_delay (FU_DEVICE (device), FU_DEVICE_REMOVE_DELAY_RE_ENUMERATE);
|
||||||
}
|
}
|
||||||
|
@ -581,6 +581,7 @@ static void
|
|||||||
fu_ebitdo_device_init (FuEbitdoDevice *self)
|
fu_ebitdo_device_init (FuEbitdoDevice *self)
|
||||||
{
|
{
|
||||||
fu_device_set_protocol (FU_DEVICE (self), "com.8bitdo");
|
fu_device_set_protocol (FU_DEVICE (self), "com.8bitdo");
|
||||||
|
fu_device_add_flag (FU_DEVICE (self), FWUPD_DEVICE_FLAG_ADD_COUNTERPART_GUIDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -699,6 +699,7 @@ fu_fastboot_device_init (FuFastbootDevice *self)
|
|||||||
fu_device_set_protocol (FU_DEVICE (self), "com.google.fastboot");
|
fu_device_set_protocol (FU_DEVICE (self), "com.google.fastboot");
|
||||||
fu_device_add_flag (FU_DEVICE (self), FWUPD_DEVICE_FLAG_UPDATABLE);
|
fu_device_add_flag (FU_DEVICE (self), FWUPD_DEVICE_FLAG_UPDATABLE);
|
||||||
fu_device_add_flag (FU_DEVICE (self), FWUPD_DEVICE_FLAG_IS_BOOTLOADER);
|
fu_device_add_flag (FU_DEVICE (self), FWUPD_DEVICE_FLAG_IS_BOOTLOADER);
|
||||||
|
fu_device_add_flag (FU_DEVICE (self), FWUPD_DEVICE_FLAG_ADD_COUNTERPART_GUIDS);
|
||||||
fu_device_set_remove_delay (FU_DEVICE (self), FASTBOOT_REMOVE_DELAY_RE_ENUMERATE);
|
fu_device_set_remove_delay (FU_DEVICE (self), FASTBOOT_REMOVE_DELAY_RE_ENUMERATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,6 +142,7 @@ static void
|
|||||||
fu_jabra_device_init (FuJabraDevice *self)
|
fu_jabra_device_init (FuJabraDevice *self)
|
||||||
{
|
{
|
||||||
fu_device_add_flag (FU_DEVICE (self), FWUPD_DEVICE_FLAG_UPDATABLE);
|
fu_device_add_flag (FU_DEVICE (self), FWUPD_DEVICE_FLAG_UPDATABLE);
|
||||||
|
fu_device_add_flag (FU_DEVICE (self), FWUPD_DEVICE_FLAG_ADD_COUNTERPART_GUIDS);
|
||||||
fu_device_set_remove_delay (FU_DEVICE (self), 20000); /* 10+10s! */
|
fu_device_set_remove_delay (FU_DEVICE (self), 20000); /* 10+10s! */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,6 +134,7 @@ fu_nitrokey_device_init (FuNitrokeyDevice *device)
|
|||||||
{
|
{
|
||||||
fu_device_set_remove_delay (FU_DEVICE (device), FU_DEVICE_REMOVE_DELAY_RE_ENUMERATE);
|
fu_device_set_remove_delay (FU_DEVICE (device), FU_DEVICE_REMOVE_DELAY_RE_ENUMERATE);
|
||||||
fu_device_add_flag (FU_DEVICE (device), FWUPD_DEVICE_FLAG_UPDATABLE);
|
fu_device_add_flag (FU_DEVICE (device), FWUPD_DEVICE_FLAG_UPDATABLE);
|
||||||
|
fu_device_add_flag (FU_DEVICE (device), FWUPD_DEVICE_FLAG_ADD_COUNTERPART_GUIDS);
|
||||||
fu_device_set_version_format (FU_DEVICE (device), FWUPD_VERSION_FORMAT_PAIR);
|
fu_device_set_version_format (FU_DEVICE (device), FWUPD_VERSION_FORMAT_PAIR);
|
||||||
fu_device_retry_set_delay (FU_DEVICE (device), 100);
|
fu_device_retry_set_delay (FU_DEVICE (device), 100);
|
||||||
}
|
}
|
||||||
|
@ -674,6 +674,7 @@ fu_vli_device_init (FuVliDevice *self)
|
|||||||
priv->spi_cmds[FU_VLI_DEVICE_SPI_REQ_READ_ID] = 0x9f;
|
priv->spi_cmds[FU_VLI_DEVICE_SPI_REQ_READ_ID] = 0x9f;
|
||||||
priv->spi_cmd_read_id_sz = 2;
|
priv->spi_cmd_read_id_sz = 2;
|
||||||
priv->spi_auto_detect = TRUE;
|
priv->spi_auto_detect = TRUE;
|
||||||
|
fu_device_add_flag (FU_DEVICE (self), FWUPD_DEVICE_FLAG_ADD_COUNTERPART_GUIDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -470,8 +470,14 @@ fu_device_list_add_missing_guids (FuDevice *device_new, FuDevice *device_old)
|
|||||||
for (guint i = 0; i < guids_old->len; i++) {
|
for (guint i = 0; i < guids_old->len; i++) {
|
||||||
const gchar *guid_tmp = g_ptr_array_index (guids_old, i);
|
const gchar *guid_tmp = g_ptr_array_index (guids_old, i);
|
||||||
if (!fu_device_has_guid (device_new, guid_tmp)) {
|
if (!fu_device_has_guid (device_new, guid_tmp)) {
|
||||||
g_debug ("adding GUID %s to device", guid_tmp);
|
if (fu_device_has_flag (device_new, FWUPD_DEVICE_FLAG_ADD_COUNTERPART_GUIDS)) {
|
||||||
fu_device_add_counterpart_guid (device_new, guid_tmp);
|
g_debug ("adding GUID %s to device", guid_tmp);
|
||||||
|
fu_device_add_counterpart_guid (device_new, guid_tmp);
|
||||||
|
} else {
|
||||||
|
g_debug ("not adding GUID %s to device, use "
|
||||||
|
"FWUPD_DEVICE_FLAG_ADD_COUNTERPART_GUIDS if required",
|
||||||
|
guid_tmp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user