Commit graph

1873 commits

Author SHA1 Message Date
Kate Hsuan
2ff254f122 linux: integration-test: the test for SetChargeStrategy 2026-01-23 15:26:42 +08:00
Kate Hsuan
0ca7766243 up-device: polkit check when setting charge strategy
The set operation should be allowed by polkit.
2026-01-23 15:26:42 +08:00
Kate Hsuan
69e4cb8011 up-device-battery: set charge strategy to the battery device
This commit writes the charge strategy configuration to the battery device.
If the parameter isn't supported, an error message will be returned.
2026-01-23 15:26:42 +08:00
Kate Hsuan
3620f425ec dbus: org.freedesktop.UPower.Device: Add SetChargeStrategy method
SetChargeStrategy method sets the battery charge algorithm to an given
value if the system supports the setting.
2026-01-23 15:26:42 +08:00
Kate Hsuan
adeaa5d886 up-device-battery: GetSupportedChargeStrategies method and ChargeStrategiesSupported property
Expose the charge algorithms through the ChargeStrategiesSupported
property and GetSupportedChargeStrategies method.
2026-01-23 15:26:42 +08:00
Kate Hsuan
8b7f6e60c3 dbus: org.freedesktop.UPower.Device: Introduce the GetSupportedChargeStrategies method
GetSupportedChargeStrategies returns the supported battery charging
algorithm.
2026-01-23 15:26:42 +08:00
Kate Hsuan
462293e7fe linux: integration-test: expose charge_types property
The ChargeStrategy should report 128 (Long Life).
2026-01-23 15:26:42 +08:00
Kate Hsuan
130524a53a src: linux: up-device-supply: Update charge_types attribute to the property
Update the charge_types value to the glib property when refreshing the
battery values.
2026-01-23 15:26:42 +08:00
Kate Hsuan
6c8e5e283f libupower-glib: Define the types for the charge strategies
The charge strategies includes
Unknown, N/A, Trickle, Fast, Standard, Adaptive, Custom
Long Life and Bypass.

up_device_battery_charge_strategy_from_string() converts the charge
strategy string to a enume value. If the string can be found,
UP_DEVICE_CHARGE_STRATEGIES_LAST will be returned.
2026-01-23 15:26:38 +08:00
Kate Hsuan
423c912905 dbus: org.freedesktop.UPower.Device: introduce the ChargeStrategy property
This property shows the current charging strategy reported by the system
firmware.
2026-01-23 14:50:37 +08:00
Kate Hsuan
f61735aa6d rules: 95-upower-hid: Update to the latest hwdb
Update NUT hwdb rules.
2026-01-21 12:11:32 +08:00
Kate Hsuan
eff769c65f Revert "lib: Mark lid related functions and properties as deprecated"
This reverts commit 4e962fdc8d.

Undeprecate lid APIs since upower continues to support lid DBus APIs.
2026-01-06 14:26:16 +08:00
Sicelo A. Mhlongo
37f7086983 up-self-test: Add historical voltage data support 2026-01-05 12:39:22 +02:00
Sicelo A. Mhlongo
8e424217f5 lib: up-device: Expose historical voltage data
Enable library users to access stored voltage data.
2026-01-05 12:39:13 +02:00
Sicelo A. Mhlongo
7d486c500c up-device: Implement storage and retrieval of historical voltage data 2026-01-05 12:34:44 +02:00
Sicelo A. Mhlongo
09c8bbb0f7 up-history: Store and retrieve historical data for voltage
Extend the history implementation to store and retrieve data about voltage
information for batteries.
2026-01-05 12:34:44 +02:00
Sicelo A. Mhlongo
1c052a378f dbus: Add voltage as a supported history item
In certain applications, access to historical voltage data might be useful, for
example to plot voltage curves. Add support for this property.
2026-01-05 12:34:26 +02:00
Kate Hsuan
bf3d20378f contrib: add a tartan static analysis script and description 2025-12-29 17:02:31 +08:00
Sicelo A. Mhlongo
f6e63cfc40 upower: deprecate luminosity property
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.
2025-12-17 16:46:28 +08:00
Kate Hsuan
0f57b6bf73 Drop the incorrect "since version" and mark the capacity_level property as deprecated
Fix: 09ada72 (dbus: org.freedesktop.UPower.Device: deprecate CapacityLevel property)
2025-12-17 16:19:55 +08:00
Kate Hsuan
38ab5417b7 linux: integration-test: test for the battery recalibration
Test case for ignoring the CriticalPowerAction when performing the battery
recalibration.
2025-12-15 14:19:13 +08:00
Kate Hsuan
d9f42cfc9d up-daemon: Report UP_DEVICE_LEVEL_NONE when battery is performing recalibration
If the battery is performing recalibration and AC is online,
UP_DEVICE_LEVEL_NONE is considered.
2025-12-15 14:19:13 +08:00
Kate Hsuan
4722fcfaac up-config: introduce the ExpectBatteryReCalibration for battery recalibration
ExpectBatteryReCalibration allows the user to ignore the
CriticalPowerAction when performing the battery recalibration.
2025-12-15 14:19:13 +08:00
Kate Hsuan
1ba5f3a55e linux: up-device-supply-battery: Fix assigning an error to a non-NULL GError pointer
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
2025-12-12 20:14:04 +08:00
Kate Hsuan
c5df437cc1 linux: up-device-supply: fix the resource leak
1. free the udev parent node automatically.
2. free new_model_name variable in the same scope.
2025-11-28 15:00:22 +08:00
Kate Hsuan
d79841fe40 meson: Release 1.91.0
The major change includes:
1. Support multiple keyboard backlight LED control.
2025-11-25 16:39:56 +08:00
Kate Hsuan
a4d0d469f3 meson: so relase bump up due to recent property changes 2025-11-25 15:25:06 +08:00
Kate Hsuan
09ada726f7 dbus: org.freedesktop.UPower.Device: deprecate CapacityLevel property
This property is duplicated from BatteryLevel and confuses the user.
2025-11-25 14:33:55 +08:00
Kate Hsuan
391e3323f0 etc: UPower.conf.d: add UPower.conf.d
The configuration files in the UPower.conf.d will override the primary
configuration.
2025-11-12 15:46:00 +08:00
Manuel A. Fernandez Montecelo
46bbc8a602 Add support for conf.d style dirs (UPower.conf.d)
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'
2025-11-12 15:45:56 +08:00
Luca Boccassi
5f572ffd9a polkit: fix config syntax
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
2025-10-21 16:59:38 +08:00
Kate Hsuan
9c8769d7df ci: fix pre-commit test
Resolve the libatomic dependency issue.
2025-10-21 16:51:40 +08:00
Kate Hsuan
8ce78b7f9e meson_options: replace deprecated boolean variable 2025-09-17 12:27:42 +08:00
Kate Hsuan
f26409e925 rules: 95-upower-hid: update hwdb from upstream NUT
Update to the latest hwdb from NUT.

