mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2025-12-20 02:00:03 +01:00
up-config: introduce the ExpectBatteryReCalibration for battery recalibration
ExpectBatteryReCalibration allows the user to ignore the CriticalPowerAction when performing the battery recalibration.
This commit is contained in:
parent
1ba5f3a55e
commit
4722fcfaac
2 changed files with 21 additions and 0 deletions
|
|
@ -88,6 +88,15 @@ TimeAction=120
|
|||
# Default is false
|
||||
AllowRiskyCriticalPowerAction=false
|
||||
|
||||
# If the user performs the battery recalibration, the battery behavior
|
||||
# will be set to "force discharge" and the user expects the battery will
|
||||
# be fully discharged. However, upower performs the
|
||||
# CriticalPowerAction earlier than the battery was fully discharged.
|
||||
# ExpectBatteryRecalibration allows upower to ignore the
|
||||
# CriticalPowerAction when the user attempts to perform the battery recalibration.
|
||||
# Default is false
|
||||
ExpectBatteryRecalibration=false
|
||||
|
||||
# The action to take when "TimeAction" or "PercentageAction" above has been
|
||||
# reached for the batteries (UPS or laptop batteries) supplying the computer
|
||||
#
|
||||
|
|
|
|||
|
|
@ -247,6 +247,7 @@ static void
|
|||
up_config_init (UpConfig *config)
|
||||
{
|
||||
gboolean allow_risky_critical_action = FALSE;
|
||||
gboolean expect_battery_recalibration = FALSE;
|
||||
g_autofree gchar *critical_action = NULL;
|
||||
g_autoptr (GError) error = NULL;
|
||||
g_autofree gchar *filename = NULL;
|
||||
|
|
@ -308,6 +309,17 @@ up_config_init (UpConfig *config)
|
|||
" risky settings.", critical_action);
|
||||
}
|
||||
}
|
||||
|
||||
expect_battery_recalibration = up_config_get_boolean (config, "ExpectBatteryRecalibration");
|
||||
if (expect_battery_recalibration) {
|
||||
if (allow_risky_critical_action) {
|
||||
g_warning ("The \"ExpectBatteryRecalibration\" setting is considered risky:"
|
||||
" abrupt power loss due to battery exhaustion may lead to data"
|
||||
" corruption. The system will unexpected down when the AC is disconnected."
|
||||
" Use AllowRiskyCriticalPowerAction=false to disable support for"
|
||||
" risky settings.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue