Functions

checksum_format_for_display (checksum)

checksum_get_best (checksums)

checksum_get_by_kind (checksums, kind)

checksum_guess_kind (checksum)

checksum_type_to_string_display (checksum_type)

codec_array_from_variant (value, gtype)

codec_array_to_json (array, member_name, builder, flags)

codec_array_to_variant (array, flags)

codec_json_append (builder, key, value)

codec_json_append_bool (builder, key, value)

codec_json_append_int (builder, key, value)

codec_json_append_strv (builder, key, value)

codec_string_append (str, idt, key, value)

codec_string_append_bool (str, idt, key, value)

codec_string_append_hex (str, idt, key, value)

codec_string_append_int (str, idt, key, value)

codec_string_append_size (str, idt, key, value)

codec_string_append_time (str, idt, key, value)

error_convert ()

error_from_string (error)

error_quark ()

error_to_string (error)

feature_flag_from_string (feature_flag)

feature_flag_to_string (feature_flag)

guid_from_string (guidstr, guid, flags)

guid_hash_data (data, datasz, flags)

guid_hash_string (str)

guid_is_valid (guid)

guid_to_string (guid, flags)

install_flags_from_string (str)

install_flags_to_string (install_flags)

status_from_string (status)

status_to_string (status)

update_state_from_string (update_state)

update_state_to_string (update_state)

version_format_from_string (str)

version_format_to_string (kind)

version_string ()

Details

Fwupd.checksum_format_for_display(checksum)[source]
Parameters:

checksum (str or None) – a checksum

Returns:

text, or None for invalid

Return type:

str

Formats a checksum for display.

New in version 0.9.3.

Fwupd.checksum_get_best(checksums)[source]
Parameters:

checksums ([str]) – checksums

Returns:

a checksum from the array, or None if nothing was suitable

Return type:

str

Gets a the best possible checksum kind.

New in version 0.9.4.

Fwupd.checksum_get_by_kind(checksums, kind)[source]
Parameters:
Returns:

a checksum from the array, or None if not found

Return type:

str

Gets a specific checksum kind.

New in version 0.9.4.

Fwupd.checksum_guess_kind(checksum)[source]
Parameters:

checksum (str or None) – a checksum

Returns:

a checksum type, e.g. GLib.ChecksumType.SHA1

Return type:

GLib.ChecksumType

Guesses the checksum kind based on the length of the hash.

New in version 0.9.3.

Fwupd.checksum_type_to_string_display(checksum_type)[source]
Parameters:

checksum_type (GLib.ChecksumType) – a GLib.ChecksumType, e.g. GLib.ChecksumType.SHA1

Returns:

text, or None for invalid

Return type:

str

Formats a checksum type for display.

New in version 1.9.6.

Fwupd.codec_array_from_variant(value, gtype)[source]
Parameters:
Raises:

GLib.Error

Returns:

True on success

Return type:

[GObject.Object]

Converts an array of objects, each deserialized from a GLib.Variant value.

New in version 2.0.0.

Fwupd.codec_array_to_json(array, member_name, builder, flags)[source]
Parameters:

Converts an array of objects into a GLib.Variant value.

New in version 2.0.0.

Fwupd.codec_array_to_variant(array, flags)[source]
Parameters:
Returns:

a GLib.Variant

Return type:

GLib.Variant

Converts an array of objects into a GLib.Variant value.

New in version 2.0.0.

Fwupd.codec_json_append(builder, key, value)[source]
Parameters:

Appends a key and value to a JSON builder.

New in version 2.0.0.

Fwupd.codec_json_append_bool(builder, key, value)[source]
Parameters:

Appends a key and boolean value to a JSON builder.

New in version 2.0.0.

Fwupd.codec_json_append_int(builder, key, value)[source]
Parameters:

Appends a key and unsigned integer to a JSON builder.

New in version 2.0.0.

Fwupd.codec_json_append_strv(builder, key, value)[source]
Parameters:

Appends a key and string array to a JSON builder.

New in version 2.0.0.

Fwupd.codec_string_append(str, idt, key, value)[source]
Parameters:

Appends a key and value to a string.

New in version 2.0.0.

Fwupd.codec_string_append_bool(str, idt, key, value)[source]
Parameters:

Appends a key and boolean value to a string.

New in version 2.0.0.

Fwupd.codec_string_append_hex(str, idt, key, value)[source]
Parameters:

Appends a key and hex integer to a string.

New in version 2.0.0.

Fwupd.codec_string_append_int(str, idt, key, value)[source]
Parameters:

Appends a key and unsigned integer to a string.

New in version 2.0.0.

Fwupd.codec_string_append_size(str, idt, key, value)[source]
Parameters:

Appends a key and size in bytes to a string.

New in version 2.0.0.

Fwupd.codec_string_append_time(str, idt, key, value)[source]
Parameters:

Appends a key and time value to a string.

New in version 2.0.0.

Fwupd.error_convert()[source]
Raises:

GLib.Error

Convert the error to a Fwupd.Error, if required.

New in version 2.0.0.

Fwupd.error_from_string(error)[source]
Parameters:

error (str or None) – a string, e.g. org.freedesktop.fwupd.VersionNewer

Returns:

enumerated value

Return type:

Fwupd.Error

Converts a string to an enumerated error.

New in version 0.7.0.

