mirror of
https://git.proxmox.com/git/fwupd
synced 2025-05-15 07:24:46 +00:00
Add a new daemon configuration option to control EnumerateAllDevices
For plugins that are configured to only enumerate devices supported by metadata this will allow showing them in all contexts Fixes: #1877
This commit is contained in:
parent
80d9b7450c
commit
4fa95a7b51
@ -25,3 +25,6 @@ VerboseDomains=
|
||||
|
||||
# Update the message of the day (MOTD) on device and metadata changes
|
||||
UpdateMotd=true
|
||||
|
||||
# For some plugins, enumerate only devices supported by metadata
|
||||
EnumerateAllDevices=true
|
||||
|
@ -34,6 +34,7 @@ struct _FuConfig
|
||||
guint idle_timeout;
|
||||
gchar *config_file;
|
||||
gboolean update_motd;
|
||||
gboolean enumerate_all_devices;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (FuConfig, fu_config, G_TYPE_OBJECT)
|
||||
@ -55,6 +56,7 @@ fu_config_reload (FuConfig *self, GError **error)
|
||||
g_auto(GStrv) plugins = NULL;
|
||||
g_autofree gchar *domains = NULL;
|
||||
g_autoptr(GKeyFile) keyfile = g_key_file_new ();
|
||||
g_autoptr(GError) error_enumerate_all = NULL;
|
||||
|
||||
g_debug ("loading config values from %s", self->config_file);
|
||||
if (!g_key_file_load_from_file (keyfile, self->config_file,
|
||||
@ -133,6 +135,17 @@ fu_config_reload (FuConfig *self, GError **error)
|
||||
"UpdateMotd",
|
||||
NULL);
|
||||
|
||||
/* whether to only show supported devices for some plugins */
|
||||
self->enumerate_all_devices = g_key_file_get_boolean (keyfile,
|
||||
"fwupd",
|
||||
"EnumerateAllDevices",
|
||||
&error_enumerate_all);
|
||||
/* if error parsing or missing, we want to default to true */
|
||||
if (!self->enumerate_all_devices && error_enumerate_all != NULL) {
|
||||
g_debug ("failed to read EnumerateAllDevices key: %s", error_enumerate_all->message);
|
||||
self->enumerate_all_devices = TRUE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -237,6 +250,13 @@ fu_config_get_update_motd (FuConfig *self)
|
||||
return self->update_motd;
|
||||
}
|
||||
|
||||
gboolean
|
||||
fu_config_get_enumerate_all_devices (FuConfig *self)
|
||||
{
|
||||
g_return_val_if_fail (FU_IS_CONFIG (self), FALSE);
|
||||
return self->enumerate_all_devices;
|
||||
}
|
||||
|
||||
static void
|
||||
fu_config_class_init (FuConfigClass *klass)
|
||||
{
|
||||
|
@ -27,3 +27,4 @@ GPtrArray *fu_config_get_blacklist_devices (FuConfig *self);
|
||||
GPtrArray *fu_config_get_blacklist_plugins (FuConfig *self);
|
||||
GPtrArray *fu_config_get_approved_firmware (FuConfig *self);
|
||||
gboolean fu_config_get_update_motd (FuConfig *self);
|
||||
gboolean fu_config_get_enumerate_all_devices (FuConfig *self);
|
||||
|
@ -501,6 +501,7 @@ fu_engine_modify_config (FuEngine *self, const gchar *key, const gchar *value, G
|
||||
"IdleTimeout",
|
||||
"VerboseDomains",
|
||||
"UpdateMotd",
|
||||
"EnumerateAllDevices",
|
||||
NULL };
|
||||
|
||||
g_return_val_if_fail (FU_IS_ENGINE (self), FALSE);
|
||||
@ -4880,6 +4881,10 @@ fu_engine_plugin_check_supported_cb (FuPlugin *plugin, const gchar *guid, FuEngi
|
||||
{
|
||||
g_autoptr(XbNode) n = NULL;
|
||||
g_autofree gchar *xpath = NULL;
|
||||
|
||||
if (fu_config_get_enumerate_all_devices (self->config))
|
||||
return TRUE;
|
||||
|
||||
xpath = g_strdup_printf ("components/component/"
|
||||
"provides/firmware[@type='flashed'][text()='%s']",
|
||||
guid);
|
||||
|
Loading…
Reference in New Issue
Block a user