Commit graph

1855 commits

Author SHA1 Message Date
Kate Hsuan
00eb31a63c linux: device_supply: The new priority of device kind
Give a new priority for device type since the gaming_input may include
a keyboard, a touchpad... etc, for example, a Sony DualShock4 joypad.
A mouse and a touchpad may include a mouse and a keyboard.
Therefore, the priority is:
1. Audio
2. Gaming_input
3. Keyboard
4. Tablet
5. Touchpad
6. Mouse
2024-06-03 14:18:17 +08:00
Kate Hsuan
544eba5543 test: the test for CriticalPowerAction=Suspend
The test cases for AllowRiskyCriticalPowerAction=true and false when
CriticalPowerAction=Suspend.
2024-04-25 16:07:11 +08:00
Kate Hsuan
69436647c5 linux: up-backend: A safeguard for the risky CriticalPowerAction
If AllowRiskyCriticalPowerAction is true and the CriticalPowerAction
is "Suspend", The "Suspend" can be the CriticalPowerAction.
Otherwise, "HybridSleep" will be the CriticalPowerAction.
2024-04-25 16:07:11 +08:00
Kate Hsuan
469346b6bf up-config: set filename variable with g_autofree 2024-04-25 16:07:11 +08:00
Kate Hsuan
8cb9fb0231 up-config: The warning message for the risky CriticalPowerAction
The warning message will be shown when CriticalPowerAction is "Suspend".
One iwarning message is for enabling the risky CriticalPowerAction and
the other is to show the potential risk when
AllowRiskyCriticalPowerAction is true.
2024-04-25 16:07:11 +08:00
Alexander Couzens
18b4748435 linux: allow Suspend as CriticalPowerAction
When using UPower in a non-hybernate setup, the result of a
CriticalPowerAction would be PowerOff. Certain users prefer
Suspend instead, because this is the only way to recover
graceful from that state.
Suspend action will only used, when explicit configured.

Closes: #23
Closes: #59
Signed-off-by: Kate Hsuan <hpa@redhat.com>
2024-04-25 16:07:11 +08:00
Kate Hsuan
1146047df9 ci: replace compiling umockdev with a package
Test is based on umockdev package without compile it
during runner creation step.
2024-04-25 15:35:30 +08:00
Kate Hsuan
c8385cb08a Release 1.90.4
- Update change information to NEWS
2024-04-08 23:36:47 +08:00
Kate Hsuan
c970a1a1b9 Update release 1.90.3 information to NEWS 2024-04-08 23:04:42 +08:00
Kate Hsuan
a9fb6d5fa0 Release upower 1.90.3
1. Resolved high disk and CPU rate.
2. Update glib2 requirement to 2.66.0.
3. Stop guessing the unknown battery as a power supply.
4. Continue to support lid handling.
5. Document fixes and bug fixes.
2024-04-08 13:27:51 +08:00
Jelle van der Waa
1e58e8218a Stop using deprecated g_get_current_time
g_get_current_time was deprecated in 2.62 and can be directly replaced with
g_get_real_time.
2024-03-13 08:59:46 +01:00
Jelle van der Waa
dffb485a15 Bump glib2 requirement
Bump glib2 to 2.66 so we can use g_file_set_contents_full
2024-03-13 08:59:46 +01:00
Jelle van der Waa
3e808424b3 build: use install_emptydir for installing the history dir
This resolves the following deprecation warning, meson these days has a
special function for installing an empty directory:

* 0.60.0: {'install_subdir with empty directory'}
2024-03-11 14:53:53 +01:00
Kenny Levinsen
d8c22cf085 docs: Document all current device types
We only had documentation for the first 9 device types, ending with
Phone. Document all the current 29 device types.
2024-03-05 22:36:39 +01:00
Kate Hsuan
bbb593d306 up-device: Remove history only on device id change
Remove the history when the device id was changed.
2024-03-05 16:27:16 +08:00
Kate Hsuan
76e2b9e571 up-device: a filter to ignore the unknown status from the devices
Ignore all the unknown events from the devices.
2024-03-05 16:27:16 +08:00
Kate Hsuan
ab50a2bb3e up-history: Compare the history id with a given string
up_history_is_device_id_equal() is used to compare the history device_id
with a given string.
2024-03-05 16:27:16 +08:00
Kate Hsuan
6ef7fcd1bd rules: Update hwdb from upstream NUT
Include:
Liebert
usb:v10AFp0000*
usb:v10AFp0002*

