libfwupd: Add async versions of the library for GUI tools

Rather than force the GUI to interact with fwupd using threads, provide
async versions so thay can be run without blocking the UI thread.
This commit is contained in:
Richard Hughes 2020-08-25 16:00:26 +01:00
parent 9f31bc22df
commit 7c8a830659
13 changed files with 5334 additions and 1440 deletions

View File

@ -26,6 +26,7 @@
</para>
</partintro>
<xi:include href="xml/fwupd-client.xml"/>
<xi:include href="xml/fwupd-client-sync.xml"/>
<xi:include href="xml/fwupd-device.xml"/>
<xi:include href="xml/fwupd-release.xml"/>
<xi:include href="xml/fwupd-remote.xml"/>

View File

@ -0,0 +1,36 @@
/*
* Copyright (C) 2016-2020 Richard Hughes <richard@hughsie.com>
*
* SPDX-License-Identifier: LGPL-2.1+
*/
#pragma once
#include "fwupd-client.h"
#ifdef HAVE_GIO_UNIX
#include <gio/gunixinputstream.h>
#endif
#ifdef HAVE_GIO_UNIX
void fwupd_client_get_details_stream_async (FwupdClient *self,
GUnixInputStream *istr,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer callback_data);
void fwupd_client_install_stream_async (FwupdClient *self,
const gchar *device_id,
GUnixInputStream *istr,
const gchar *filename_hint,
FwupdInstallFlags install_flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer callback_data);
void fwupd_client_update_metadata_stream_async(FwupdClient *self,
const gchar *remote_id,
GUnixInputStream *istr,
GUnixInputStream *istr_sig,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer callback_data);
#endif

