fu-plugin-vfuncs: fwupd Reference Manual

## fu-plugin-vfuncs fu-plugin-vfuncs |

## Functions

void | fu_plugin_init ()
void | fu_plugin_destroy ()
gboolean | fu_plugin_startup ()
gboolean | fu_plugin_coldplug ()
gboolean | fu_plugin_coldplug_prepare ()
gboolean | fu_plugin_coldplug_cleanup ()
gboolean | fu_plugin_update ()
gboolean | fu_plugin_verify ()
gboolean | fu_plugin_unlock ()
gboolean | fu_plugin_activate ()
gboolean | fu_plugin_clear_results ()
gboolean | fu_plugin_get_results ()
gboolean | fu_plugin_update_attach ()
gboolean | fu_plugin_update_detach ()
gboolean | fu_plugin_update_prepare ()
gboolean | fu_plugin_update_cleanup ()
gboolean | fu_plugin_composite_prepare ()
gboolean | fu_plugin_composite_cleanup ()
gboolean | fu_plugin_backend_device_added ()
gboolean | fu_plugin_backend_device_changed ()
gboolean | fu_plugin_backend_device_removed ()
void | fu_plugin_device_added ()
gboolean | fu_plugin_device_created ()
void | fu_plugin_device_registered ()
void | fu_plugin_add_security_attrs ()

## Description

## Functions

### fu_plugin_init ()

    void
    fu_plugin_init (FuPlugin *plugin);

Initializes the plugin. Sets up any static data structures for the plugin. Most plugins should call fu_plugin_set_build_hash in here.

#### Parameters

plugin | A FuPlugin |

Since: 0.8.0

### fu_plugin_destroy ()

    void
    fu_plugin_destroy (FuPlugin *plugin);

Destroys the plugin. Any allocated memory should be freed here.

#### Parameters

plugin | a plugin |

Since: 0.8.0

### fu_plugin_startup ()

    gboolean
    fu_plugin_startup (FuPlugin *plugin,
                       GError **error);

Tries to start the plugin.

#### Parameters

plugin | a plugin |
error | optional return location for an error. | [nullable]

#### Returns

TRUE for success or FALSE for failure.

Any plugins not intended for the system or that have failure communicating with the device should return FALSE. Any allocated memory should be freed here.

Since: 0.8.0

### fu_plugin_coldplug ()

    gboolean
    fu_plugin_coldplug (FuPlugin *plugin,
                        GError **error);

Probes for devices.

#### Parameters

plugin | a plugin |
error | optional return location for an error. | [nullable]

Since: 0.8.0

### fu_plugin_coldplug_prepare ()

    gboolean
    fu_plugin_coldplug_prepare (FuPlugin *plugin,
                                GError **error);

Prepares to probe for devices.

#### Parameters

plugin | a plugin |
error | optional return location for an error. | [nullable]

Since: 0.8.0

### fu_plugin_coldplug_cleanup ()

    gboolean
    fu_plugin_coldplug_cleanup (FuPlugin *plugin,
                                GError **error);

Cleans up from probe for devices.

#### Parameters

plugin | a plugin |
error | optional return location for an error. | [nullable]

Since: 0.8.0

### fu_plugin_update ()

    gboolean
    fu_plugin_update (FuPlugin *plugin,
                      FuDevice *dev,
                      GBytes *blob_fw,
                      FwupdInstallFlags flags,
                      GError **error);

Updates the firmware on the device with blob_fw

#### Parameters

plugin | a plugin |
dev | a device |
blob_fw | a data blob |
flags | install flags |
error | optional return location for an error. | [nullable]

Since: 0.9.7

### fu_plugin_verify ()

    gboolean
    fu_plugin_verify (FuPlugin *plugin,
                      FuDevice *dev,
                      FuPluginVerifyFlags flags,
                      GError **error);

Verifies the firmware on the device matches the value stored in the database

#### Parameters

plugin | a plugin |
dev | a device |
flags | verify flags |
error | optional return location for an error. | [nullable]

Since: 0.8.0

### fu_plugin_unlock ()

    gboolean
    fu_plugin_unlock (FuPlugin *plugin,
                      FuDevice *dev,
                      GError **error);

Unlocks the device for writes.

#### Parameters

plugin | a plugin |
dev | a device |
error | optional return location for an error. | [nullable]

Since: 0.8.0

### fu_plugin_activate ()

    gboolean
    fu_plugin_activate (FuPlugin *plugin,
                        FuDevice *dev,
                        GError **error);

Activates the new firmware on the device.

This is intended for devices that it is not safe to immediately activate the firmware. It may be called at a more convenient time instead.

#### Parameters

plugin | a plugin |
dev | a device |
error | optional return location for an error. | [nullable]

Since: 1.2.6

### fu_plugin_clear_results ()

    gboolean
    fu_plugin_clear_results (FuPlugin *plugin,
                             FuDevice *dev,
                             GError **error);

