Functions¶
Details¶
- Fwupd.checksum_format_for_display(checksum)[source]¶
-
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
Noneif nothing was suitable- Return type:
Gets a the best possible checksum kind.
New in version 0.9.4.
- Fwupd.checksum_get_by_kind(checksums, kind)[source]¶
- Parameters:
checksums ([
str]) – checksumskind (
GLib.ChecksumType) – a checksum type, e.g.GLib.ChecksumType.SHA512
- Returns:
a checksum from the array, or
Noneif not found- Return type:
Gets a specific checksum kind.
New in version 0.9.4.
- Fwupd.checksum_guess_kind(checksum)[source]¶
- Parameters:
- Returns:
a checksum type, e.g.
GLib.ChecksumType.SHA1- Return type:
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) – aGLib.ChecksumType, e.g.GLib.ChecksumType.SHA1- Returns:
text, or
Nonefor invalid- Return type:
Formats a checksum type for display.
New in version 1.9.6.
- Fwupd.codec_array_from_variant(value, gtype)[source]¶
- Parameters:
value (
GLib.Variant) – a JSON nodegtype (
GObject.GType) – aGObject.GTypethat implementsFwupdCodec
- Raises:
- Returns:
Trueon success- Return type:
Converts an array of objects, each deserialized from a
GLib.Variantvalue.New in version 2.0.0.
- Fwupd.codec_array_to_json(array, member_name, json_obj, flags)[source]¶
- Parameters:
array ([
GObject.Object]) – (not nullable): array of objects that much implementFwupdCodecmember_name (
str) – member name of the arrayjson_obj (
Fwupd.JsonObject) – aFwupd.JsonObjectflags (
Fwupd.CodecFlags) – aFwupd.CodecFlags, e.g.Fwupd.CodecFlags.TRUSTED
Converts an array of objects into a
GLib.Variantvalue.New in version 2.0.0.
- Fwupd.codec_array_to_variant(array, flags)[source]¶
- Parameters:
array ([
GObject.Object]) – (not nullable): array of objects that much implementFwupdCodecflags (
Fwupd.CodecFlags) – aFwupd.CodecFlags, e.g.Fwupd.CodecFlags.TRUSTED
- Returns:
- Return type:
Converts an array of objects into a
GLib.Variantvalue.New in version 2.0.0.
- Fwupd.codec_json_append(json_obj, key, value)[source]¶
- Parameters:
json_obj (
Fwupd.JsonObject) – aFwupd.JsonObjectkey (
str) – a stringvalue (
str) – a string to append
Appends a key and value to a JSON object.
Deprecated for
Fwupd.JsonObject.add_string().New in version 2.0.0.
Deprecated since version 2.1.1.
- Fwupd.codec_json_append_bool(json_obj, key, value)[source]¶
- Parameters:
json_obj (
Fwupd.JsonObject) – aFwupd.JsonObjectkey (
str) – a stringvalue (
bool) – boolean
Appends a key and boolean value to a JSON object.
Deprecated for
Fwupd.JsonObject.add_boolean().New in version 2.0.0.
Deprecated since version 2.1.1.
- Fwupd.codec_json_append_int(json_obj, key, value)[source]¶
- Parameters:
json_obj (
Fwupd.JsonObject) – aFwupd.JsonObjectkey (
str) – a stringvalue (
int) – guint64
Appends a key and unsigned integer to a JSON object.
Deprecated for
Fwupd.JsonObject.add_integer().New in version 2.0.0.
Deprecated since version 2.1.1.
- Fwupd.codec_json_append_map(json_obj, key, value)[source]¶
- Parameters:
json_obj (
Fwupd.JsonObject) – aFwupd.JsonObjectkey (
str) – a string
Appends a key and string hash map to a JSON object.
Deprecated for
Fwupd.JsonObject.add_object_map().New in version 2.0.10.
Deprecated since version 2.1.1.
- Fwupd.codec_json_append_strv(json_obj, key, value)[source]¶
- Parameters:
json_obj (
Fwupd.JsonObject) – aFwupd.JsonObjectkey (
str) – a stringvalue (
str) – a #GStrv
Appends a key and string array to a JSON object.
Deprecated for
Fwupd.JsonObject.add_array_strv().New in version 2.0.0.
Deprecated since version 2.1.1.
- Fwupd.codec_string_append(str, idt, key, value)[source]¶
- Parameters:
str (
GLib.String) – aGLib.Stringidt (
int) – the indentkey (
str) – a string to appendvalue (
str) – a string to append
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:
str (
GLib.String) – aGLib.Stringidt (
int) – the indentkey (
str) – a string to appendvalue (
bool) – Boolean
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:
str (
GLib.String) – aGLib.Stringidt (
int) – the indentkey (
str) – a string to appendvalue (
int) – guint64
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:
str (
GLib.String) – aGLib.Stringidt (
int) – the indentkey (
str) – a string to appendvalue (
int) – guint64
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:
str (
GLib.String) – aGLib.Stringidt (
int) – the indentkey (
str) – a string to appendvalue (
int) – guint64
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:
str (
GLib.String) – aGLib.Stringidt (
int) – the indentkey (
str) – a string to appendvalue (
int) – guint64 UNIX time
Appends a key and time value to a string.
New in version 2.0.0.
- Fwupd.error_convert()[source]¶
- Raises:
Convert the error to a
Fwupd.Error, if required.New in version 2.0.0.
- Fwupd.error_from_string(error)[source]¶
- Parameters:
error (
strorNone) – a string, e.g.org.freedesktop.fwupd.VersionNewer- Returns:
enumerated value
- Return type:
Converts a string to an enumerated error.
New in version 0.7.0.
- Fwupd.error_quark()[source]¶
- Returns:
an error quark
- Return type:
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:
Converts an enumerated error to a string.
New in version 0.7.0.
- Fwupd.feature_flag_from_string(val)[source]¶
- Parameters:
- Returns:
enumerated value
- Return type:
Converts a string to an enumerated value.
New in version 1.4.5.
- Fwupd.feature_flag_to_string(val)[source]¶
- Parameters:
val (
Fwupd.FeatureFlags) – value, e.g.Fwupd.FeatureFlags.CAN_REPORT- Returns:
identifier string
- Return type:
Converts an enumerated value to a string.
New in version 1.4.5.
- Fwupd.guid_from_string(guidstr, guid, flags)[source]¶
- Parameters:
guidstr (
str) – a GUID, e.g.00112233-4455-6677-8899-aabbccddeeffguid (
intorNone) – a #fwupd_guid_t, orNoneto just check the GUIDflags (
Fwupd.GuidFlags) – GUID flags, e.g.Fwupd.GuidFlags.MIXED_ENDIAN
- Raises:
- Returns:
Truefor success- Return type:
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:
data (
int) – data to hashdatasz (
int) – length of dataflags (
Fwupd.GuidFlags) – GUID flags, e.g.Fwupd.GuidFlags.NAMESPACE_MICROSOFT
- Returns:
a new GUID, or
Nonefor internal error- Return type:
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:
- Returns:
a new GUID, or
Noneif the string was invalid- Return type:
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:
- Return type:
Checks the string is a valid GUID.
New in version 1.2.5.
- Fwupd.guid_to_string(guid, flags)[source]¶
- Parameters:
guid (
int) – a #fwupd_guid_t to readflags (
Fwupd.GuidFlags) – GUID flags, e.g.Fwupd.GuidFlags.MIXED_ENDIAN
- Returns:
a new GUID string
- Return type:
Returns a text GUID of mixed or BE endian for a packed buffer.
New in version 1.2.5.
- Fwupd.install_flags_from_string(val)[source]¶
- Parameters:
- Returns:
enumerated value
- Return type:
Converts a string to an enumerated value.
New in version 2.0.4.
- Fwupd.install_flags_to_string(val)[source]¶
- Parameters:
val (
Fwupd.InstallFlags) – value, e.g.Fwupd.InstallFlags.ALLOW_REINSTALL- Returns:
identifier string
- Return type:
Converts an enumerated value to a string.
New in version 2.0.0.
- Fwupd.json_node_kind_to_string(val)[source]¶
- Parameters:
val (
Fwupd.JsonNodeKind) – value, e.g.Fwupd.JsonNodeKind.RAW- Returns:
identifier string
- Return type:
Converts an enumerated value to a string.
New in version 2.1.1.
- Fwupd.status_from_string(val)[source]¶
- Parameters:
- Returns:
enumerated value
- Return type:
Converts a string to an enumerated value.
New in version 0.1.1.
- Fwupd.status_to_string(val)[source]¶
- Parameters:
val (
Fwupd.Status) – value, e.g.Fwupd.Status.IDLE- Returns:
identifier string
- Return type:
Converts an enumerated value to a string.
New in version 0.1.1.
- Fwupd.strerror(errnum)[source]¶
-
Returns an untranslated string corresponding to the given error code, e.g. “no such process”.
New in version 2.0.11.
- Fwupd.update_state_from_string(val)[source]¶
- Parameters:
- Returns:
enumerated value
- Return type:
Converts a string to an enumerated value.
New in version 0.7.0.
- Fwupd.update_state_to_string(val)[source]¶
- Parameters:
val (
Fwupd.UpdateState) – value, e.g.Fwupd.UpdateState.PENDING- Returns:
identifier string
- Return type:
Converts an enumerated value to a string.
New in version 0.7.0.
- Fwupd.version_format_from_string(val)[source]¶
- Parameters:
- Returns:
enumerated value
- Return type:
Converts a string to an enumerated value.
New in version 1.2.9.
- Fwupd.version_format_to_string(val)[source]¶
- Parameters:
val (
Fwupd.VersionFormat) – value, e.g.Fwupd.VersionFormat.PLAIN- Returns:
identifier string
- Return type:
Converts an enumerated value to a string.
New in version 1.2.9.