Commit graph

215 commits

Author SHA1 Message Date
Bastien Nocera
6acc53daca README: Mention possible service conflicts
Mention problems with tlp's packaging in Fedora and Debian-derivatives.

See https://bugzilla.redhat.com/show_bug.cgi?id=2028701#c11
and https://github.com/linrunner/TLP/issues/564
2022-01-31 11:09:41 +01:00
Bastien Nocera
ca79f80635 intel-pstate: Don't show degraded perf with CPUs with no turbo
Don't show a degraded performance, caused by "no_turbo" being set,
when the CPU doesn't support TurboBoost at all.

Closes: #75
2022-01-31 10:50:47 +01:00
Bastien Nocera
c63503be97 tests: Add test to detect CPUs without Turbo support
Reproduces the hardware mentioned in
https://gitlab.freedesktop.org/hadess/power-profiles-daemon/-/issues/75
2022-01-31 10:50:47 +01:00
Bastien Nocera
3375973baf README: Add some end-user documentation
Enough data to get started using the project.
2021-11-17 17:03:06 +01:00
Bastien Nocera
ae8e90892b tests: Write tests for traceback avoidance on D-Bus errors 2021-11-08 16:27:56 +01:00
Bastien Nocera
fd1664dfe2 main: Error out on D-Bus communication errors
The bug reporting tool in Fedora, in its infinite wisdom, considers
innocuous exceptions that occur when system daemons aren't running
to be bug report worthy.

Catch all the D-Bus communication errors, print an error message
detailing the problem and exit with a return value of 1 when they occur
instead of printing an exception.

See:
https://bugzilla.redhat.com/show_bug.cgi?id=2019536
https://bugzilla.redhat.com/show_bug.cgi?id=2020251
https://bugzilla.redhat.com/show_bug.cgi?id=2020941
2021-11-08 16:27:56 +01:00
Bastien Nocera
0aef9d6a2f build: Require polkit 0.114
It's required for the g_autoptr() support we use. For older
distributions shipping older versions of polkit, it is recommended that
you backport the g_autoptr() support to your version of polkit and
amend the required version in this project.
2021-11-02 17:18:17 +01:00
Bastien Nocera
215690be0f 0.10.1 2021-10-28 11:25:13 +02:00
Sebastian Keller
30dbd321d8 main: Fix HoldProfile still happening when unauthorised
The HoldProfile method was correctly throwing an error back to the
caller but was still carrying on to hold a profile.

This could cause a double-free in the daemon, and unwanted profile
changes for users.

