Commit graph

1758 commits

Author SHA1 Message Date
Kate Hsuan
17e5903670 Reformat python code style with black 2025-01-08 14:01:34 +08:00
Kate Hsuan
2678cb00d4 Fix trailing white space and end of file 2025-01-08 14:01:34 +08:00
Kate Hsuan
52bfd8d924 ci: Add python code style check to the pre-commit test 2025-01-08 14:01:29 +08:00
Kate Hsuan
2b371cc290 Update README.md and HACK to match markdown.lint style 2025-01-08 13:59:50 +08:00
Kate Hsuan
9c3b678d7f ci: markdownlint: Add markdownlint to the pre-commit check 2025-01-08 13:59:50 +08:00
Kate Hsuan
2cfc6f625f ci: Add codespell test to the pre-commit test 2025-01-08 13:59:50 +08:00
Kate Hsuan
9fac8f2ae2 pre-commit-config: Add pre-commit test 2025-01-08 13:59:43 +08:00
Kate Hsuan
1a64550dad rules: 95-upower-hid.hwdb: Update hwdb for HID devices 2024-12-31 13:39:50 +08:00
Kate Hsuan
a038b237fb linux: integration-test: wait 10 seconds for stopping the daemon
Some slow systems take more than 5 seconds to stop the daemon.  The
waiting time was extended to 10 seconds to ensure the daemon
shutdowns properly.

Resolves: #290

Signed-off-by: Kate Hsuan <hpa@redhat.com>
2024-12-06 06:30:03 +00:00
Natalie Clarius
422ac4be74 add completions for CLI 2024-10-26 19:56:28 +00:00
Jelle van der Waa
faa6d8a6b3 dbus: show charge-threshold-* status as yes/no
Previously shown as a boolean integer and not properly aligned.
2024-10-11 16:40:13 +02:00
Kate Hsuan
7d7bb84fde linux: up-enumerator-udev: Find the correct parent id for input devices
The parent id for the devices under "/sys/devices/virtual/misc/uhid/*"
points to /sys/devices/virtual/misc/uhid. It will cause the device
information to be updated incorrectly. For example, the type for a mouse is
updated to "keyboard". This patch makes sure the correct parent id for
each input device.

