fu-quirks

fu-quirks — device quirks

Functions

Types and Values

Description

Quirks can be used to modify device behavior. When fwupd is installed in long-term support distros it's very hard to backport new versions as new hardware is released.

There are several reasons why we can't just include the mapping and quirk information in the AppStream metadata:

  • The extra data is hugely specific to the installed fwupd plugin versions

  • The device-id is per-device, and the mapping is usually per-plugin

  • Often the information is needed before the FuDevice is created

  • There are security implications in allowing plugins to handle new devices

The idea with quirks is that the end user can drop an additional (or replace an existing) file in a .d director with a simple format and the hardware will magically start working. This assumes no new quirks are required, as this would obviously need code changes, but allows us to get most existing devices working in an easy way without the user compiling anything.

See also: FuDevice, FuPlugin

Functions

FuQuirksIter ()

void
(*FuQuirksIter) (FuQuirks *self,
                 const gchar *key,
                 const gchar *value,
                 gpointer user_data);

fu_quirks_new ()

FuQuirks *
fu_quirks_new (void);

Creates a new quirks object.

[skip]

Returns

a new FuQuirks

Since: 1.0.1


fu_quirks_load ()

gboolean
fu_quirks_load (FuQuirks *self,
                FuQuirksLoadFlags load_flags,
                GError **error);

Loads the various files that define the hardware quirks used in plugins.

[skip]

Parameters

self

A FuQuirks

 

load_flags

A FuQuirksLoadFlags

 

error

A GError, or NULL

 

Returns

TRUE for success

Since: 1.0.1


fu_quirks_lookup_by_id ()

const gchar *
fu_quirks_lookup_by_id (FuQuirks *self,
                        const gchar *group,
                        const gchar *key);

Looks up an entry in the hardware database using a string value.

Parameters

self

A FuPlugin

 

group

A string group, e.g. "DeviceInstanceId=USB\VID_1235&PID_AB11"

 

key

An ID to match the entry, e.g. "Name"

 

Returns

values from the database, or NULL if not found.

[transfer none]

Since: 1.0.1


fu_quirks_lookup_by_id_iter ()

gboolean
fu_quirks_lookup_by_id_iter (FuQuirks *self,
                             const gchar *group,
                             FuQuirksIter iter_cb,
                             gpointer user_data);

Looks up all entries in the hardware database using a GUID value.

Parameters

self

A FuQuirks

 

group

string of group to lookup

 

iter_cb

A FuQuirksIter.

[scope async]

user_data

user data passed to iter_cb

 

Returns

TRUE if the ID was found, and iter was called

Since: 1.3.3


fu_quirks_add_possible_key ()

void
fu_quirks_add_possible_key (FuQuirks *self,
                            const gchar *possible_key);

Adds a possible quirk key. If added by a plugin it should be namespaced using the plugin name, where possible.

Parameters

self

A FuQuirks

 

possible_key

A key name, e.g. Flags

 

Since: 1.5.8

Types and Values

FU_TYPE_QUIRKS

#define FU_TYPE_QUIRKS (fu_quirks_get_type ())

enum FuQuirksLoadFlags

The flags to use when loading quirks.

Members

FU_QUIRKS_LOAD_FLAG_NONE

No flags set

 

FU_QUIRKS_LOAD_FLAG_READONLY_FS

Ignore readonly filesystem errors

 

FU_QUIRKS_PLUGIN

#define FU_QUIRKS_PLUGIN			"Plugin"

FU_QUIRKS_FLAGS

#define FU_QUIRKS_FLAGS				"Flags"

FU_QUIRKS_SUMMARY

#define FU_QUIRKS_SUMMARY			"Summary"

FU_QUIRKS_ICON

#define FU_QUIRKS_ICON				"Icon"

FU_QUIRKS_NAME

#define FU_QUIRKS_NAME				"Name"

FU_QUIRKS_BRANCH

#define FU_QUIRKS_BRANCH			"Branch"

FU_QUIRKS_GUID

#define FU_QUIRKS_GUID				"Guid"

FU_QUIRKS_COUNTERPART_GUID

#define FU_QUIRKS_COUNTERPART_GUID		"CounterpartGuid"

FU_QUIRKS_PARENT_GUID

#define FU_QUIRKS_PARENT_GUID			"ParentGuid"

FU_QUIRKS_PROXY_GUID

#define FU_QUIRKS_PROXY_GUID			"ProxyGuid"

FU_QUIRKS_CHILDREN

#define FU_QUIRKS_CHILDREN			"Children"

FU_QUIRKS_VERSION

#define FU_QUIRKS_VERSION			"Version"

FU_QUIRKS_VENDOR

#define FU_QUIRKS_VENDOR			"Vendor"

FU_QUIRKS_VENDOR_ID

#define FU_QUIRKS_VENDOR_ID			"VendorId"

FU_QUIRKS_FIRMWARE_SIZE_MIN

#define FU_QUIRKS_FIRMWARE_SIZE_MIN		"FirmwareSizeMin"

FU_QUIRKS_FIRMWARE_SIZE_MAX

#define FU_QUIRKS_FIRMWARE_SIZE_MAX		"FirmwareSizeMax"

FU_QUIRKS_FIRMWARE_SIZE

#define FU_QUIRKS_FIRMWARE_SIZE			"FirmwareSize"

FU_QUIRKS_INSTALL_DURATION

#define FU_QUIRKS_INSTALL_DURATION		"InstallDuration"

FU_QUIRKS_VERSION_FORMAT

#define FU_QUIRKS_VERSION_FORMAT		"VersionFormat"

FU_QUIRKS_GTYPE

#define FU_QUIRKS_GTYPE				"GType"

FU_QUIRKS_PROTOCOL

#define FU_QUIRKS_PROTOCOL			"Protocol"

FU_QUIRKS_UPDATE_MESSAGE

#define FU_QUIRKS_UPDATE_MESSAGE		"UpdateMessage"

FU_QUIRKS_UPDATE_IMAGE

#define FU_QUIRKS_UPDATE_IMAGE			"UpdateImage"

FU_QUIRKS_PRIORITY

#define FU_QUIRKS_PRIORITY			"Priority"

FU_QUIRKS_REMOVE_DELAY

#define FU_QUIRKS_REMOVE_DELAY			"RemoveDelay"

FuQuirks

typedef struct _FuQuirks FuQuirks;