** (power-profiles-daemon:55299): DEBUG: 10:48:10.411: (:1.0) requesting to hold profile 'performance', reason: ''
** (power-profiles-daemon:55299): DEBUG: 10:48:10.422: Setting active profile 'performance' for reason 'program-hold' (current: 'balanced')
==55299== Invalid read of size 8
==55299==    at 0x4AA40F9: g_type_check_instance_is_fundamentally_a (gtype.c:4088)
==55299==    by 0x4A8DA08: g_object_unref (gobject.c:3484)
==55299==    by 0x4B17702: UnknownInlinedFun (gmain.c:1666)
==55299==    by 0x4B17702: g_source_callback_unref (gmain.c:1659)
==55299==    by 0x4B1B8BB: g_source_destroy_internal (gmain.c:1331)
==55299==    by 0x4B1D47F: UnknownInlinedFun (gmain.c:3411)
==55299==    by 0x4B1D47F: g_main_context_dispatch (gmain.c:4099)
==55299==    by 0x4B72287: g_main_context_iterate.constprop.0 (gmain.c:4175)
==55299==    by 0x4B1C902: g_main_loop_run (gmain.c:4373)
==55299==    by 0x403C10: main (power-profiles-daemon.c:1006)
==55299==  Address 0x54edc60 is 0 bytes inside a block of size 104 free'd
==55299==    at 0x48430E4: free (vg_replace_malloc.c:872)
==55299==    by 0x4B220BC: g_free (gmem.c:199)
==55299==    by 0x4B3C6FF: g_slice_free1 (gslice.c:1183)
==55299==    by 0x4AA2EF4: g_type_free_instance (gtype.c:2008)
==55299==    by 0x49B4840: g_dbus_method_invocation_return_value_internal (gdbusmethodinvocation.c:528)
==55299==    by 0x4064F2: hold_profile (power-profiles-daemon.c:568)
==55299==    by 0x4064F2: handle_method_call (power-profiles-daemon.c:711)
==55299==    by 0x49A4451: call_in_idle_cb.lto_priv.0 (gdbusconnection.c:4916)
==55299==    by 0x4B1952A: g_idle_dispatch (gmain.c:5897)
==55299==    by 0x4B1D33E: UnknownInlinedFun (gmain.c:3381)
==55299==    by 0x4B1D33E: g_main_context_dispatch (gmain.c:4099)
==55299==    by 0x4B72287: g_main_context_iterate.constprop.0 (gmain.c:4175)
==55299==    by 0x4B1C902: g_main_loop_run (gmain.c:4373)
==55299==    by 0x403C10: main (power-profiles-daemon.c:1006)
==55299==  Block was alloc'd at
==55299==    at 0x484086F: malloc (vg_replace_malloc.c:381)
==55299==    by 0x4B257A8: g_malloc (gmem.c:106)
==55299==    by 0x4B3D1E4: g_slice_alloc (gslice.c:1072)
==55299==    by 0x4B3D84D: g_slice_alloc0 (gslice.c:1098)
==55299==    by 0x4AA81F4: g_type_create_instance (gtype.c:1911)
==55299==    by 0x4A8FCAC: g_object_new_internal (gobject.c:1945)
==55299==    by 0x4A90C7C: g_object_new_with_properties (gobject.c:2114)
==55299==    by 0x4A91780: g_object_new (gobject.c:1785)
==55299==    by 0x49D8033: UnknownInlinedFun (gdbusmethodinvocation.c:369)
==55299==    by 0x49D8033: schedule_method_call.constprop.0 (gdbusconnection.c:4946)
==55299==    by 0x49A45B9: validate_and_maybe_schedule_method_call.lto_priv.0 (gdbusconnection.c:5048)
==55299==    by 0x499C57A: UnknownInlinedFun (gdbusconnection.c:5091)
==55299==    by 0x499C57A: UnknownInlinedFun (gdbusconnection.c:7172)
==55299==    by 0x499C57A: UnknownInlinedFun (gdbusconnection.c:2344)
==55299==    by 0x499C57A: on_worker_message_received (gdbusconnection.c:2258)
==55299==    by 0x49B0082: UnknownInlinedFun (gdbusprivate.c:488)
==55299==    by 0x49B0082: UnknownInlinedFun (gdbusprivate.c:484)
==55299==    by 0x49B0082: UnknownInlinedFun (gdbusprivate.c:516)
==55299==    by 0x49B0082: _g_dbus_worker_do_read_cb (gdbusprivate.c:801)
==55299==

(power-profiles-daemon:55299): GLib-GObject-CRITICAL **: 10:48:10.427: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
2021-10-28 11:19:11 +02:00
Bastien Nocera
393cb81aa8 tests: Add test for HoldProfile when not authorised 2021-10-28 11:19:11 +02:00
Bastien Nocera
141d2ee64f tests: Rename test_not_allowed()
It only tests for the ActiveProfile authorisation.
2021-10-28 11:19:11 +02:00
Bastien Nocera
41f00d4ed5 main: Use f-string when listing profiles
As advised by pylint:
src/powerprofilesctl:144:19: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
2021-10-28 11:16:13 +02:00
Bastien Nocera
f83685732b build: Make pylint test optional
As power-profiles-daemon keeps getting built with slightly different
versions of pylint with newer warnings, disable pylint test by default
to avoid getting bug reports about it.

