mirror of
https://git.proxmox.com/git/fwupd
synced 2025-05-16 09:09:24 +00:00

The daemon creates a baseclass of either FuUsbDevice or FuUdevDevice when the devices are added or coldplugged to match the quirk database and to find out what plugin to run. This is proxied to plugins, but they are given the GUsbDevice or GUdevDevice and the FuDevice is just thrown away. Most plugins either use a FuUsbDevice or superclassed version like FuNvmeDevice and so we re-create the FuDevice, re-probe the hardware, re-query the quirk database and then return this to the daemon. In some cases, plugins actually probe the hardware three times (!) by creating a FuUsbDevice to get the quirks, so that the plugin knows what kind of superclass to create, which then itself probes the hardware again. Passing the temporary FuDevice to the plugins means that the simplest ones can just fu_plugin_device_add() the passed in object, or create a superclass and incorporate the actual GUsbDevice and all the GUIDs. This breaks internal plugin API but speeds up startup substantially and deletes a lot of code.
25 lines
485 B
C
25 lines
485 B
C
/*
|
|
* Copyright (C) 2017-2018 Richard Hughes <richard@hughsie.com>
|
|
*
|
|
* SPDX-License-Identifier: LGPL-2.1+
|
|
*/
|
|
|
|
#ifndef __FU_CSR_DEVICE_H
|
|
#define __FU_CSR_DEVICE_H
|
|
|
|
#include <glib-object.h>
|
|
#include <gusb.h>
|
|
|
|
#include "fu-plugin.h"
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
#define FU_TYPE_CSR_DEVICE (fu_csr_device_get_type ())
|
|
G_DECLARE_FINAL_TYPE (FuCsrDevice, fu_csr_device, FU, CSR_DEVICE, FuUsbDevice)
|
|
|
|
FuCsrDevice *fu_csr_device_new (FuUsbDevice *device);
|
|
|
|
G_END_DECLS
|
|
|
|
#endif /* __FU_CSR_DEVICE_H */
|