Resolves: #268 #286
2024-09-27 16:11:29 +08:00
Stuart Hayhurst
9ee76826bd Fix race condition in test_sibling_priority_no_overwrite 2024-09-25 16:56:11 +01:00
Kate Hsuan
94c91f93f1 NEWS: Update release date 2024-09-18 11:25:08 +08:00
Kate Hsuan
7fbc02e8af Release 1.90.6
- Fix g_object_weak_ref: assertion 'g_atomic_int_get (&object->ref_count) >= 1' failed (#281, !233)
- Fractional battery percentage (!226)
- CI enhancement. (!236)
- Tweak the default battery charging threshold to 75-80. (!234)
2024-09-18 02:39:43 +00:00
Jelle van der Waa
3390fa48ae linux: integration-test: correct unsupported test comment 2024-09-17 20:13:50 +02:00
Jelle van der Waa
23cf8c19f7 linux: integration-test: drop f-string without placeholder 2024-09-17 18:41:14 +02:00
Kate Hsuan
131ab3a9d5 up-polkit: Replace with G_DEFINE_TYPE_WITH_PRIVATE
Since no interface was inplemented in UpPolkit class so G_DEFINE_TYPE_WITH_PRIVATE
macro is batter.
2024-09-12 08:11:50 +00:00
Kate Hsuan
7db90b28d8 up-polkit: remove global variable and remove g_object_add_weak_pointer()
Since UpPolkit is only created in the daemon, so the global variable and
g_object_add_weak_pointer() can be removed.
2024-09-12 08:11:50 +00:00
Rogerio Alves
88031e563f Support fractional battery percent.
Make upower supports fractional battery percent
(e.g., 0.5% instead of 1%).

Signed-off-by: Rogerio Alves Cardoso <rogerio.cardoso@collabora.com>
2024-09-12 15:55:00 +08:00
Kate Hsuan
fda3a0b563 ci: Test on Debian system
We run the test on the Debian system to ensure upower can run on
different Linux distributions.
2024-09-12 15:10:15 +08:00
Kate Hsuan
cca76c8684 rules: 60-upower-battery.hwdb: Change the threshold value to 75-80
The CHARGE_LIMIT is set to 75-80 to increase the start threshold value.

Resolves: #282
2024-09-02 14:48:10 +08:00
Jan Alexander Steffens (heftig)
b4697dbc62
up-polkit: Add G_ADD_PRIVATE (UpPolkit)
Without this, accesses to `UpPolkitPrivate` are actually out of bounds
and writing to it will cause heap corruption.

Fixes: https://gitlab.freedesktop.org/upower/upower/-/issues/281
2024-08-31 11:05:54 +02:00
Kate Hsuan
b71996a526 linux: integration-test: Add polkit test
Test action is allowed and not allowed when calling EnableChargeThreshold
dbus API.
2024-08-29 06:31:37 +00:00
Kate Hsuan
f55641cd43 Revert "Remove polkit tests"
This reverts commit bddc559713.

Changes:
- Removed Makefile
- Removed test for UpWakeups
2024-08-29 06:31:37 +00:00
Kate Hsuan
b26c8c79c9 ci: Add polkit dependency 2024-08-29 13:55:02 +08:00
Kate Hsuan
12d1b7ec43 Release 1.90.5
- Suspend and Ignore as the CriticalPowerActions (!218 and !218)
- Support for battery charging threshold (!208)
- Tweak the device priority to make sure the device kind joystick can be correctly shown. (#267)
2024-08-26 09:19:37 +00:00
Kate Hsuan
9449cb5831 dbus: G_MAXUINT means ignore ChargeStartThreshold or ChargeEndThreshold
If the value is G_MAXUINT, it means charge_control_start_threshold or
charge_control_end_threshold will be skipped.
2024-08-23 22:21:52 +08:00
Michael Biebl
d7005f618d Fix typo: deamon -> daemon 2024-08-23 08:30:22 +02:00
Kate Hsuan
399ec5d1ec linux: up-device-supply-battery: Don't report error when one of the start/stop charge threshold isn't writable
One of the charge_control_start|end_threshold isn't writable for some
systems, for example, Macbook Air. Therefore, if both files can't be
written, the error is returned.
2024-08-22 14:20:33 +08:00
Kate Hsuan
5882721f19 linux: up-device-supply-battery: Allow skipping start or end charging threshold setting
This allows the one of charge_control_start|end_threshold can be ignored
by a "_" character.
The udev hwdb can be set in the following format.

- Skip charging start limit
CHARGE_LIMIT=_,80
- Skip charging end limit
CHARGE_LIMIT=30,_
2024-08-22 14:20:33 +08:00
Kate Hsuan
4e8e8b43f8 daemon: Get and store env override configurations in the deamon 2024-08-22 14:20:33 +08:00
Kate Hsuan
b604a297be meson: Enable/disable polkit through an option
The user can enable and disable polkit using -Dpolkit.
2024-08-22 14:20:33 +08:00
Kate Hsuan
bfde9fefb7 build: Enbale/disable polkit based on HAVE_POLKIT 2024-08-22 14:20:33 +08:00
Kate Hsuan
7011b93c28 Revert "policy: Remove policy for removed features"
This reverts commit ababfa2aaf.

Changes:
1. Drop the policy for the old APIs.
2. Add a policy for enableChargeLimit.
2024-08-22 14:20:33 +08:00
Kate Hsuan
293e00e0f9 up-device-battery: Test the user authorization before setting the charging threshold 2024-08-22 14:20:33 +08:00
Kate Hsuan
b032ad7aa9 up-device: Accessing polkit service in UpDevice 2024-08-22 14:17:07 +08:00
Kate Hsuan
09aab8018f up-daemon: Testing the authorization is allowed through polkit
An function is used to test the user authorization through polkit.
2024-08-22 14:12:50 +08:00
Kate Hsuan
0c9ba8048f Revert "Remove polkit dependency"
This reverts commit 9a2b263309.

Revisions:
1. Drop autoconf and migrate to meson build.
2. Drop dbus-glib dependency
2024-08-20 17:04:12 +08:00
Jelle van der Waa
5b656780ff linux: integration-test: Test for battery charging threshold
Signed-off-by: Kate Hsuan <hpa@redhat.com>
2024-08-20 17:04:12 +08:00
Jelle van der Waa
aed03b0705 up-device-battery: Recover the charging threshold settings when restarting
The configuration file holds the enable status of the battery charging
threshold for individual batteries. If it is enabled, upower will recover
the settings when upower starts up. If the configuration file is not
present, the battery charging threshold is disabled by default.

Signed-off-by: Kate Hsuan <hpa@redhat.com>
2024-08-20 17:04:12 +08:00
Jelle van der Waa
16e373add0 up-device-battery: Enable and preserve the battery charging threshold config
It sets the battery start and end charging threshold to the kernel and also
saves the configuration in a file. If upower is restarted, upower
can recover the charging threshold setting through the configuration file.

The configuration file is based on the model name and serial number of the
battery so the battery can be configured individually.

Signed-off-by: Kate Hsuan <hpa@redhat.com>
2024-08-20 17:04:04 +08:00
Jelle van der Waa
dc28eccd1c dbus: Define EnableChargeLimit() dbus method
EnableChargeLimit() is used to enable/disable the battery charging threshold
feature.

Signed-off-by: Kate Hsuan <hpa@redhat.com>
2024-08-20 16:58:42 +08:00
Jelle van der Waa
d2c7e183c3 linux: up-device-supply-battery: write the charging threshold to kernel
Write the battery charging start and end threshold to the kernel through
sysfs.

Signed-off-by: Kate Hsuan <hpa@redhat.com>
2024-08-15 23:21:01 +08:00
Jelle van der Waa
f3a81a610f linux: up-device-supply: reset the values for battery charging threshold
Reset the value of the properties.

Signed-off-by: Kate Hsuan <hpa@redhat.com>
2024-08-02 13:58:48 +08:00
Jelle van der Waa
a955bae8c4 up-device-battery: show support status for battery charging threshold
If the charging threshold is supported, the ChargeThresholdSupported will be
True.

Signed-off-by: Kate Hsuan <hpa@redhat.com>
2024-08-02 13:58:48 +08:00
Jelle van der Waa
3df2599629 dbus: Define ChargeThresholdEnabled and ChargeThresholdSupported properties
ChargeThresholdSupported property is used to show if the battery supports
Charging threshold feature. ChargeThresholdEnabled is used to show the
configuration (enabled/disabled) status of the feature.

Signed-off-by: Kate Hsuan <hpa@redhat.com>
2024-08-02 13:58:48 +08:00
Jelle van der Waa
a12f7d7eef dbus: Define ChargeStartThreshold and ChargeEndThreshold properties
Define dbus interface for ChargeStartThreshold and ChargeEndThreshold.

Signed-off-by: Kate Hsuan <hpa@redhat.com>
2024-08-02 13:58:48 +08:00
Jelle van der Waa
3ff4d63cfc linux: up-device-supply-battery: Get default charging limit from udev
Get the default charge limit through udev.

Signed-off-by: Kate Hsuan <hpa@redhat.com>
2024-08-02 13:58:47 +08:00
Jelle van der Waa
16277c88c4 rules: add battery charge limit udev and hwdb files
Set per battery-specific start/stop charge limits in udev as environment
variable with the option to allow a user to override the default 60%
start and 80% stop charge limit.

Signed-off-by: Kate Hsuan <hpa@redhat.com>
2024-07-23 15:42:52 +08:00