mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-15 23:29:19 +00:00
Remove the unused fu_plugin_recoldplug()
This commit is contained in:
parent
250f30ceb9
commit
4ae7b5e837
@ -56,9 +56,6 @@ gboolean fu_plugin_runner_coldplug_prepare (FuPlugin *self,
|
||||
gboolean fu_plugin_runner_coldplug_cleanup (FuPlugin *self,
|
||||
GError **error)
|
||||
G_GNUC_WARN_UNUSED_RESULT;
|
||||
gboolean fu_plugin_runner_recoldplug (FuPlugin *self,
|
||||
GError **error)
|
||||
G_GNUC_WARN_UNUSED_RESULT;
|
||||
gboolean fu_plugin_runner_update_prepare (FuPlugin *self,
|
||||
FwupdInstallFlags flags,
|
||||
FuDevice *device,
|
||||
|
@ -100,17 +100,6 @@ gboolean fu_plugin_coldplug_prepare (FuPlugin *plugin,
|
||||
**/
|
||||
gboolean fu_plugin_coldplug_cleanup (FuPlugin *plugin,
|
||||
GError **error);
|
||||
/**
|
||||
* fu_plugin_recoldplug:
|
||||
* @plugin: A #FuPlugin
|
||||
* @error: A #GError or NULL
|
||||
*
|
||||
* Re-runs the coldplug routine for devices.
|
||||
*
|
||||
* Since: 1.0.4
|
||||
**/
|
||||
gboolean fu_plugin_recoldplug (FuPlugin *plugin,
|
||||
GError **error);
|
||||
/**
|
||||
* fu_plugin_update:
|
||||
* @plugin: A #FuPlugin
|
||||
|
@ -59,7 +59,6 @@ enum {
|
||||
SIGNAL_DEVICE_REMOVED,
|
||||
SIGNAL_DEVICE_REGISTER,
|
||||
SIGNAL_RULES_CHANGED,
|
||||
SIGNAL_RECOLDPLUG,
|
||||
SIGNAL_SET_COLDPLUG_DELAY,
|
||||
SIGNAL_CHECK_SUPPORTED,
|
||||
SIGNAL_ADD_FIRMWARE_GTYPE,
|
||||
@ -559,22 +558,6 @@ fu_plugin_device_remove (FuPlugin *self, FuDevice *device)
|
||||
g_signal_emit (self, signals[SIGNAL_DEVICE_REMOVED], 0, device);
|
||||
}
|
||||
|
||||
/**
|
||||
* fu_plugin_request_recoldplug:
|
||||
* @self: A #FuPlugin
|
||||
*
|
||||
* Ask all the plugins to coldplug all devices, which will include the prepare()
|
||||
* and cleanup() phases. Duplicate devices added will be ignored.
|
||||
*
|
||||
* Since: 0.8.0
|
||||
**/
|
||||
void
|
||||
fu_plugin_request_recoldplug (FuPlugin *self)
|
||||
{
|
||||
g_return_if_fail (FU_IS_PLUGIN (self));
|
||||
g_signal_emit (self, signals[SIGNAL_RECOLDPLUG], 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* fu_plugin_security_changed:
|
||||
* @self: A #FuPlugin
|
||||
@ -1345,54 +1328,6 @@ fu_plugin_runner_coldplug (FuPlugin *self, GError **error)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* fu_plugin_runner_recoldplug:
|
||||
* @self: a #FuPlugin
|
||||
* @error: a #GError or NULL
|
||||
*
|
||||
* Runs the recoldplug routine for the plugin
|
||||
*
|
||||
* Returns: #TRUE for success, #FALSE for failure
|
||||
*
|
||||
* Since: 1.0.4
|
||||
**/
|
||||
gboolean
|
||||
fu_plugin_runner_recoldplug (FuPlugin *self, GError **error)
|
||||
{
|
||||
FuPluginPrivate *priv = GET_PRIVATE (self);
|
||||
FuPluginStartupFunc func = NULL;
|
||||
g_autoptr(GError) error_local = NULL;
|
||||
|
||||
/* not enabled */
|
||||
if (fu_plugin_has_flag (self, FWUPD_PLUGIN_FLAG_DISABLED))
|
||||
return TRUE;
|
||||
|
||||
/* no object loaded */
|
||||
if (priv->module == NULL)
|
||||
return TRUE;
|
||||
|
||||
/* optional */
|
||||
g_module_symbol (priv->module, "fu_plugin_recoldplug", (gpointer *) &func);
|
||||
if (func == NULL)
|
||||
return TRUE;
|
||||
g_debug ("recoldplug(%s)", fu_plugin_get_name (self));
|
||||
if (!func (self, &error_local)) {
|
||||
if (error_local == NULL) {
|
||||
g_critical ("unset plugin error in recoldplug(%s)",
|
||||
fu_plugin_get_name (self));
|
||||
g_set_error_literal (&error_local,
|
||||
FWUPD_ERROR,
|
||||
FWUPD_ERROR_INTERNAL,
|
||||
"unspecified error");
|
||||
}
|
||||
g_propagate_prefixed_error (error, g_steal_pointer (&error_local),
|
||||
"failed to recoldplug using %s: ",
|
||||
fu_plugin_get_name (self));
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* fu_plugin_runner_coldplug_prepare:
|
||||
* @self: a #FuPlugin
|
||||
@ -2735,12 +2670,6 @@ fu_plugin_class_init (FuPluginClass *klass)
|
||||
G_STRUCT_OFFSET (FuPluginClass, device_register),
|
||||
NULL, NULL, g_cclosure_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE, 1, FU_TYPE_DEVICE);
|
||||
signals[SIGNAL_RECOLDPLUG] =
|
||||
g_signal_new ("recoldplug",
|
||||
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (FuPluginClass, recoldplug),
|
||||
NULL, NULL, g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
signals[SIGNAL_SECURITY_CHANGED] =
|
||||
g_signal_new ("security-changed",
|
||||
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
|
||||
|
@ -47,7 +47,6 @@ struct _FuPluginClass
|
||||
FwupdStatus status);
|
||||
void (* percentage_changed) (FuPlugin *self,
|
||||
guint percentage);
|
||||
void (* recoldplug) (FuPlugin *self);
|
||||
void (* set_coldplug_delay) (FuPlugin *self,
|
||||
guint duration);
|
||||
void (* device_register) (FuPlugin *self,
|
||||
@ -113,7 +112,6 @@ void fu_plugin_device_remove (FuPlugin *self,
|
||||
FuDevice *device);
|
||||
void fu_plugin_device_register (FuPlugin *self,
|
||||
FuDevice *device);
|
||||
void fu_plugin_request_recoldplug (FuPlugin *self);
|
||||
void fu_plugin_security_changed (FuPlugin *self);
|
||||
void fu_plugin_set_coldplug_delay (FuPlugin *self,
|
||||
guint duration);
|
||||
|
@ -45,7 +45,6 @@ LIBFWUPDPLUGIN_0.8.0 {
|
||||
fu_plugin_get_type;
|
||||
fu_plugin_new;
|
||||
fu_plugin_open;
|
||||
fu_plugin_request_recoldplug;
|
||||
fu_plugin_runner_clear_results;
|
||||
fu_plugin_runner_coldplug;
|
||||
fu_plugin_runner_coldplug_cleanup;
|
||||
@ -182,7 +181,6 @@ LIBFWUPDPLUGIN_1.0.4 {
|
||||
global:
|
||||
fu_plugin_add_report_metadata;
|
||||
fu_plugin_get_report_metadata;
|
||||
fu_plugin_runner_recoldplug;
|
||||
local: *;
|
||||
} LIBFWUPDPLUGIN_1.0.3;
|
||||
|
||||
|
@ -93,17 +93,6 @@ fu_backend_coldplug (FuBackend *self, GError **error)
|
||||
return klass->coldplug (self, error);
|
||||
}
|
||||
|
||||
gboolean
|
||||
fu_backend_recoldplug (FuBackend *self, GError **error)
|
||||
{
|
||||
FuBackendClass *klass = FU_BACKEND_GET_CLASS (self);
|
||||
g_return_val_if_fail (FU_IS_BACKEND (self), FALSE);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
if (klass->recoldplug == NULL)
|
||||
return TRUE;
|
||||
return klass->recoldplug (self, error);
|
||||
}
|
||||
|
||||
const gchar *
|
||||
fu_backend_get_name (FuBackend *self)
|
||||
{
|
||||
|
@ -20,9 +20,6 @@ struct _FuBackendClass
|
||||
gboolean (*coldplug) (FuBackend *self,
|
||||
GError **error)
|
||||
G_GNUC_WARN_UNUSED_RESULT;
|
||||
gboolean (*recoldplug) (FuBackend *self,
|
||||
GError **error)
|
||||
G_GNUC_WARN_UNUSED_RESULT;
|
||||
};
|
||||
|
||||
const gchar *fu_backend_get_name (FuBackend *self);
|
||||
@ -37,9 +34,6 @@ gboolean fu_backend_setup (FuBackend *self,
|
||||
gboolean fu_backend_coldplug (FuBackend *self,
|
||||
GError **error)
|
||||
G_GNUC_WARN_UNUSED_RESULT;
|
||||
gboolean fu_backend_recoldplug (FuBackend *self,
|
||||
GError **error)
|
||||
G_GNUC_WARN_UNUSED_RESULT;
|
||||
void fu_backend_device_added (FuBackend *self,
|
||||
FuDevice *device);
|
||||
void fu_backend_device_removed (FuBackend *self,
|
||||
|
@ -231,7 +231,6 @@ fu_bluez_backend_class_init (FuBluezBackendClass *klass)
|
||||
object_class->finalize = fu_bluez_backend_finalize;
|
||||
klass_backend->setup = fu_bluez_backend_setup;
|
||||
klass_backend->coldplug = fu_bluez_backend_coldplug;
|
||||
klass_backend->recoldplug = fu_bluez_backend_coldplug;
|
||||
}
|
||||
|
||||
FuBackend *
|
||||
|
@ -94,7 +94,6 @@ struct _FuEngine
|
||||
FuHistory *history;
|
||||
FuIdle *idle;
|
||||
XbSilo *silo;
|
||||
gboolean coldplug_running;
|
||||
guint coldplug_id;
|
||||
guint coldplug_delay;
|
||||
FuPluginList *plugin_list;
|
||||
@ -5154,14 +5153,11 @@ fu_engine_plugins_setup (FuEngine *self)
|
||||
}
|
||||
|
||||
static void
|
||||
fu_engine_plugins_coldplug (FuEngine *self, gboolean is_recoldplug)
|
||||
fu_engine_plugins_coldplug (FuEngine *self)
|
||||
{
|
||||
GPtrArray *plugins;
|
||||
g_autoptr(GString) str = g_string_new (NULL);
|
||||
|
||||
/* don't allow coldplug to be scheduled when in coldplug */
|
||||
self->coldplug_running = TRUE;
|
||||
|
||||
/* prepare */
|
||||
plugins = fu_plugin_list_get_all (self->plugin_list);
|
||||
for (guint i = 0; i < plugins->len; i++) {
|
||||
@ -5181,15 +5177,10 @@ fu_engine_plugins_coldplug (FuEngine *self, gboolean is_recoldplug)
|
||||
for (guint i = 0; i < plugins->len; i++) {
|
||||
g_autoptr(GError) error = NULL;
|
||||
FuPlugin *plugin = g_ptr_array_index (plugins, i);
|
||||
if (is_recoldplug) {
|
||||
if (!fu_plugin_runner_recoldplug (plugin, &error))
|
||||
g_message ("failed recoldplug: %s", error->message);
|
||||
} else {
|
||||
if (!fu_plugin_runner_coldplug (plugin, &error)) {
|
||||
fu_plugin_add_flag (plugin, FWUPD_PLUGIN_FLAG_DISABLED);
|
||||
g_message ("disabling plugin because: %s",
|
||||
error->message);
|
||||
}
|
||||
if (!fu_plugin_runner_coldplug (plugin, &error)) {
|
||||
fu_plugin_add_flag (plugin, FWUPD_PLUGIN_FLAG_DISABLED);
|
||||
g_message ("disabling plugin because: %s",
|
||||
error->message);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5212,9 +5203,6 @@ fu_engine_plugins_coldplug (FuEngine *self, gboolean is_recoldplug)
|
||||
g_string_truncate (str, str->len - 2);
|
||||
g_debug ("using plugins: %s", str->str);
|
||||
}
|
||||
|
||||
/* we can recoldplug from this point on */
|
||||
self->coldplug_running = FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -5591,45 +5579,6 @@ fu_engine_plugin_device_removed_cb (FuPlugin *plugin,
|
||||
fu_engine_emit_changed (self);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
fu_engine_recoldplug_delay_cb (gpointer user_data)
|
||||
{
|
||||
FuEngine *self = (FuEngine *) user_data;
|
||||
g_debug ("recoldplugging");
|
||||
fu_engine_plugins_coldplug (self, TRUE);
|
||||
self->coldplug_id = 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
fu_engine_plugin_recoldplug_cb (FuPlugin *plugin, FuEngine *self)
|
||||
{
|
||||
if (self->coldplug_running) {
|
||||
g_warning ("coldplug already running, cannot recoldplug");
|
||||
return;
|
||||
}
|
||||
if (self->app_flags & FU_APP_FLAGS_NO_IDLE_SOURCES) {
|
||||
g_debug ("doing direct recoldplug");
|
||||
fu_engine_plugins_coldplug (self, TRUE);
|
||||
for (guint i = 0; i < self->backends->len; i++) {
|
||||
FuBackend *backend = g_ptr_array_index (self->backends, i);
|
||||
g_autoptr(GError) error_local = NULL;
|
||||
if (!fu_backend_get_enabled (backend))
|
||||
continue;
|
||||
if (!fu_backend_recoldplug (backend, &error_local)) {
|
||||
g_warning ("failed to recoldplug: %s",
|
||||
error_local->message);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
g_debug ("scheduling a recoldplug");
|
||||
if (self->coldplug_id != 0)
|
||||
g_source_remove (self->coldplug_id);
|
||||
self->coldplug_id = g_timeout_add (1500, fu_engine_recoldplug_delay_cb, self);
|
||||
}
|
||||
|
||||
static void
|
||||
fu_engine_plugin_set_coldplug_delay_cb (FuPlugin *plugin, guint duration, FuEngine *self)
|
||||
{
|
||||
@ -5955,9 +5904,6 @@ fu_engine_load_plugins (FuEngine *self, GError **error)
|
||||
g_signal_connect (plugin, "device-register",
|
||||
G_CALLBACK (fu_engine_plugin_device_register_cb),
|
||||
self);
|
||||
g_signal_connect (plugin, "recoldplug",
|
||||
G_CALLBACK (fu_engine_plugin_recoldplug_cb),
|
||||
self);
|
||||
g_signal_connect (plugin, "set-coldplug-delay",
|
||||
G_CALLBACK (fu_engine_plugin_set_coldplug_delay_cb),
|
||||
self);
|
||||
@ -6517,7 +6463,7 @@ fu_engine_load (FuEngine *self, FuEngineLoadFlags flags, GError **error)
|
||||
/* add devices */
|
||||
fu_engine_plugins_setup (self);
|
||||
if (flags & FU_ENGINE_LOAD_FLAG_COLDPLUG)
|
||||
fu_engine_plugins_coldplug (self, FALSE);
|
||||
fu_engine_plugins_coldplug (self);
|
||||
|
||||
/* coldplug backends */
|
||||
if (flags & FU_ENGINE_LOAD_FLAG_COLDPLUG) {
|
||||
|
@ -190,7 +190,6 @@ fu_udev_backend_class_init (FuUdevBackendClass *klass)
|
||||
FuBackendClass *klass_backend = FU_BACKEND_CLASS (klass);
|
||||
object_class->finalize = fu_udev_backend_finalize;
|
||||
klass_backend->coldplug = fu_udev_backend_coldplug;
|
||||
klass_backend->recoldplug = fu_udev_backend_coldplug;
|
||||
}
|
||||
|
||||
FuBackend *
|
||||
|
Loading…
Reference in New Issue
Block a user