diff --git a/plugins/dfu/dfu-device.c b/plugins/dfu/dfu-device.c index 764a58b92..aaa98c0db 100644 --- a/plugins/dfu/dfu-device.c +++ b/plugins/dfu/dfu-device.c @@ -418,7 +418,6 @@ dfu_device_add_targets (DfuDevice *device, GError **error) /* the device has no DFU runtime, so cheat */ if (priv->quirks & DFU_DEVICE_QUIRK_NO_DFU_RUNTIME) { - const gchar *quirk_str; if (priv->targets->len == 0) { g_debug ("no DFU runtime, so faking device"); priv->state = DFU_STATE_APP_IDLE; @@ -429,17 +428,6 @@ dfu_device_add_targets (DfuDevice *device, GError **error) priv->attributes = DFU_DEVICE_ATTRIBUTE_CAN_DOWNLOAD | DFU_DEVICE_ATTRIBUTE_CAN_UPLOAD; } - - /* inverse, but it's the best we can do */ - quirk_str = fu_quirks_lookup_by_usb_device (priv->system_quirks, - FU_QUIRKS_DFU_ALTERNATE_VIDPID, - usb_device); - if (quirk_str != NULL && strlen (quirk_str) == 8) { - priv->runtime_vid = dfu_utils_buffer_parse_uint16 (quirk_str + 0); - priv->runtime_pid = dfu_utils_buffer_parse_uint16 (quirk_str + 4); - g_debug ("using VID_%04X&PID_%04X as the runtime", - priv->runtime_vid, priv->runtime_pid); - } return TRUE; } diff --git a/plugins/dfu/dfu.quirk b/plugins/dfu/dfu.quirk index a7c6b2b48..716da98bb 100644 --- a/plugins/dfu/dfu.quirk +++ b/plugins/dfu/dfu.quirk @@ -80,13 +80,13 @@ USB\VID_0B0E&PID_0420=0201 USB\VID_0B0E&PID_2475=0508 USB\VID_0B0E&PID_2456=0508 -[fwupd-dfu-alternate-vidpid] +[fwupd-usb-guid] # Jabra 410, 510, 710 and 810 -USB\VID_0B0E&PID_0412=0B0E0411 -USB\VID_0B0E&PID_0420=0B0E0421 -USB\VID_0B0E&PID_2475=0B0E0982 -USB\VID_0B0E&PID_2456=0B0E0971 +USB\VID_0B0E&PID_0412=USB\VID_0B0E&PID_0411 +USB\VID_0B0E&PID_0420=USB\VID_0B0E&PID_0421 +USB\VID_0B0E&PID_2475=USB\VID_0B0E&PID_0982 +USB\VID_0B0E&PID_2456=USB\VID_0B0E&PID_0971 [fwupd-dfu-avr-chip-id] diff --git a/src/fu-plugin.c b/src/fu-plugin.c index 1faaafd2a..c58b3abec 100644 --- a/src/fu-plugin.c +++ b/src/fu-plugin.c @@ -371,6 +371,13 @@ fu_plugin_device_add (FuPlugin *plugin, FuDevice *device) usb_device); if (tmp != NULL) fu_device_add_icon (device, tmp); + + /* GUID */ + tmp = fu_quirks_lookup_by_usb_device (priv->quirks, + FU_QUIRKS_USB_GUID, + usb_device); + if (tmp != NULL) + fu_device_add_guid (device, tmp); } g_debug ("emit added from %s: %s", diff --git a/src/fu-quirks.c b/src/fu-quirks.c index b02229d47..a59c2b15d 100644 --- a/src/fu-quirks.c +++ b/src/fu-quirks.c @@ -228,7 +228,7 @@ fu_quirks_add_quirks_from_filename (FuQuirks *self, const gchar *filename, GErro return FALSE; for (guint j = 0; keys[j] != NULL; j++) { g_autofree gchar *tmp = NULL; - tmp = g_key_file_get_string (kf, groups[i], keys[j], error); + tmp = g_key_file_get_value (kf, groups[i], keys[j], error); if (tmp == NULL) return FALSE; g_hash_table_insert (self->hash, diff --git a/src/fu-quirks.h b/src/fu-quirks.h index 96497c162..dd196c84c 100644 --- a/src/fu-quirks.h +++ b/src/fu-quirks.h @@ -116,19 +116,6 @@ const gchar *fu_quirks_lookup_by_usb_device (FuQuirks *self, */ #define FU_QUIRKS_DFU_JABRA_DETACH "fwupd-dfu-jabra-detach" -/** - * FU_QUIRKS_DFU_ALTERNATE_VIDPID: - * @key: the USB device ID, e.g. `USB\VID_0763&PID_2806` - * @value: the uint16_t VID and uint16_t PID values, encoded in base 16, e.g. `0B0E0411` - * - * Assigns the USB vendor ID and product ID when the device is in the alternate - * mode. For instance this can be used to set the application VID/PID when in DFU - * mode or the bootloader VID/PID when in application mode. - * - * Since: 1.0.1 - */ -#define FU_QUIRKS_DFU_ALTERNATE_VIDPID "fwupd-dfu-alternate-vidpid" - /** * FU_QUIRKS_DFU_AVR_CHIP_ID: * @key: the AVR chip ID, e.g. `0x58200204` @@ -191,6 +178,18 @@ const gchar *fu_quirks_lookup_by_usb_device (FuQuirks *self, */ #define FU_QUIRKS_USB_NAME "fwupd-usb-name" +/** + * FU_QUIRKS_USB_GUID: + * @key: the USB device ID, e.g. `USB\VID_0763&PID_2806` + * @value: the GUID, e.g. `537f7800-8529-5656-b2fa-b0901fe91696` + * + * Adds an extra GUID for a specific hardware device. If the value provided is + * not already a suitable GUID, it will be converted to one. + * + * Since: 1.0.3 + */ +#define FU_QUIRKS_USB_GUID "fwupd-usb-guid" + G_END_DECLS #endif /* __FU_QUIRKS_H */