| Top |
gboolean fu_common_spawn_sync (const gchar * const *argv,FuOutputHandler handler_cb,gpointer handler_user_data,GCancellable *cancellable,GError **error);
Runs a subprocess and waits for it to exit. Any output on standard out or
standard error will be forwarded to handler_cb
as whole lines.
argv |
The argument list to run |
|
handler_cb |
A FuOutputHandler or |
[scope call] |
handler_user_data |
the user data to pass to |
|
cancellable |
a GCancellable, or |
|
error |
gchar *
fu_common_get_path (FuPathKind path_kind);
Gets a fwupd-specific system path. These can be overridden with various
environment variables, for instance FWUPD_DATADIR.
gboolean fu_common_rmtree (const gchar *directory,GError **error);
Recursively removes a directory.
GPtrArray * fu_common_get_files_recursive (const gchar *path,GError **error);
Returns every file found under directory
, and any subdirectory.
If any path under directory
cannot be accessed due to permissions an error
will be returned.
gboolean fu_common_mkdir_parent (const gchar *filename,GError **error);
Creates any required directories, including any parent directories.
gboolean fu_common_set_contents_bytes (const gchar *filename,GBytes *bytes,GError **error);
Writes a blob of data to a filename, creating the parent directories as required.
GBytes * fu_common_get_contents_bytes (const gchar *filename,GError **error);
Reads a blob of data from a file.
GBytes * fu_common_get_contents_fd (gint fd,gsize count,GError **error);
Reads a blob from a specific file descriptor.
Note: this will close the fd when done
gboolean fu_common_extract_archive (GBytes *blob,const gchar *dir,GError **error);
Extracts an achive to a directory.
GBytes * fu_common_firmware_builder (GBytes *bytes,const gchar *script_fn,const gchar *output_fn,GError **error);
Builds a firmware file using tools from the host session in a bubblewrap jail. Several things happen during build:
The bytes
data is untarred to a temporary location
A bubblewrap container is set up
The startup.sh script is run inside the container
The firmware.bin is extracted from the container
The temporary location is deleted
GError *
fu_common_error_array_get_best (GPtrArray *errors);
Finds the 'best' error to show the user from a array of errors, creating a completely bespoke error where required.
guint64
fu_common_strtoull (const gchar *str);
Converts a string value to an integer. Values are assumed base 10, unless prefixed with "0x" where they are parsed as base 16.
gchar * fu_common_find_program_in_path (const gchar *basename,GError **error);
gchar *
fu_common_strstrip (const gchar *str);
Removes leading and trailing whitespace from a constant string.
void fu_common_write_uint16 (guint8 *buf,guint16 val_native,FuEndianType endian);
Writes a value to a buffer using a specified endian.
buf |
A writable buffer |
|
val_native |
a value in host byte-order |
|
endian |
A FuEndianType, e.g. |
void fu_common_write_uint32 (guint8 *buf,guint32 val_native,FuEndianType endian);
Writes a value to a buffer using a specified endian.
buf |
A writable buffer |
|
val_native |
a value in host byte-order |
|
endian |
A FuEndianType, e.g. |
guint16 fu_common_read_uint16 (const guint8 *buf,FuEndianType endian);
Read a value from a buffer using a specified endian.
guint32 fu_common_read_uint32 (const guint8 *buf,FuEndianType endian);
Read a value from a buffer using a specified endian.
guint fu_common_string_replace (GString *string,const gchar *search,const gchar *replace);
Performs multiple search and replace operations on the given string.
string |
The GString to operate on |
|
search |
The text to search for |
|
replace |
The text to use for substitutions |
Since: 1.2.0