Closes: #52
2021-10-06 10:22:10 +02:00
Bastien Nocera
ea3faa1eab 0.10.0 2021-10-04 16:01:30 +02:00
Bastien Nocera
06af2327e4 README: Add mention of asusctl
See https://gitlab.freedesktop.org/hadess/power-profiles-daemon/-/issues/36
2021-10-04 15:11:18 +02:00
Bastien Nocera
2a25f7d4cd tests: Test when switch-profile permission isn't granted 2021-09-28 17:19:40 +02:00
Bastien Nocera
3aca4e9d01 main: Check whether user is allowed to perform action
Check whether a particular user/D-Bus client is allowed to switch
or hold power profiles.

Closes: #47
2021-09-28 13:07:49 +02:00
Bastien Nocera
bb92c628b4 tests: Start mock polkitd in the tests
And allow all us to perform all the actions.
2021-09-28 12:57:44 +02:00
Bastien Nocera
9d6e1735f3 data: Add polkit policy description
Describe and set defaults for switching and holding power profiles.
2021-09-28 12:55:59 +02:00
Bastien Nocera
112df0446d main: Print version on startup
Makes it easier to see startup too.
2021-09-07 23:00:12 +02:00
Bastien Nocera
50d1f5e03a tests: Split the integration test into individual tests
unittest_inspector.py lists the tests in the integration-test.py script,
which are then added as individual tests.
2021-09-07 23:00:12 +02:00
Bastien Nocera
e9f5b04258 tests: Rename integration test script
Add the python suffix.
2021-09-07 23:00:12 +02:00
Bastien Nocera
4ee64adc81 tests: Move test config file to a private directory
If we are to run all the tests in parallel, we need to make sure that
each instance of the daemon gets its own configuration file, otherwise
all of them will be trying to change each other's config behind their
backs.
2021-09-07 23:00:12 +02:00
Bastien Nocera
c48108763b tests: Remove extra spaces 2021-08-23 13:19:44 +02:00
Bastien Nocera
6701c99680 main: Update documentation for PpdDriver
The drivers have needed to handle all the profiles they support since
c7fb31632b where we stopped using a
placeholder driver when a profile wasn't handled.
2021-08-09 11:26:11 +02:00
Bastien Nocera
3fa5eafe57 README: Add mention of system76-power
Closes: #26
2021-08-06 18:42:15 +02:00
Bastien Nocera
42b3341b29 main: Follow pylint recommendation and use "with"
src/powerprofilesctl:185:4: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)

Closes: #35
2021-08-05 15:58:24 +02:00
Bastien Nocera
417c830355 README: Mention degraded mode for testing 2021-08-05 15:11:40 +02:00
Bastien Nocera
c7b05fa240 README: Simplify testing section by using powerprofilesctl 2021-08-05 15:11:36 +02:00
Bastien Nocera
6dab356723 README: Remove extra backticks
We already surrounded the command with triple-backticks.
2021-08-05 15:06:52 +02:00
Bastien Nocera
eee63cba70 README: Simplify debug commands
Use -r and -v so we don't have to stop existing instances manually.
2021-07-27 13:07:12 +02:00
Bastien Nocera
20a2d7f7b8 tests: Add tests for quiet profile support 2021-07-24 23:03:25 +02:00
Bastien Nocera
c9b646025d platform-profile: Add support for 'quiet' profile 2021-07-24 23:03:25 +02:00
Bastien Nocera
30d85f1e9e 0.9.0 2021-07-20 15:26:16 +02:00
Bastien Nocera
58cc0ef02b main: Implement profile persistence
Save the current user-selected profile in
/var/lib/power-profiles-daemon/state.ini

Closes: #23
2021-07-19 20:21:29 +02:00
Bastien Nocera
2a87e4be3c tests: Add another platform_profile helper 2021-07-19 20:21:29 +02:00
Bastien Nocera
12a6d18d99 main: Remove restoring profile from kernel
Remove restoring the problem from the on-disk kernel file, as was done
for the platform_profile, as we want to implement actual persistence
across reboots.

