mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-07 12:25:38 +00:00
Remove support for --ignore-power
by frontends
This functionality broke a number of releases ago as part of implementing device inhibition and was just noticed now. Instead of fixing it, the preference seems to be to remove the functionality as it exists today as inhibitions can happen for a number of reasons. To still allow people to override these power warnings (such as during development) add a new daemon configuration item that can be used. Fixes: #3778
This commit is contained in:
parent
907a60573d
commit
6ebccf1e1e
@ -58,7 +58,6 @@ _fwupdmgr_opts=(
|
|||||||
'--filter'
|
'--filter'
|
||||||
'--disable-ssl-strict'
|
'--disable-ssl-strict'
|
||||||
'--ipfs'
|
'--ipfs'
|
||||||
'--ignore-power'
|
|
||||||
'--json'
|
'--json'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -58,7 +58,6 @@ _fwupdtool_opts=(
|
|||||||
'--no-safety-check'
|
'--no-safety-check'
|
||||||
'--ignore-checksum'
|
'--ignore-checksum'
|
||||||
'--ignore-vid-pid'
|
'--ignore-vid-pid'
|
||||||
'--ignore-power'
|
|
||||||
)
|
)
|
||||||
|
|
||||||
_show_filters()
|
_show_filters()
|
||||||
|
@ -42,3 +42,7 @@ BlockedFirmware=
|
|||||||
#
|
#
|
||||||
# If unset or no schemes are listed, the default will be: file,https,http,ipfs
|
# If unset or no schemes are listed, the default will be: file,https,http,ipfs
|
||||||
UriSchemes=
|
UriSchemes=
|
||||||
|
|
||||||
|
# Ignore power levels of devices when running updates
|
||||||
|
IgnorePower=false
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
* Remove `fwupd_release_get_uri()` and `fwupd_release_set_uri()`
|
* Remove `fwupd_release_get_uri()` and `fwupd_release_set_uri()`
|
||||||
* Rename `fwupd_client_install_release2_async()` to `fwupd_client_install_release_async()`
|
* Rename `fwupd_client_install_release2_async()` to `fwupd_client_install_release_async()`
|
||||||
* Remove fwupd_device_set_protocol() and fwupd_device_get_protocol()
|
* Remove fwupd_device_set_protocol() and fwupd_device_get_protocol()
|
||||||
|
* Remove deprecated install flag `FWUPD_INSTALL_FLAG_IGNORE_POWER`
|
||||||
|
|
||||||
## Migration from Version 0.9.x
|
## Migration from Version 0.9.x
|
||||||
|
|
||||||
|
@ -743,6 +743,7 @@ typedef guint64 FwupdPluginFlags;
|
|||||||
* @FWUPD_INSTALL_FLAG_IGNORE_CHECKSUM: Ignore firmware CRCs and checksums
|
* @FWUPD_INSTALL_FLAG_IGNORE_CHECKSUM: Ignore firmware CRCs and checksums
|
||||||
* @FWUPD_INSTALL_FLAG_IGNORE_VID_PID: Ignore firmware vendor and project checks
|
* @FWUPD_INSTALL_FLAG_IGNORE_VID_PID: Ignore firmware vendor and project checks
|
||||||
* @FWUPD_INSTALL_FLAG_IGNORE_POWER: Ignore requirement of external power source
|
* @FWUPD_INSTALL_FLAG_IGNORE_POWER: Ignore requirement of external power source
|
||||||
|
*(Deprecated since 1.7.0)
|
||||||
* @FWUPD_INSTALL_FLAG_NO_SEARCH: Do not use heuristics when parsing the image
|
* @FWUPD_INSTALL_FLAG_NO_SEARCH: Do not use heuristics when parsing the image
|
||||||
*
|
*
|
||||||
* Flags to set when performing the firmware update or install.
|
* Flags to set when performing the firmware update or install.
|
||||||
|
@ -34,6 +34,7 @@ struct _FuConfig {
|
|||||||
gchar *config_file;
|
gchar *config_file;
|
||||||
gboolean update_motd;
|
gboolean update_motd;
|
||||||
gboolean enumerate_all_devices;
|
gboolean enumerate_all_devices;
|
||||||
|
gboolean ignore_power;
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_TYPE(FuConfig, fu_config, G_TYPE_OBJECT)
|
G_DEFINE_TYPE(FuConfig, fu_config, G_TYPE_OBJECT)
|
||||||
@ -58,6 +59,7 @@ fu_config_reload(FuConfig *self, GError **error)
|
|||||||
g_autofree gchar *domains = NULL;
|
g_autofree gchar *domains = NULL;
|
||||||
g_autoptr(GKeyFile) keyfile = g_key_file_new();
|
g_autoptr(GKeyFile) keyfile = g_key_file_new();
|
||||||
g_autoptr(GError) error_update_motd = NULL;
|
g_autoptr(GError) error_update_motd = NULL;
|
||||||
|
g_autoptr(GError) error_ignore_power = NULL;
|
||||||
g_autoptr(GError) error_enumerate_all = NULL;
|
g_autoptr(GError) error_enumerate_all = NULL;
|
||||||
|
|
||||||
if (g_file_test(self->config_file, G_FILE_TEST_EXISTS)) {
|
if (g_file_test(self->config_file, G_FILE_TEST_EXISTS)) {
|
||||||
@ -184,6 +186,14 @@ fu_config_reload(FuConfig *self, GError **error)
|
|||||||
self->enumerate_all_devices = TRUE;
|
self->enumerate_all_devices = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* whether to ignore power levels for updates */
|
||||||
|
self->ignore_power =
|
||||||
|
g_key_file_get_boolean(keyfile, "fwupd", "IgnorePower", &error_ignore_power);
|
||||||
|
if (!self->ignore_power && error_ignore_power != NULL) {
|
||||||
|
g_debug("failed to read IgnorePower key: %s", error_ignore_power->message);
|
||||||
|
self->ignore_power = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -306,6 +316,13 @@ fu_config_get_update_motd(FuConfig *self)
|
|||||||
return self->update_motd;
|
return self->update_motd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
fu_config_get_ignore_power(FuConfig *self)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail(FU_IS_CONFIG(self), FALSE);
|
||||||
|
return self->ignore_power;
|
||||||
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
fu_config_get_enumerate_all_devices(FuConfig *self)
|
fu_config_get_enumerate_all_devices(FuConfig *self)
|
||||||
{
|
{
|
||||||
|
@ -38,3 +38,5 @@ gboolean
|
|||||||
fu_config_get_update_motd(FuConfig *self);
|
fu_config_get_update_motd(FuConfig *self);
|
||||||
gboolean
|
gboolean
|
||||||
fu_config_get_enumerate_all_devices(FuConfig *self);
|
fu_config_get_enumerate_all_devices(FuConfig *self);
|
||||||
|
gboolean
|
||||||
|
fu_config_get_ignore_power(FuConfig *self);
|
||||||
|
@ -281,6 +281,9 @@ fu_engine_watch_device(FuEngine *self, FuDevice *device)
|
|||||||
static void
|
static void
|
||||||
fu_engine_ensure_device_battery_inhibit(FuEngine *self, FuDevice *device)
|
fu_engine_ensure_device_battery_inhibit(FuEngine *self, FuDevice *device)
|
||||||
{
|
{
|
||||||
|
if (fu_config_get_ignore_power(self->config))
|
||||||
|
return;
|
||||||
|
|
||||||
if (fu_device_has_flag(device, FWUPD_DEVICE_FLAG_REQUIRE_AC) &&
|
if (fu_device_has_flag(device, FWUPD_DEVICE_FLAG_REQUIRE_AC) &&
|
||||||
(fu_context_get_battery_state(self->ctx) == FU_BATTERY_STATE_DISCHARGING ||
|
(fu_context_get_battery_state(self->ctx) == FU_BATTERY_STATE_DISCHARGING ||
|
||||||
fu_context_get_battery_state(self->ctx) == FU_BATTERY_STATE_EMPTY)) {
|
fu_context_get_battery_state(self->ctx) == FU_BATTERY_STATE_EMPTY)) {
|
||||||
@ -2811,7 +2814,15 @@ fu_engine_device_check_power(FuEngine *self,
|
|||||||
FwupdInstallFlags flags,
|
FwupdInstallFlags flags,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
if (flags & FWUPD_INSTALL_FLAG_IGNORE_POWER)
|
if (flags & FWUPD_INSTALL_FLAG_IGNORE_POWER) {
|
||||||
|
g_autofree gchar *configdir = fu_common_get_path(FU_PATH_KIND_SYSCONFDIR_PKG);
|
||||||
|
g_autofree gchar *configfile = g_build_filename(configdir, "daemon.conf", NULL);
|
||||||
|
g_warning("Ignoring deprecated flag provided by client "
|
||||||
|
"'FWUPD_INSTALL_FLAG_IGNORE_POWER'. To ignore power levels, modify %s",
|
||||||
|
configfile);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fu_config_get_ignore_power(self->config))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
/* not charging */
|
/* not charging */
|
||||||
|
@ -1570,10 +1570,8 @@ fu_main_daemon_method_call(GDBusConnection *connection,
|
|||||||
g_variant_get_boolean(prop_value) == TRUE)
|
g_variant_get_boolean(prop_value) == TRUE)
|
||||||
helper->flags |= FWUPD_INSTALL_FLAG_ALLOW_BRANCH_SWITCH;
|
helper->flags |= FWUPD_INSTALL_FLAG_ALLOW_BRANCH_SWITCH;
|
||||||
if (g_strcmp0(prop_key, "force") == 0 &&
|
if (g_strcmp0(prop_key, "force") == 0 &&
|
||||||
g_variant_get_boolean(prop_value) == TRUE) {
|
g_variant_get_boolean(prop_value) == TRUE)
|
||||||
helper->flags |= FWUPD_INSTALL_FLAG_FORCE;
|
helper->flags |= FWUPD_INSTALL_FLAG_FORCE;
|
||||||
helper->flags |= FWUPD_INSTALL_FLAG_IGNORE_POWER;
|
|
||||||
}
|
|
||||||
if (g_strcmp0(prop_key, "ignore-power") == 0 &&
|
if (g_strcmp0(prop_key, "ignore-power") == 0 &&
|
||||||
g_variant_get_boolean(prop_value) == TRUE)
|
g_variant_get_boolean(prop_value) == TRUE)
|
||||||
helper->flags |= FWUPD_INSTALL_FLAG_IGNORE_POWER;
|
helper->flags |= FWUPD_INSTALL_FLAG_IGNORE_POWER;
|
||||||
|
@ -2907,7 +2907,6 @@ main(int argc, char *argv[])
|
|||||||
gboolean ret;
|
gboolean ret;
|
||||||
gboolean version = FALSE;
|
gboolean version = FALSE;
|
||||||
gboolean ignore_checksum = FALSE;
|
gboolean ignore_checksum = FALSE;
|
||||||
gboolean ignore_power = FALSE;
|
|
||||||
gboolean ignore_vid_pid = FALSE;
|
gboolean ignore_vid_pid = FALSE;
|
||||||
gboolean interactive = isatty(fileno(stdout)) != 0;
|
gboolean interactive = isatty(fileno(stdout)) != 0;
|
||||||
g_auto(GStrv) plugin_glob = NULL;
|
g_auto(GStrv) plugin_glob = NULL;
|
||||||
@ -2973,14 +2972,6 @@ main(int argc, char *argv[])
|
|||||||
/* TRANSLATORS: command line option */
|
/* TRANSLATORS: command line option */
|
||||||
_("Ignore firmware hardware mismatch failures"),
|
_("Ignore firmware hardware mismatch failures"),
|
||||||
NULL},
|
NULL},
|
||||||
{"ignore-power",
|
|
||||||
'\0',
|
|
||||||
0,
|
|
||||||
G_OPTION_ARG_NONE,
|
|
||||||
&ignore_power,
|
|
||||||
/* TRANSLATORS: command line option */
|
|
||||||
_("Ignore requirement of external power source"),
|
|
||||||
NULL},
|
|
||||||
{"no-reboot-check",
|
{"no-reboot-check",
|
||||||
'\0',
|
'\0',
|
||||||
0,
|
0,
|
||||||
@ -3449,16 +3440,12 @@ main(int argc, char *argv[])
|
|||||||
priv->flags |= FWUPD_INSTALL_FLAG_ALLOW_OLDER;
|
priv->flags |= FWUPD_INSTALL_FLAG_ALLOW_OLDER;
|
||||||
if (allow_branch_switch)
|
if (allow_branch_switch)
|
||||||
priv->flags |= FWUPD_INSTALL_FLAG_ALLOW_BRANCH_SWITCH;
|
priv->flags |= FWUPD_INSTALL_FLAG_ALLOW_BRANCH_SWITCH;
|
||||||
if (force) {
|
if (force)
|
||||||
priv->flags |= FWUPD_INSTALL_FLAG_FORCE;
|
priv->flags |= FWUPD_INSTALL_FLAG_FORCE;
|
||||||
priv->flags |= FWUPD_INSTALL_FLAG_IGNORE_POWER;
|
|
||||||
}
|
|
||||||
if (ignore_checksum)
|
if (ignore_checksum)
|
||||||
priv->flags |= FWUPD_INSTALL_FLAG_IGNORE_CHECKSUM;
|
priv->flags |= FWUPD_INSTALL_FLAG_IGNORE_CHECKSUM;
|
||||||
if (ignore_vid_pid)
|
if (ignore_vid_pid)
|
||||||
priv->flags |= FWUPD_INSTALL_FLAG_IGNORE_VID_PID;
|
priv->flags |= FWUPD_INSTALL_FLAG_IGNORE_VID_PID;
|
||||||
if (ignore_power)
|
|
||||||
priv->flags |= FWUPD_INSTALL_FLAG_IGNORE_POWER;
|
|
||||||
|
|
||||||
/* load engine */
|
/* load engine */
|
||||||
priv->engine = fu_engine_new(FU_APP_FLAGS_NO_IDLE_SOURCES);
|
priv->engine = fu_engine_new(FU_APP_FLAGS_NO_IDLE_SOURCES);
|
||||||
|
@ -3338,7 +3338,6 @@ main(int argc, char *argv[])
|
|||||||
gboolean allow_older = FALSE;
|
gboolean allow_older = FALSE;
|
||||||
gboolean allow_reinstall = FALSE;
|
gboolean allow_reinstall = FALSE;
|
||||||
gboolean enable_ipfs = FALSE;
|
gboolean enable_ipfs = FALSE;
|
||||||
gboolean ignore_power = FALSE;
|
|
||||||
gboolean is_interactive = TRUE;
|
gboolean is_interactive = TRUE;
|
||||||
gboolean no_history = FALSE;
|
gboolean no_history = FALSE;
|
||||||
gboolean offline = FALSE;
|
gboolean offline = FALSE;
|
||||||
@ -3512,14 +3511,6 @@ main(int argc, char *argv[])
|
|||||||
_("Filter with a set of device flags using a ~ prefix to "
|
_("Filter with a set of device flags using a ~ prefix to "
|
||||||
"exclude, e.g. 'internal,~needs-reboot'"),
|
"exclude, e.g. 'internal,~needs-reboot'"),
|
||||||
NULL},
|
NULL},
|
||||||
{"ignore-power",
|
|
||||||
'\0',
|
|
||||||
0,
|
|
||||||
G_OPTION_ARG_NONE,
|
|
||||||
&ignore_power,
|
|
||||||
/* TRANSLATORS: command line option */
|
|
||||||
_("Ignore requirement of external power source"),
|
|
||||||
NULL},
|
|
||||||
{"json",
|
{"json",
|
||||||
'\0',
|
'\0',
|
||||||
0,
|
0,
|
||||||
@ -3879,14 +3870,10 @@ main(int argc, char *argv[])
|
|||||||
priv->flags |= FWUPD_INSTALL_FLAG_ALLOW_OLDER;
|
priv->flags |= FWUPD_INSTALL_FLAG_ALLOW_OLDER;
|
||||||
if (allow_branch_switch)
|
if (allow_branch_switch)
|
||||||
priv->flags |= FWUPD_INSTALL_FLAG_ALLOW_BRANCH_SWITCH;
|
priv->flags |= FWUPD_INSTALL_FLAG_ALLOW_BRANCH_SWITCH;
|
||||||
if (force) {
|
if (force)
|
||||||
priv->flags |= FWUPD_INSTALL_FLAG_FORCE;
|
priv->flags |= FWUPD_INSTALL_FLAG_FORCE;
|
||||||
priv->flags |= FWUPD_INSTALL_FLAG_IGNORE_POWER;
|
|
||||||
}
|
|
||||||
if (no_history)
|
if (no_history)
|
||||||
priv->flags |= FWUPD_INSTALL_FLAG_NO_HISTORY;
|
priv->flags |= FWUPD_INSTALL_FLAG_NO_HISTORY;
|
||||||
if (ignore_power)
|
|
||||||
priv->flags |= FWUPD_INSTALL_FLAG_IGNORE_POWER;
|
|
||||||
|
|
||||||
/* use IPFS for metadata and firmware *only* if specified */
|
/* use IPFS for metadata and firmware *only* if specified */
|
||||||
if (enable_ipfs)
|
if (enable_ipfs)
|
||||||
|
Loading…
Reference in New Issue
Block a user