- Feature: Skip the systemd inhibitor when performing CriticalPowerAction
(!309)
- Feature: Introduce "Auto" CriticalPowerAction using systemd-logind
Sleep() (!309)
- Fix: Test CanPowerOff() availability before calling PowerOff() (!311)
- Fix: Add charge limit support for systems providing only
charge_control_end_threshold (!310, #342, #285)
Co-Authored-By: Cursor and Claude-4.6-sonnet
Signed-off-by: Kate Hsuan <hpa@redhat.com>
Call CanPowerOff() to find the availability before calling PowerOff().
The priority of the Sleep() call should be higher than Ignore. That is the
final fallback call when the other critical power actions aren't
available.
Signed-off-by: Kate Hsuan <hpa@redhat.com>
The polkit rule gives upower the necessary permission to ignore the
systemd inhibitor when upower runs the CriticalPowerAction.
Signed-off-by: Kate Hsuan <hpa@redhat.com>
Systemd can be used to determine the better critical actions since systemd
knows which power actions are supported by the system. A "Auto" critical
action was introduced and that invoked the Sleep() systemd-logind API to
set the system power status when the battery level reaches PercentageAction
or TimeAction.
Signed-off-by: Kate Hsuan <hpa@redhat.com>
The API was changed to, for example, "HybriSleepWithFlags" to skip the
systemd inhibitor. The user apps can set the systemd inhibitor to
stop the power action, such as suspend, hibernate, etc., when playing
PC game or movie watching. The inhibitor may block the
CriticalPowerAction when the battery level is low.
Signed-off-by: Kate Hsuan <hpa@redhat.com>
- Fix: a resource leak (!294)
- Fix: a NULL exception caused by a Non-NULL GError pointer (!295, #331)
- Fix client API: crashing when printing the error message from a NULL GError pointer (!304)
- Feature: Skip CriticalPowerAction when performing battery recalibration (!285, #312)
- Deprecate: capacity_level and luminosity property (!293, !297 )
- CI: Add a tartan LLVM static analysis (!300)
- Feature: History supports voltage item (!299)
Bump up the libupower-glib release since (!304)
The user reported that the ACPI of a legacy system reports -NaN value for
its battery "capacity" attribute. This value causes upower crash with a
GLib assertion.
The -NaN was converted to 0.0 for the Percentage value to fix the issue.
Resolves: #339#340
Passing a NULL UpClient to up_client_get_devices2() led to the following
error message and crash since up_client_get_devices_full() returned
immediately, without properly setting up a GError with an error message.
The input UpClient pointer verification was moved from the internal
function to the API entry to ensure only a valid UpClient is passed
to the internal function. Moreover, GError will be properly set by the
GLib dbus APIs and the internal function.
(upower:21076): libupower-glib-CRITICAL **: 16:33:53.919: up_client_get_devices_full: assertion 'UP_IS_CLIENT (client)' failed
Segmentation fault (core dumped) ./upower -d
Related: https://gitlab.freedesktop.org/upower/upower/-/merge_requests/296
Reported-by: Mathias Krause <minipli@grsecurity.net>
Signed-off-by: Kate Hsuan <hpa@redhat.com>
Since d2053eff ("linux: Remove user-space support for Logitech Unifying
devices"), the luminosity property is no longer in use and no code for it
exists except in the lib. Deprecate and eventually drop it.
As some systems only allow for one charge threshold setting, the overall
process is treated as a success as long as one of the values is set
correctly. We only treat it as an error (and return FALSE) if both the
start and end threshold settings fail. For this reason, we don't need
to track specific errors for every write, so the GError parameter in
g_file_set_contents_full() is set to NULL.
Fedora upowerd[1326]: g_file_set_contents_full: assertion 'error == NULL || *error == NULL' failed
Fedora upowerd[1326]: GError set over the top of a previous GError or uninitialized memory.
This indicates a bug in someone's code. You must ensure an error is NULL before it's set.
The overwriting error message was: Failed to set charge control thresholds
Resolves: #331
This change adds the feature to read config from conf.d style
directories (UPower.conf.d), commonly supported by other tools, as an
extension of the main config file.
This is useful and convenient in several situations, for example:
- distributions can set different values from the defaults shipped
upstream without having to modify the main UPower.conf
- different packages or config-management tools can change config just
by adding, removing or modifying files in that directory
The main config file, e.g. '/etc/UPower/UPower.conf', will be
processed first, and then files in the UPower.conf.d dir, if existing.
The directory to use is derived automatically, e.g.
'/etc/UPower/UPower.conf.d/' if the main config file is
'/etc/UPower/UPower.conf'. Only files within that directory are
considered, and only those with valid config-group 'UPower' and with
the filename format: starting with '00-' to '99-', ending in '.conf'
and with alphanumeric characters, dash or underscore in between.
The candidate files within the given directory are sorted (with
g_strcmp0(), so the ordering will be as with strcmp()). The
configuration in the files being processed later will override
previous config, in particular the main config, but also the one from
previous files processed, if the Group and Key coincide.
Add also relevant integration test: 'test_conf_d_support'
These fields do not start with an underscore. polkitd complains
about them:
polkitd[2017783]: skipping unknown tag <_description> at line 18
polkitd[2017783]: skipping unknown tag <_message> at line 19
While common keyboard backlight devices use 'kbd_backlight' in the name, per
linux kernel include/dt-bindings/leds/common.h, there are a few legacy names,
including 'lp5523:kbN'. They cannot be easily changed now because it would
break userspace, hence the names are still provided in the kernel. Support
them in upower as well. The lp5523 as used on the Nokia N900 exposes six
independent keyboard backlight LEDs, and UPower is able to manage them with
this patch in place.
This parent class can be used for multiple implementations, such as freebsd
and Linux. The child class inherits it to register the device to upower
and access the dbus services.
The object path /org/freedesktop/UPower/KbdBacklight is going to be deprecated in the future.
The upper-layer app should migrate to the new API instead.
- Fix wrong model name of the devices (!267, #309)
- Switch charge_types to "Custom" when charging threshold is enabled (!268, #275)
- Fix invalid command line arguments (!269)
- Fix leak when reporting daemon usage error (!270)
- OpenBSD: support battery status from qcpas (!272)
- Fix history progression (!274, #316)
- Add a battery filter to the upower command line (!275)
- Change the charging behaviors using charge_types (!276, !46, #275)
- Fix integration tests issues, including floating point value and race between umockdev and upower (!277, !278)
- Rework upower command (!280)
- Propagate charge-threshold-enabled to display device (!281)
This is useful when asking people to give information about battery
health. It avoids having to give two-step instructions of first
enumerating devices with `upower -e`, then looking for a device whose
name starts with `/org/freedesktop/UPower/devices/battery_`, then
running `upower -i` on that device.
Signed-off-by: Josh Triplett <josh@joshtriplett.org>