mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-13 05:45:21 +00:00
Add a more general quirk for adding GUIDs to devices
This replaces fwupd-dfu-alternate-vidpid which was only useful in the DFU plugin and somewhat poorly defined.
This commit is contained in:
parent
524343ac63
commit
e755d6bb05
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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]
|
||||
|
||||
|
@ -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",
|
||||
|
@ -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,
|
||||
|
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user