Link: https://networkupstools.org
Link: https://raw.githubusercontent.com/networkupstools/nut/master/scripts/upower/95-upower-hid.hwdb
2025-09-16 15:51:36 +08:00
Luciano Santos
5bf9cac60d build: Make installation of tests optional
Default to installing them, while letting people/distributors decide
what they want.
2025-09-16 15:25:49 +08:00
Sicelo A. Mhlongo
84aab7aefa linux: up-enumerator-udev: also permit lp5523:kb name
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.
2025-09-05 17:22:08 +08:00
Kate Hsuan
afb346cf77 linux: integration-test: Multiple keyboard backlight LED support
The integration test for multiple keyboard backlight support.
2025-09-05 17:22:08 +08:00
Kate Hsuan
e0baa3fdcb up-daemon: The implementation of EnumerateKbdBacklight
The implementation for enumerating all keyboard backlight LED objects
on the system.
2025-09-05 17:22:08 +08:00
Kate Hsuan
d316a111f7 dbus: org.freedesktop.UPower: Enumerate kbd backlight LEDs
Enumerate all keyboard backlight LED objects on the system.
2025-09-05 17:22:08 +08:00
Kate Hsuan
4ba78c54a9 linux: up-enumerator-udev: enumerate the LED subsystem
The LED udev subsystem was added to the list to watch the
keyboard backlight LED device events.
2025-09-05 17:22:08 +08:00
Kate Hsuan
6bfc3d6100 up-daemon: device-added and device-removed keyboard backlight device
The keyboard backlight device will be added to or removed from DeviceList
when receiving the "device-added" and "device-removed" signal.
2025-09-05 17:22:08 +08:00
Kate Hsuan
796ce9e579 up-daemon: DeviceList for keyboard backlight LED devices
The DeviceList was created to store the keyboard backlight LED devices.
2025-09-05 17:22:08 +08:00
Kate Hsuan
fd6eebb397 linux: up-enumerator-udev: Process add, change, and remove udev events for keyboard backlight device
Add, update, and remove the keyboard backlight LED device when receiving
add, change, and remove udev events.
2025-09-05 17:18:17 +08:00
Kate Hsuan
e01aa7c903 linux: up-kbd-backlight-led: the keyboard backlight control implementation for Linux
The implementation for Linux included:
1. Set and get brightness.
2. Get max brightness.
3. Signal if the brightness was changed by the device.
2025-09-05 16:47:11 +08:00
Kate Hsuan
1d40bc2027 linux: up-backend: Add and remove keyboard backlight LED device
These are the callback functions for the signals "device-added" and
"device-removed" to add and remove keyboard backlight devices.
2025-09-05 11:49:38 +08:00
Kate Hsuan
9f9b8478bd up-device-list: Introduce the UpDeviceKbdBacklight object
This commit makes UpDeviceList store the UpDeviceKbdBacklight objects and
sets the udev native path property of UpDevice and UpDeviceKbdBacklight.
2025-09-05 11:49:38 +08:00
Kate Hsuan
aaf52de8dc up-device-kbd-backlight: The parent class for keyboard backlight control
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.
2025-09-05 11:49:38 +08:00
Kate Hsuan
0dcb46475f dbus: org.freedesktop.UPower.KbdBacklight: Description for deprecating the KbdBacklight object path
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.
2025-09-05 11:49:38 +08:00
Kate Hsuan
40a4498454 dbus: KbdBacklight: Add a native path attribute
The DBus property shows the udev native path.
2025-09-05 11:49:38 +08:00
Kate Hsuan
c56ff5f207 Release 1.90.10
- 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)
2025-08-26 16:04:24 +08:00