Fwupd.error_quark()[source]
Returns:

an error quark

Return type:

int

An error quark.

New in version 0.1.1.

Fwupd.error_to_string(error)[source]
Parameters:

error (Fwupd.Error) – an enumerated error, e.g. Fwupd.Error.VERSION_NEWER

Returns:

identifier string

Return type:

str

Converts an enumerated error to a string.

New in version 0.7.0.

Fwupd.feature_flag_from_string(feature_flag)[source]
Parameters:

feature_flag (str or None) – a string, e.g. detach-action

Returns:

enumerated value

Return type:

Fwupd.FeatureFlags

Converts a string to an enumerated feature flag.

New in version 1.4.5.

Fwupd.feature_flag_to_string(feature_flag)[source]
Parameters:

feature_flag (Fwupd.FeatureFlags) – a single feature flag, e.g. Fwupd.FeatureFlags.DETACH_ACTION

Returns:

identifier string

Return type:

str

Converts a feature flag to a string.

New in version 1.4.5.

Fwupd.guid_from_string(guidstr, guid, flags)[source]
Parameters:
Raises:

GLib.Error

Returns:

True for success

Return type:

bool

Converts a string GUID into its binary encoding. All string GUIDs are formatted as big endian but on-disk can be encoded in different ways.

New in version 1.2.5.

Fwupd.guid_hash_data(data, datasz, flags)[source]
Parameters:
Returns:

a new GUID, or None for internal error

Return type:

str

Returns a GUID for some data. This uses a hash and so even small differences in the data will produce radically different return values.

The implementation is taken from RFC4122, Section 4.1.3; specifically using a type-5 SHA-1 hash.

New in version 1.2.5.

Fwupd.guid_hash_string(str)[source]
Parameters:

str (str or None) – a source string to use as a key

Returns:

a new GUID, or None if the string was invalid

Return type:

str

Returns a GUID for a given string. This uses a hash and so even small differences in the str will produce radically different return values.

The default implementation is taken from RFC4122, Section 4.1.3; specifically using a type-5 SHA-1 hash with a DNS namespace. The same result can be obtained with this simple python program:

#!/usr/bin/python import uuid print uuid.uuid5(uuid.NAMESPACE_DNS, ‘python.org’)

New in version 1.2.5.

Fwupd.guid_is_valid(guid)[source]
Parameters:

guid (str) – string to check, e.g. 00112233-4455-6677-8899-aabbccddeeff

Returns:

True if guid was a valid GUID, False otherwise

Return type:

bool

Checks the string is a valid GUID.

New in version 1.2.5.

Fwupd.guid_to_string(guid, flags)[source]
Parameters:
Returns:

a new GUID string

Return type:

str

Returns a text GUID of mixed or BE endian for a packed buffer.

New in version 1.2.5.

Fwupd.install_flags_from_string(str)[source]
Parameters:

str (str or None) – a string, e.g. allow-reinstall

Returns:

an enumerated install flag, e.g. Fwupd.InstallFlags.ALLOW_REINSTALL

Return type:

Fwupd.InstallFlags

Converts text to an install flag

New in version 2.0.4.

Fwupd.install_flags_to_string(install_flags)[source]
Parameters:

install_flags (Fwupd.InstallFlags) – a Fwupd.InstallFlags, e.g. Fwupd.InstallFlags.FORCE

Returns:

a string, e.g. force, or None if not known

Return type:

str

Converts an install flag to text.

New in version 2.0.0.

Fwupd.status_from_string(status)[source]
Parameters:

status (str or None) – a string, e.g. decompressing

Returns:

enumerated value

Return type:

Fwupd.Status

Converts a string to an enumerated status.

New in version 0.1.1.

Fwupd.status_to_string(status)[source]
Parameters:

status (Fwupd.Status) – a status, e.g. Fwupd.Status.DECOMPRESSING

Returns:

identifier string

Return type:

str

Converts an enumerated status to a string.

New in version 0.1.1.

Fwupd.update_state_from_string(update_state)[source]
Parameters:

update_state (str or None) – a string, e.g. pending

Returns:

enumerated value

Return type:

Fwupd.UpdateState

Converts a string to an enumerated update state.

New in version 0.7.0.

Fwupd.update_state_to_string(update_state)[source]
Parameters:

update_state (Fwupd.UpdateState) – the update state, e.g. Fwupd.UpdateState.PENDING

Returns:

identifier string

Return type:

str

Converts an enumerated update state to a string.

New in version 0.7.0.

Fwupd.version_format_from_string(str)[source]
Parameters:

str (str or None) – a string, e.g. quad

Returns:

an enumerated version format, e.g. Fwupd.VersionFormat.TRIPLET

Return type:

Fwupd.VersionFormat

Converts text to a display version type.

New in version 1.2.9.

Fwupd.version_format_to_string(kind)[source]
Parameters:

kind (Fwupd.VersionFormat) – a version format, e.g. Fwupd.VersionFormat.TRIPLET

Returns:

a string, e.g. quad, or None if not known

Return type:

str

Converts an enumerated version format to text.

New in version 1.2.9.

Fwupd.version_string()[source]
Returns:

version string

Return type:

str

Gets the libfwupd installed runtime version.

This may be different to the *build-time* version if the daemon and library objects somehow get out of sync.

New in version 1.6.1.