2009
libfwupd/fwupd-client-sync.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,170 @@
/*
* Copyright (C) 2016-2020 Richard Hughes <richard@hughsie.com>
*
* SPDX-License-Identifier: LGPL-2.1+
*/
#pragma once
#include "fwupd-client.h"
gboolean fwupd_client_connect (FwupdClient *self,
GCancellable *cancellable,
GError **error);
GPtrArray *fwupd_client_get_devices (FwupdClient *self,
GCancellable *cancellable,
GError **error);
GPtrArray *fwupd_client_get_history (FwupdClient *self,
GCancellable *cancellable,
GError **error);
GPtrArray *fwupd_client_get_releases (FwupdClient *self,
const gchar *device_id,
GCancellable *cancellable,
GError **error);
GPtrArray *fwupd_client_get_downgrades (FwupdClient *self,
const gchar *device_id,
GCancellable *cancellable,
GError **error);
GPtrArray *fwupd_client_get_upgrades (FwupdClient *self,
const gchar *device_id,
GCancellable *cancellable,
GError **error);
GPtrArray *fwupd_client_get_details (FwupdClient *self,
const gchar *filename,
GCancellable *cancellable,
GError **error);
GPtrArray *fwupd_client_get_details_bytes (FwupdClient *self,
GBytes *bytes,
GCancellable *cancellable,
GError **error);
gboolean fwupd_client_verify (FwupdClient *self,
const gchar *device_id,
GCancellable *cancellable,
GError **error);
gboolean fwupd_client_verify_update (FwupdClient *self,
const gchar *device_id,
GCancellable *cancellable,
GError **error);
gboolean fwupd_client_unlock (FwupdClient *self,
const gchar *device_id,
GCancellable *cancellable,
GError **error);
gboolean fwupd_client_modify_config (FwupdClient *self,
const gchar *key,
const gchar *value,
GCancellable *cancellable,
GError **error);
gboolean fwupd_client_activate (FwupdClient *self,
GCancellable *cancellable,
const gchar *device_id,
GError **error);
gboolean fwupd_client_clear_results (FwupdClient *self,
const gchar *device_id,
GCancellable *cancellable,
GError **error);
FwupdDevice *fwupd_client_get_results (FwupdClient *self,
const gchar *device_id,
GCancellable *cancellable,
GError **error);
GPtrArray *fwupd_client_get_host_security_attrs (FwupdClient *self,
GCancellable *cancellable,
GError **error);
FwupdDevice *fwupd_client_get_device_by_id (FwupdClient *self,
const gchar *device_id,
GCancellable *cancellable,
GError **error);
GPtrArray *fwupd_client_get_devices_by_guid (FwupdClient *self,
const gchar *guid,
GCancellable *cancellable,
GError **error);
gboolean fwupd_client_install (FwupdClient *self,
const gchar *device_id,
const gchar *filename,
FwupdInstallFlags install_flags,
GCancellable *cancellable,
GError **error);
gboolean fwupd_client_install_bytes (FwupdClient *self,
const gchar *device_id,
GBytes *bytes,
FwupdInstallFlags install_flags,
GCancellable *cancellable,
GError **error);
gboolean fwupd_client_install_release (FwupdClient *self,
FwupdDevice *device,
FwupdRelease *release,
FwupdInstallFlags install_flags,
GCancellable *cancellable,
GError **error);
gboolean fwupd_client_update_metadata (FwupdClient *self,
const gchar *remote_id,
const gchar *metadata_fn,
const gchar *signature_fn,
GCancellable *cancellable,
GError **error);
gboolean fwupd_client_update_metadata_bytes (FwupdClient *self,
const gchar *remote_id,
GBytes *metadata,
GBytes *signature,
GCancellable *cancellable,
GError **error);
gboolean fwupd_client_refresh_remote (FwupdClient *self,
FwupdRemote *remote,
GCancellable *cancellable,
GError **error);
gboolean fwupd_client_modify_remote (FwupdClient *self,
const gchar *remote_id,
const gchar *key,
const gchar *value,
GCancellable *cancellable,
GError **error);
gboolean fwupd_client_modify_device (FwupdClient *self,
const gchar *device_id,
const gchar *key,
const gchar *value,
GCancellable *cancellable,
GError **error);
GHashTable *fwupd_client_get_report_metadata (FwupdClient *self,
GCancellable *cancellable,
GError **error);
GPtrArray *fwupd_client_get_remotes (FwupdClient *self,
GCancellable *cancellable,
GError **error);
FwupdRemote *fwupd_client_get_remote_by_id (FwupdClient *self,
const gchar *remote_id,
GCancellable *cancellable,
GError **error);
gchar **fwupd_client_get_approved_firmware (FwupdClient *self,
GCancellable *cancellable,
GError **error);
gboolean fwupd_client_set_approved_firmware (FwupdClient *self,
gchar **checksums,
GCancellable *cancellable,
GError **error);
gchar **fwupd_client_get_blocked_firmware (FwupdClient *self,
GCancellable *cancellable,
GError **error);
gboolean fwupd_client_set_blocked_firmware (FwupdClient *self,
gchar **checksums,
GCancellable *cancellable,
GError **error);
gchar *fwupd_client_self_sign (FwupdClient *self,
const gchar *value,
FwupdSelfSignFlags flags,
GCancellable *cancellable,
GError **error);
gboolean fwupd_client_set_feature_flags (FwupdClient *self,
FwupdFeatureFlags feature_flags,
GCancellable *cancellable,
GError **error);
GBytes *fwupd_client_download_bytes (FwupdClient *self,
const gchar *url,
FwupdClientDownloadFlags flags,
GCancellable *cancellable,
GError **error);
GBytes *fwupd_client_upload_bytes (FwupdClient *self,
const gchar *url,
const gchar *payload,
const gchar *signature,
FwupdClientUploadFlags flags,
GCancellable *cancellable,
GError **error);

File diff suppressed because it is too large Load Diff

View File