We need to be the ones saving that data, as the kernel doesn't know
whether the profile changes are temporary, or permanent, and whether the
user was the one initiating that change.
2021-07-19 20:21:29 +02:00
Bastien Nocera
bca6f4da50 main: Document that the Profiles property is sorted
It was always the case, as visible in the first, 0.1, release:
dfeeebc929/src/power-profiles-daemon.c (L109-134)
2021-07-19 20:13:48 +02:00
James
23157c2aa4 tests: Fix running test under Python 3.6
See https://docs.python.org/3/library/subprocess.html#subprocess.run :
Changed in version 3.7: [...] Added the capture_output parameter.

Closes: #33
2021-07-16 17:35:58 +02:00
Bastien Nocera
8944e16894 tests: Add test for launch command in cli tool 2021-07-16 12:39:27 +02:00
Bastien Nocera
64711bcf7b main: Add list-holds and launch commands 2021-07-16 12:39:27 +02:00
David Redondo
0d293373ed tests: Add test for Hold/ReleaseProfile
Tests holding and relasing of profiles and priority of holds of
different profiles.
2021-07-16 12:39:27 +02:00
David Redondo
58da7f5307 main: Implement Hold/ReleaseProfile
Make it possible for programmes to temporarily change the current
power profile, and "hold" that profile while they're performing a
task or waiting for an event to clear. This would be useful for:
- programmes with a finite workload to finish faster by investing more
  energy resources (eg. compiling software or transcoding media)
- programmes with near constantly high workloads to avoid the costs of
  transitioning between hardware profiles and causing stutters such
  as games or 3D modelling programmes
- OS components to force power-saver mode while battery energy is
  at a premium

Closes: #11

Co-Authored-By: Bastien Nocera <hadess@hadess.net>
2021-07-16 12:39:27 +02:00
Bastien Nocera
08f39e151e main: Remove unused inhibition switch reason 2021-07-05 11:04:33 +02:00
Bastien Nocera
99740ead2d main: Obsolete "Inhibited" property and add Degraded
The PerformanceInhibited property was there to convey that the
performance profile was unavailable, and that the daemon should switch
to a lower profile to avoid using the performance profile.

But it was difficult to communicate whether the daemon should switch
back to the performance profile when the inhibition disappeared, or
whether it should keep the same profile (the latter was what was
implemented).

There was also the problem that depending on the backend, the
performance profile might be able to provide a behaviour that wouldn't
match either of the unhampered performance profile, or the balanced
profile, but somewhere in between.

The PerformanceInhibited property is kept for compatibility reasons with
the existing consumer, GNOME 40. It will be removed in the future and
should not be relied on.

Closes: #24
2021-07-05 11:03:48 +02:00
Bastien Nocera
9ff59f0d1e placeholder: Ignore placeholder driver in the docs
Fixes a gtk-doc warning.
2021-07-05 10:59:56 +02:00
Bastien Nocera
73cbda3756 main: Fix PpdProfileActivationReason API docs
power-profiles-daemon/src/ppd-driver.h:37: warning: Value descriptions for PpdProfileActivationReason are missing in source code comment block.
2021-07-05 10:57:13 +02:00
Luca Stefani
ff0d147b76 platform-profile: Add debug on choices_path error case 2021-04-15 14:59:10 +02:00
Luca Stefani
3b0f72989b platform-profile: Fix crash if kernel built w/o platform_profile
If the kernel is built with platform_profile support,
g_file_get_contents() will fail, and we'll likely crash trying to
access ->message in the struct.

Don't forget to pass the error to g_file_get_contents().
2021-04-15 14:57:19 +02:00
Luca Stefani
24755fec0a build: Start using common_cflags
- Remove -Wall it's implied by warning_level=1
- Remove -std as it's implied by c_std
- Remove -fvisibility=hidden, we aren't a library
2021-04-15 13:20:56 +02:00