Clears stored update results for the device.

#### Parameters

plugin | a plugin |
dev | a device |
error | optional return location for an error. | [nullable]

Since: 0.8.0

### fu_plugin_get_results ()

    gboolean
    fu_plugin_get_results (FuPlugin *plugin,
                           FuDevice *dev,
                           GError **error);

Obtains historical update results for the device.

#### Parameters

plugin | a plugin |
dev | a device |
error | optional return location for an error. | [nullable]

Since: 0.8.0

### fu_plugin_update_attach ()

    gboolean
    fu_plugin_update_attach (FuPlugin *plugin,
                             FuDevice *dev,
                             GError **error);

Swaps the device from bootloader mode to runtime mode.

#### Parameters

plugin | a plugin |
dev | a device |
error | optional return location for an error. | [nullable]

Since: 1.0.2

### fu_plugin_update_detach ()

    gboolean
    fu_plugin_update_detach (FuPlugin *plugin,
                             FuDevice *dev,
                             GError **error);

Swaps the device from runtime mode to bootloader mode.

#### Parameters

plugin | a plugin |
dev | a device |
error | optional return location for an error. | [nullable]

Since: 1.0.2

### fu_plugin_update_prepare ()

    gboolean
    fu_plugin_update_prepare (FuPlugin *plugin,
                              FwupdInstallFlags flags,
                              FuDevice *dev,
                              GError **error);

Prepares the device to receive an update.

#### Parameters

plugin | a plugin |
flags | install flags |
dev | a device |
error | optional return location for an error. | [nullable]

Since: 0.8.0

### fu_plugin_update_cleanup ()

    gboolean
    fu_plugin_update_cleanup (FuPlugin *plugin,
                              FwupdInstallFlags flags,
                              FuDevice *dev,
                              GError **error);

Cleans up the device after receiving an update.

#### Parameters

plugin | a plugin |
flags | install flags |
dev | a device |
error | optional return location for an error. | [nullable]

Since: 0.8.0

### fu_plugin_composite_prepare ()

    gboolean
    fu_plugin_composite_prepare (FuPlugin *plugin,
                                 GPtrArray *devices,
                                 GError **error);

Function run before updating group of composite devices.

#### Parameters

plugin | a plugin |
devices | array of devices. | [element-type FuDevice]
error | optional return location for an error. | [nullable]

Since: 1.0.9

### fu_plugin_composite_cleanup ()

    gboolean
    fu_plugin_composite_cleanup (FuPlugin *plugin,
                                 GPtrArray *devices,
                                 GError **error);

Function run after updating group of composite devices.

#### Parameters

plugin | a plugin |
devices | array of devices. | [element-type FuDevice]
error | optional return location for an error. | [nullable]

Since: 1.0.9

### fu_plugin_backend_device_added ()

    gboolean
    fu_plugin_backend_device_added (FuPlugin *plugin,
                                    FuDevice *device,
                                    GError **error);

Function to run after a device is added by a backend, e.g. by USB or Udev.

#### Parameters

plugin | a plugin |
device | a device |
error | optional return location for an error. | [nullable]

Since: 1.5.6

### fu_plugin_backend_device_changed ()

    gboolean
    fu_plugin_backend_device_changed (FuPlugin *plugin,
                                      FuDevice *device,
                                      GError **error);

Function run when the device changed.

#### Parameters

plugin | a plugin |
device | a device |
error | optional return location for an error. | [nullable]

Since: 1.5.6

### fu_plugin_backend_device_removed ()

    gboolean
    fu_plugin_backend_device_removed (FuPlugin *plugin,
                                      FuDevice *device,
                                      GError **error);

Function to run when device is physically removed.

#### Parameters

plugin | a plugin |
device | a device |
error | optional return location for an error. | [nullable]

Since: 1.5.6

### fu_plugin_device_added ()

    void
    fu_plugin_device_added (FuPlugin *plugin,
                            FuDevice *dev);

Function run when the subclassed device has been added.

#### Parameters

plugin | a plugin |
dev | a device |

Since: 1.5.0

### fu_plugin_device_created ()

    gboolean
    fu_plugin_device_created (FuPlugin *plugin,
                              FuDevice *dev,
                              GError **error);

Function run when the subclassed device has been created.

#### Parameters

plugin | a plugin |
dev | a device |
error | optional return location for an error. | [nullable]

Since: 1.4.0

### fu_plugin_device_registered ()

    void
    fu_plugin_device_registered (FuPlugin *plugin,
                                 FuDevice *dev);

Function run when device registered from another plugin.

#### Parameters

plugin | a plugin |
dev | a device |

Since: 0.9.7

### fu_plugin_add_security_attrs ()

    void
    fu_plugin_add_security_attrs (FuPlugin *plugin,
                                  FuSecurityAttrs *attrs);

Function that asks plugins to add Host Security Attributes.

#### Parameters

plugin | a plugin |
attrs | a security attribute |

Since: 1.5.0