Link: https://github.com/networkupstools/nut
Link: https://raw.githubusercontent.com/networkupstools/nut/master/scripts/upower/95-upower-hid.hwdb
2024-03-05 15:32:48 +08:00
Kate Hsuan
efc8ac61af rules: Update hwdb from NUT
Link: https://github.com/networkupstools/nut
Link: https://raw.githubusercontent.com/networkupstools/nut/master/scripts/upower/95-upower-hid.hwdb
2024-02-27 10:56:40 +08:00
Kate Hsuan
be82397367 Revert "ci: Update last ABI break"
This reverts commit 520939242e.

Revert the last ABI break since API has been reverted.
2024-02-09 15:07:21 +08:00
Kate Hsuan
b6fb567824 Revert "build: Bump the library soname after recent changes"
This reverts commit a94c94fe6b.

Revert so verion bump up since the API has been reverted.

Resolves: https://gitlab.freedesktop.org/upower/upower/-/issues/261
2024-02-09 14:22:01 +08:00
Jelle van der Waa
17c14cc63f Revert "all: Remove Lid handling"
This reverts commit 07565ef6a1.

In the current systemd stable release 255 org.freedesktop.login1 does
not emit a LidisClosed event, this has added in systemd `main` and will
be availble in the next release.

As GNOME control panel still uses UPower's `LidIsclosed` property and
many other DE's such as Xfce/LXQt/Deepin as well revert this until the
systemd changes are available in all Distributions.

https://github.com/systemd/systemd/pull/30706

Resolve: https://gitlab.freedesktop.org/upower/upower/-/issues/260
2024-01-26 14:57:27 +00:00
Jelle van der Waa
18d550a555 Revert "lib: Remove deprecated up_client_get_devices()"
This reverts commit 6766602954.

Removing this and renaming up_client_get_devices2 to
up_client_get_devices means consumers have to support three cases to
support older UPower versions. So for example GNOME Control center now
uses up_client_get_devices2 and would have to now check if UPower
version > 0.92.
2024-01-26 10:20:50 +01:00
Kate Hsuan
b21cec4c11 dbus: org.freedesktop.UPower: EnergyRate is a positive value
The EnergyRate is a positive value since most of the laptops are ACPI
based system and report the power status through power_now sysfs
attribute. Moreover, the ACPI specification mention that the battery
power status is a positive value, measured in watt.

https://learn.microsoft.com/en-us/windows-hardware/design/component-guidelines/acpi-battery-and-power-subsystem-firmware-implementation

Fix: https://gitlab.freedesktop.org/upower/upower/-/issues/252

Signed-off-by: Kate Hsuan <hpa@redhat.com>
2024-01-15 07:36:53 +00:00
Martin Pitt
bd1e4698f4 linux: Adjust test_bluetooth_le_device for dbusmock 0.30.1
dbusmock 0.30.1 changed the BlueZ template to set the default "Class"
property to `MOCK_PHONE_CLASS` right away instead of in PairDevice() [1].

test_bluetooth_le_device() relied on the previous implicit default of a
"0" Class value. Set this explicitly to expect a "generic" device. This
makes the test work with old and current dbusmock versions.

https://bugs.debian.org/1059467

[1] https://github.com/martinpitt/python-dbusmock/pull/192
2023-12-28 21:13:15 +01:00
Ratchanan Srirattanamet
dfde9e2274 linux: stop assuming power supply of unknown type as battery
Some vendor kernel (most notably Android devices) expose various types
of BMS (battery management system) as power supplies. This is something
UPower has never designed to deal with, and thus UPower should not
represent or consider it to be a battery.