@ -67,120 +67,215 @@ typedef enum {
} FwupdClientUploadFlags;
FwupdClient *fwupd_client_new (void);
gboolean fwupd_client_connect (FwupdClient *self,
void fwupd_client_connect_async (FwupdClient *self,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer callback_data);
gboolean fwupd_client_connect_finish (FwupdClient *self,
GAsyncResult *res,
GError **error);
GPtrArray *fwupd_client_get_devices (FwupdClient *self,
void fwupd_client_get_devices_async (FwupdClient *self,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer callback_data);
GPtrArray *fwupd_client_get_devices_finish (FwupdClient *self,
GAsyncResult *res,
GError **error);
GPtrArray *fwupd_client_get_history (FwupdClient *self,
void fwupd_client_get_history_async (FwupdClient *self,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer callback_data);
GPtrArray *fwupd_client_get_history_finish (FwupdClient *self,
GAsyncResult *res,
GError **error);
GPtrArray *fwupd_client_get_releases (FwupdClient *self,
void fwupd_client_get_releases_async (FwupdClient *self,
const gchar *device_id,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer callback_data);
GPtrArray *fwupd_client_get_releases_finish (FwupdClient *self,
GAsyncResult *res,
GError **error);
GPtrArray *fwupd_client_get_downgrades (FwupdClient *self,
void fwupd_client_get_downgrades_async (FwupdClient *self,
const gchar *device_id,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer callback_data);
GPtrArray *fwupd_client_get_downgrades_finish (FwupdClient *self,
GAsyncResult *res,
GError **error);
GPtrArray *fwupd_client_get_upgrades (FwupdClient *self,
void fwupd_client_get_upgrades_async (FwupdClient *self,
const gchar *device_id,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer callback_data);
GPtrArray *fwupd_client_get_upgrades_finish (FwupdClient *self,
GAsyncResult *res,
GError **error);
GPtrArray *fwupd_client_get_details (FwupdClient *self,
const gchar *filename,
void fwupd_client_get_details_bytes_async (FwupdClient *self,
GBytes *bytes,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer callback_data);
GPtrArray *fwupd_client_get_details_bytes_finish (FwupdClient *self,
GAsyncResult *res,
GError **error);
gboolean fwupd_client_verify (FwupdClient *self,
void fwupd_client_verify_async (FwupdClient *self,
const gchar *device_id,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer callback_data);
gboolean fwupd_client_verify_finish (FwupdClient *self,
GAsyncResult *res,
GError **error);
gboolean fwupd_client_verify_update (FwupdClient *self,
void fwupd_client_verify_update_async (FwupdClient *self,
const gchar *device_id,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer callback_data);
gboolean fwupd_client_verify_update_finish (FwupdClient *self,
GAsyncResult *res,
GError **error);
gboolean fwupd_client_unlock (FwupdClient *self,
void fwupd_client_unlock_async (FwupdClient *self,
const gchar *device_id,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer callback_data);
gboolean fwupd_client_unlock_finish (FwupdClient *self,
GAsyncResult *res,
GError **error);
gboolean fwupd_client_modify_config (FwupdClient *self,
void fwupd_client_modify_config_async (FwupdClient *self,
const gchar *key,
const gchar *value,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer callback_data);
gboolean fwupd_client_modify_config_finish (FwupdClient *self,
GAsyncResult *res,
GError **error);
gboolean fwupd_client_activate (FwupdClient *self,
GCancellable *cancellable,
const gchar *device_id,
GError **error);
gboolean fwupd_client_clear_results (FwupdClient *self,
void fwupd_client_activate_async (FwupdClient *self,
const gchar *device_id,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer callback_data);
gboolean fwupd_client_activate_finish (FwupdClient *self,
GAsyncResult *res,
GError **error);
FwupdDevice *fwupd_client_get_results (FwupdClient *self,
void fwupd_client_clear_results_async (FwupdClient *self,
const gchar *device_id,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer callback_data);
gboolean fwupd_client_clear_results_finish (FwupdClient *self,
GAsyncResult *res,
GError **error);
GPtrArray *fwupd_client_get_host_security_attrs (FwupdClient *self,
GCancellable *cancellable,
GError **error);
FwupdDevice *fwupd_client_get_device_by_id (FwupdClient *self,
void fwupd_client_get_results_async (FwupdClient *self,
const gchar *device_id,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer callback_data);
FwupdDevice *fwupd_client_get_results_finish (FwupdClient *self,
GAsyncResult *res,
GError **error);
GPtrArray *fwupd_client_get_devices_by_guid (FwupdClient *self,
void fwupd_client_get_host_security_attrs_async(FwupdClient *self,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer callback_data);
GPtrArray *fwupd_client_get_host_security_attrs_finish(FwupdClient *self,
GAsyncResult *res,
GError **error);
void fwupd_client_get_device_by_id_async (FwupdClient *self,
const gchar *device_id,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer callback_data);
FwupdDevice *fwupd_client_get_device_by_id_finish (FwupdClient *self,
GAsyncResult *res,
GError **error);
void fwupd_client_get_devices_by_guid_async (FwupdClient *self,
const gchar *guid,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer callback_data);
GPtrArray *fwupd_client_get_devices_by_guid_finish (FwupdClient *self,
GAsyncResult *res,
GError **error);
gboolean fwupd_client_install (FwupdClient *self,
void fwupd_client_install_async (FwupdClient *self,
const gchar *device_id,
const gchar *filename,
FwupdInstallFlags install_flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer callback_data);
gboolean fwupd_client_install_finish (FwupdClient *self,
GAsyncResult *res,
GError **error);
gboolean fwupd_client_install_bytes (FwupdClient *self,
void fwupd_client_install_bytes_async (FwupdClient *self,
const gchar *device_id,
GBytes *bytes,
FwupdInstallFlags install_flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer callback_data);
gboolean fwupd_client_install_bytes_finish (FwupdClient *self,
GAsyncResult *res,
GError **error);
gboolean fwupd_client_install_release (FwupdClient *self,
void fwupd_client_install_release_async (FwupdClient *self,
FwupdDevice *device,
FwupdRelease *release,
FwupdInstallFlags install_flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer callback_data);
gboolean fwupd_client_install_release_finish (FwupdClient *self,
GAsyncResult *res,
GError **error);
gboolean fwupd_client_update_metadata (FwupdClient *self,
const gchar *remote_id,
const gchar *metadata_fn,
const gchar *signature_fn,
GCancellable *cancellable,
GError **error);
gboolean fwupd_client_update_metadata_bytes (FwupdClient *self,
void fwupd_client_update_metadata_bytes_async (FwupdClient *self,
const gchar *remote_id,
GBytes *metadata,
GBytes *signature,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer callback_data);
gboolean fwupd_client_update_metadata_bytes_finish (FwupdClient *self,
GAsyncResult *res,
GError **error);
gboolean fwupd_client_refresh_remote (FwupdClient *self,
void fwupd_client_refresh_remote_async (FwupdClient *self,
FwupdRemote *remote,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer callback_data);
gboolean fwupd_client_refresh_remote_finish (FwupdClient *self,
GAsyncResult *res,
GError **error);
gboolean fwupd_client_modify_remote (FwupdClient *self,
void fwupd_client_modify_remote_async (FwupdClient *self,
const gchar *remote_id,
const gchar *key,
const gchar *value,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer callback_data);
gboolean fwupd_client_modify_remote_finish (FwupdClient *self,
GAsyncResult *res,
GError **error);
gboolean fwupd_client_modify_device (FwupdClient *self,
void fwupd_client_modify_device_async (FwupdClient *self,
const gchar *device_id,
const gchar *key,
const gchar *value,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer callback_data);
gboolean fwupd_client_modify_device_finish (FwupdClient *self,
GAsyncResult *res,
GError **error);
GHashTable *fwupd_client_get_report_metadata (FwupdClient *self,
void fwupd_client_get_report_metadata_async (FwupdClient *self,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer callback_data);
GHashTable *fwupd_client_get_report_metadata_finish(FwupdClient *self,
GAsyncResult *res,
GError **error);
FwupdStatus fwupd_client_get_status (FwupdClient *self);
gboolean fwupd_client_get_tainted (FwupdClient *self);
gboolean fwupd_client_get_daemon_interactive (FwupdClient *self);
@ -190,53 +285,92 @@ const gchar *fwupd_client_get_host_product (FwupdClient *self);
const gchar *fwupd_client_get_host_machine_id (FwupdClient *self);
const gchar *fwupd_client_get_host_security_id (FwupdClient *self);
GPtrArray *fwupd_client_get_remotes (FwupdClient *self,
void fwupd_client_get_remotes_async (FwupdClient *self,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer callback_data);
GPtrArray *fwupd_client_get_remotes_finish (FwupdClient *self,
GAsyncResult *res,
GError **error);
FwupdRemote *fwupd_client_get_remote_by_id (FwupdClient *self,
void fwupd_client_get_remote_by_id_async (FwupdClient *self,
const gchar *remote_id,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer callback_data);
FwupdRemote *fwupd_client_get_remote_by_id_finish (FwupdClient *self,
GAsyncResult *res,
GError **error);
gchar **fwupd_client_get_approved_firmware (FwupdClient *self,
void fwupd_client_get_approved_firmware_async(FwupdClient *self,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer callback_data);
GPtrArray *fwupd_client_get_approved_firmware_finish(FwupdClient *self,
GAsyncResult *res,
GError **error);
gboolean fwupd_client_set_approved_firmware (FwupdClient *self,
gchar **checksums,
void fwupd_client_set_approved_firmware_async (FwupdClient *self,
GPtrArray *checksums,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer callback_data);
gboolean fwupd_client_set_approved_firmware_finish (FwupdClient *self,
GAsyncResult *res,
GError **error);
gchar **fwupd_client_get_blocked_firmware (FwupdClient *self,
void fwupd_client_get_blocked_firmware_async(FwupdClient *self,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer callback_data);
GPtrArray *fwupd_client_get_blocked_firmware_finish(FwupdClient *self,
GAsyncResult *res,
GError **error);
gboolean fwupd_client_set_blocked_firmware (FwupdClient *self,
gchar **checksums,
void fwupd_client_set_blocked_firmware_async (FwupdClient *self,
GPtrArray *checksums,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer callback_data);
gboolean fwupd_client_set_blocked_firmware_finish (FwupdClient *self,
GAsyncResult *res,
GError **error);
gchar *fwupd_client_self_sign (FwupdClient *self,
void fwupd_client_self_sign_async (FwupdClient *self,
const gchar *value,
FwupdSelfSignFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer callback_data);
gchar *fwupd_client_self_sign_finish (FwupdClient *self,
GAsyncResult *res,
GError **error);
gboolean fwupd_client_set_feature_flags (FwupdClient *self,
void fwupd_client_set_feature_flags_async (FwupdClient *self,
FwupdFeatureFlags feature_flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer callback_data);
gboolean fwupd_client_set_feature_flags_finish (FwupdClient *self,
GAsyncResult *res,
GError **error);
void fwupd_client_set_user_agent (FwupdClient *self,
const gchar *user_agent);
void fwupd_client_set_user_agent_for_package(FwupdClient *self,
const gchar *package_name,
const gchar *package_version);
GBytes *fwupd_client_download_bytes (FwupdClient *self,
void fwupd_client_download_bytes_async (FwupdClient *self,
const gchar *url,
FwupdClientDownloadFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer callback_data);
GBytes *fwupd_client_download_bytes_finish (FwupdClient *self,
GAsyncResult *res,
GError **error);
GBytes *fwupd_client_upload_bytes (FwupdClient *self,
void fwupd_client_upload_bytes_async (FwupdClient *self,
const gchar *url,
const gchar *payload,
const gchar *signature,
FwupdClientUploadFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer callback_data);
GBytes *fwupd_client_upload_bytes_finish (FwupdClient *self,
GAsyncResult *res,
GError **error);
gboolean fwupd_client_ensure_networking (FwupdClient *self,
GError **error);

View File

@ -6,7 +6,7 @@
#pragma once
#include <glib.h>
#include <gio/gio.h>
#ifdef HAVE_GIO_UNIX
#include <gio/gunixinputstream.h>
@ -21,6 +21,14 @@ GVariant *fwupd_hash_kv_to_variant (GHashTable *hash);
GHashTable *fwupd_variant_to_hash_kv (GVariant *dict);
gchar *fwupd_build_user_agent_system (void);
void fwupd_input_stream_read_bytes_async (GInputStream *stream,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer callback_data);
GBytes *fwupd_input_stream_read_bytes_finish (GInputStream *stream,
GAsyncResult *res,
GError **error);
#ifdef HAVE_GIO_UNIX
GUnixInputStream *fwupd_unix_input_stream_from_bytes (GBytes *bytes,
GError **error);

View File

@ -941,6 +941,96 @@ fwupd_variant_to_hash_kv (GVariant *dict)
return hash;
}
static void
fwupd_input_stream_read_bytes_cb (GObject *source,
GAsyncResult *res,
gpointer user_data)
{
GByteArray *bufarr;
GInputStream *stream = G_INPUT_STREAM (source);
g_autoptr(GBytes) bytes = NULL;
g_autoptr(GError) error = NULL;
g_autoptr(GTask) task = G_TASK (user_data);
#if GLIB_CHECK_VERSION(2, 64, 0)
guint8 *buf;
gsize bufsz = 0;
#endif
/* read buf */
bytes = g_input_stream_read_bytes_finish (stream, res, &error);
if (bytes == NULL) {
g_task_return_error (task, g_steal_pointer (&error));
return;
}
/* add bytes to buffer */
bufarr = g_task_get_task_data (task);
if (g_bytes_get_size (bytes) > 0) {
GCancellable *cancellable = g_task_get_cancellable (task);
g_debug ("add %u", (guint) g_bytes_get_size (bytes));
g_byte_array_append (bufarr,
g_bytes_get_data (bytes, NULL),
g_bytes_get_size (bytes));
g_input_stream_read_bytes_async (g_steal_pointer (&stream),
256 * 1024, /* bigger chunk */
G_PRIORITY_DEFAULT,
cancellable,
fwupd_input_stream_read_bytes_cb,
g_steal_pointer (&task));
return;
}
/* success */
#if GLIB_CHECK_VERSION(2, 64, 0)
buf = g_byte_array_steal (bufarr, &bufsz);
g_task_return_pointer (task,
g_bytes_new_take (buf, bufsz),
(GDestroyNotify) g_bytes_unref);
#else
g_task_return_pointer (task,
g_bytes_new (bufarr->data, bufarr->len),
(GDestroyNotify) g_bytes_unref);
#endif
}
/**
* fwupd_input_stream_read_bytes_async: (skip):
**/
void
fwupd_input_stream_read_bytes_async (GInputStream *stream,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer callback_data)
{
g_autoptr(GTask) task = NULL;
g_return_if_fail (G_IS_INPUT_STREAM (stream));
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
task = g_task_new (stream, cancellable, callback, callback_data);
g_task_set_task_data (task, g_byte_array_new (), (GDestroyNotify) g_byte_array_unref);
g_input_stream_read_bytes_async (stream,
64 * 1024, /* small */
G_PRIORITY_DEFAULT,
cancellable,
fwupd_input_stream_read_bytes_cb,
g_steal_pointer (&task));
}
/**
* fwupd_input_stream_read_bytes_finish: (skip):
**/
GBytes *
fwupd_input_stream_read_bytes_finish (GInputStream *stream,
GAsyncResult *res,
GError **error)
{
g_return_val_if_fail (G_IS_INPUT_STREAM (stream), NULL);
g_return_val_if_fail (g_task_is_valid (res, stream), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
return g_task_propagate_pointer (G_TASK(res), error);
}
#ifdef HAVE_GIO_UNIX
/**
* fwupd_unix_input_stream_from_bytes: (skip):

View File

@ -1098,7 +1098,6 @@ fwupd_device_get_created (FwupdDevice *device)
return priv->created;
}
/**
* fwupd_device_set_created:
* @device: A #FwupdDevice

View File

@ -12,6 +12,7 @@
#endif
#include "fwupd-client.h"
#include "fwupd-client-sync.h"
#include "fwupd-common.h"
#include "fwupd-enums.h"
#include "fwupd-error.h"

View File

@ -14,6 +14,7 @@
#define __FWUPD_H_INSIDE__
#include <libfwupd/fwupd-client.h>
#include <libfwupd/fwupd-client-sync.h>
#include <libfwupd/fwupd-common.h>
#include <libfwupd/fwupd-device.h>
#include <libfwupd/fwupd-enums.h>

View File

@ -478,9 +478,80 @@ LIBFWUPD_1.4.6 {
LIBFWUPD_1.5.0 {
global:
fwupd_client_activate_async;
fwupd_client_activate_finish;
fwupd_client_clear_results_async;
fwupd_client_clear_results_finish;
fwupd_client_connect_async;
fwupd_client_connect_finish;
fwupd_client_download_bytes_async;
fwupd_client_download_bytes_finish;
fwupd_client_get_approved_firmware_async;
fwupd_client_get_approved_firmware_finish;
fwupd_client_get_blocked_firmware_async;
fwupd_client_get_blocked_firmware_finish;
fwupd_client_get_details_bytes;
fwupd_client_get_details_bytes_async;
fwupd_client_get_details_bytes_finish;
fwupd_client_get_device_by_id_async;
fwupd_client_get_device_by_id_finish;
fwupd_client_get_devices_async;
fwupd_client_get_devices_by_guid_async;
fwupd_client_get_devices_by_guid_finish;
fwupd_client_get_devices_finish;
fwupd_client_get_downgrades_async;
fwupd_client_get_downgrades_finish;
fwupd_client_get_history_async;
fwupd_client_get_history_finish;
fwupd_client_get_host_security_attrs;
fwupd_client_get_host_security_attrs_async;
fwupd_client_get_host_security_attrs_finish;
fwupd_client_get_host_security_id;
fwupd_client_get_releases_async;
fwupd_client_get_releases_finish;
fwupd_client_get_remote_by_id_async;
fwupd_client_get_remote_by_id_finish;
fwupd_client_get_remotes_async;
fwupd_client_get_remotes_finish;
fwupd_client_get_report_metadata;
fwupd_client_get_report_metadata_async;
fwupd_client_get_report_metadata_finish;
fwupd_client_get_results_async;
fwupd_client_get_results_finish;
fwupd_client_get_upgrades_async;
fwupd_client_get_upgrades_finish;
fwupd_client_install_async;
fwupd_client_install_bytes_async;
fwupd_client_install_bytes_finish;
fwupd_client_install_finish;
fwupd_client_install_release_async;
fwupd_client_install_release_finish;
fwupd_client_modify_config_async;
fwupd_client_modify_config_finish;
fwupd_client_modify_device_async;
fwupd_client_modify_device_finish;
fwupd_client_modify_remote_async;
fwupd_client_modify_remote_finish;
fwupd_client_refresh_remote_async;
fwupd_client_refresh_remote_finish;
fwupd_client_self_sign_async;
fwupd_client_self_sign_finish;
fwupd_client_set_approved_firmware_async;
fwupd_client_set_approved_firmware_finish;
fwupd_client_set_blocked_firmware_async;
fwupd_client_set_blocked_firmware_finish;
fwupd_client_set_feature_flags_async;
fwupd_client_set_feature_flags_finish;
fwupd_client_unlock_async;
fwupd_client_unlock_finish;
fwupd_client_update_metadata_bytes_async;
fwupd_client_update_metadata_bytes_finish;
fwupd_client_upload_bytes_async;
fwupd_client_upload_bytes_finish;
fwupd_client_verify_async;
fwupd_client_verify_finish;
fwupd_client_verify_update_async;
fwupd_client_verify_update_finish;
fwupd_remote_get_automatic_security_reports;
fwupd_remote_get_security_report_uri;
fwupd_security_attr_add_flag;

View File

@ -15,6 +15,7 @@ install_headers(
install_headers([
'fwupd-client.h',
'fwupd-client-sync.h',
'fwupd-common.h',
'fwupd-deprecated.h',
'fwupd-device.h',
@ -34,6 +35,7 @@ fwupd = shared_library(
'fwupd',
sources : [
'fwupd-client.c',
'fwupd-client-sync.c',
'fwupd-common.c',
'fwupd-device.c',
'fwupd-enums.c',
@ -76,6 +78,8 @@ if get_option('introspection')
sources : [
'fwupd-client.c',
'fwupd-client.h',
'fwupd-client-sync.c',
'fwupd-client-sync.h',
'fwupd-common.c',
'fwupd-common.h',
'fwupd-common-private.h',