mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-16 01:06:09 +00:00
ebitdo: Use the new delayed removal functionality to remove complexity
The engine keeps track of the runtime GUID, so we don't have to anymore.
This commit is contained in:
parent
70425fe923
commit
d7f1bf55de
@ -609,6 +609,7 @@ fu_ebitdo_device_init_real (FuEbitdoDevice *device)
|
||||
|
||||
/* allowed, but requires manual bootloader step */
|
||||
fu_device_add_flag (FU_DEVICE (device), FWUPD_DEVICE_FLAG_UPDATABLE);
|
||||
fu_device_set_remove_delay (FU_DEVICE (device), FU_DEVICE_REMOVE_DELAY_USER_REPLUG);
|
||||
|
||||
/* set name and vendor */
|
||||
name = g_strdup_printf ("%s Gamepad",
|
||||
@ -623,6 +624,8 @@ fu_ebitdo_device_init_real (FuEbitdoDevice *device)
|
||||
|
||||
/* only the bootloader can do the update */
|
||||
if (priv->kind != FU_EBITDO_DEVICE_KIND_BOOTLOADER) {
|
||||
fu_device_add_guid (FU_DEVICE (device), "USB\\VID_0483&PID_5750");
|
||||
fu_device_add_guid (FU_DEVICE (device), "USB\\VID_2DC8&PID_5750");
|
||||
fu_device_add_flag (FU_DEVICE (device),
|
||||
FWUPD_DEVICE_FLAG_NEEDS_BOOTLOADER);
|
||||
}
|
||||
|
@ -32,8 +32,6 @@ fu_plugin_ebitdo_device_added (FuPlugin *plugin,
|
||||
GError **error)
|
||||
{
|
||||
FuEbitdoDeviceKind ebitdo_kind;
|
||||
const gchar *platform_id = NULL;
|
||||
g_autofree gchar *runtime_id = NULL;
|
||||
g_autoptr(FuDeviceLocker) locker = NULL;
|
||||
g_autoptr(FuEbitdoDevice) dev = NULL;
|
||||
|
||||
@ -48,26 +46,9 @@ fu_plugin_ebitdo_device_added (FuPlugin *plugin,
|
||||
if (locker == NULL)
|
||||
return FALSE;
|
||||
|
||||
/* only the bootloader can do the update */
|
||||
platform_id = g_usb_device_get_platform_id (usb_device);
|
||||
runtime_id = g_strdup_printf ("%s-runtime", platform_id);
|
||||
if (ebitdo_kind == FU_EBITDO_DEVICE_KIND_BOOTLOADER) {
|
||||
FuEbitdoDevice *dev_runtime;
|
||||
|
||||
/* add the last seen runtime GUID too */
|
||||
dev_runtime = fu_plugin_cache_lookup (plugin, runtime_id);
|
||||
if (dev_runtime != NULL) {
|
||||
const gchar *guid = fu_device_get_guid_default (FU_DEVICE (dev_runtime));
|
||||
g_debug ("adding runtime GUID of %s", guid);
|
||||
fu_device_add_guid (FU_DEVICE (dev), guid);
|
||||
}
|
||||
} else {
|
||||
fu_plugin_cache_add (plugin, runtime_id, dev);
|
||||
}
|
||||
|
||||
/* insert to hash */
|
||||
fu_plugin_device_add (plugin, FU_DEVICE (dev));
|
||||
fu_plugin_cache_add (plugin, platform_id, dev);
|
||||
fu_plugin_cache_add (plugin, g_usb_device_get_platform_id (usb_device), dev);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user