Fortunately, most of the time the actual "battery" power supply has the
correct type, so we can safely ignore those devices which have unknown
type. Also, the code that assumes power supply of unknown type seems
pretty dated and probably doesn't make sense anymore. So, let's remove
this assumption altogether.
2023-11-09 15:51:14 +07:00
Jelle van der Waa
4baf9b8903 linux: drop f-literals without format string 2023-11-03 15:26:26 +01:00
Jelle van der Waa
d3a1d17d59 linux: prefer is not None over !=
Compare on object identity not equality.
2023-11-03 15:18:09 +01:00
Pino Toscano
029651a96d build: make 'udevrulesdir' and 'udevhwdbdir' as Linux-only
udev is available only on Linux, so limit their usage when the backend
is 'linux'.

This fixes the build when the backend is different than 'linux', i.e.
typically on non-Linux OSes.
2023-07-07 06:50:31 +00:00
Bastien Nocera
aee533e517 ci: Work-around dnf builddep not being installable
Work-around rawhide being broken:
Problem: The operation would result in removing the following protected packages: dnf
2023-07-07 08:43:08 +02:00
Bastien Nocera
520939242e ci: Update last ABI break 2023-07-06 11:18:58 +02:00
Bastien Nocera
a94c94fe6b build: Bump the library soname after recent changes 2023-07-06 11:18:30 +02:00
Bastien Nocera
6766602954 lib: Remove deprecated up_client_get_devices()
And rename up_client_get_devices2() to up_client_get_devices().
2023-07-06 11:15:02 +02:00
Bastien Nocera
07565ef6a1 all: Remove Lid handling
It is now handled solely in logind to take power management decisions,
and in the compositor for making decisions related to available
displays.

See:
https://www.freedesktop.org/software/systemd/man/org.freedesktop.login1.html
2023-07-06 11:09:42 +02:00
Bastien Nocera
8dcf54440d 1.90.2 2023-07-06 10:52:27 +02:00
Bastien Nocera
bdc5638627 linux: Add installed-tests manifest
This will allow running the tests to target installed binaries.
2023-07-06 10:31:46 +02:00
Bastien Nocera
e4e498e198 linux: Fix integration test to work under jhbuild
Fixes: 648abe9c27 ("tests: Test a client running while daemon restarts")
2023-07-06 10:07:08 +02:00
Bastien Nocera
f8fe036331 linux: Work-around potential race in test_headset_hotplug 2023-07-05 17:39:19 +02:00
Bastien Nocera
38576a9bd7 linux: Emit added/removed signals when duplicates change 2023-07-05 17:39:19 +02:00
Bastien Nocera
53ccc01be9 linux: Add test for device signals with wireless_status 2023-07-05 17:39:19 +02:00
Bastien Nocera
4d3d8759db linux: Add wait_for_mainloop() test helper 2023-07-05 17:39:19 +02:00
Bastien Nocera
faa5a560f9 linux: Emit added/removed signals when wireless_status changes
Closes: #240
2023-07-05 17:39:19 +02:00
Bastien Nocera
8dd86689fa device: Add up_device_is_registered()
So we can know whether a device was registered when hiding it and
eventually send the appropriate "device-removed" signal.
2023-07-05 17:39:19 +02:00
Bastien Nocera
0ed632daab device: Return success after up_device_register
Return whether up_device_register() registered a device, so we can
announce it through a device-added signal.
2023-07-05 15:33:20 +00:00
Michael Biebl
dec9468136 linux: Fix integration test to work with system installed upower binary
Fixes: 648abe9c27 ("tests: Test a client running while daemon restarts")
Closes: #241
2023-07-05 15:30:47 +00:00
Bastien Nocera
72183b6e04 build: Require a newer libgudev
Some of the functionality will be broken with older versions, in
particular when it comes to newline stripping when reading sysfs
attributes.
2023-07-05 17:16:52 +02:00
Bastien Nocera
744c49eaac ci: Install newer libgudev
Until the image creation CI job can run all the way through:
https://gitlab.freedesktop.org/upower/upower/-/issues/242
install a newer libgudev by hand.
2023-07-05 17:16:52 +02:00
Bastien Nocera
e8d8417023 ci: Also run on 'schedule' pipelines 2023-07-05 16:22:48 +02:00
Bastien Nocera
96c34a3bb9 1.90.1 2023-07-04 15:51:22 +02:00
Bastien Nocera
95de7181dd linux: Add test for is-present changes at runtime 2023-07-04 15:20:20 +02:00