Commit graph

103 commits

Author SHA1 Message Date
Bastien Nocera
f1eb273ab0 utils: Add helper to get mocked absolute sysfs paths
Absolute sysfs paths aren't captured through umockdev, and we need to
look for them under $UMOCKDEV_DIR ourselves, so add a helper for that.
2020-11-19 17:06:27 +01:00
Bastien Nocera
c8b303406c intel-pstate: Fix paths when running under umockdev
UMOCKDEV_DIR is the mock root directory, not the mock /sys directory.
2020-11-05 17:00:54 +01:00
Bastien Nocera
85c94a6993 tests: Remove libtool usage
There's never any need for us to use libtool to spawn the daemon, we
don't use autotools.
2020-11-05 11:06:31 +01:00
Bastien Nocera
2e9f89c462 lenovo-dytc: Use new udev "find" helper 2020-11-05 10:59:38 +01:00
Bastien Nocera
456e7dac04 utils: Add helper to find a specific device in a list
To simplify open-coded devices checking loops.
2020-11-05 10:59:38 +01:00
Bastien Nocera
1ab29169a9 fake: Fix terminal breakage when not enabled
It ignores Ctrl+C and breaks the terminal output even when unused. Don't
restore a terminal setup that wasn't initialised.
2020-09-15 18:06:52 +02:00
Bastien Nocera
f343f4be04 main: And listen to "profile-changed" signal
This should allow drivers to change their profile internally, and
trickle back up to the UI, such as when using keyboard shortcuts.

Closes: #15
2020-09-15 15:29:05 +02:00
Bastien Nocera
c7e984403d tests: Remove unused uevents
The real kernel driver doesn't emit uevents when the state changes, just
file change notifications, so there's no need to emit those events
anymore.
2020-09-15 15:29:05 +02:00
Bastien Nocera
4112871377 lenovo-dytc: Correctly monitor dytc attributes
And emit a signal when the performance profile was changed under us,
by a key combination for example.

The kernel driver doesn't emit uevents, but there are file change
notifications for the individual attributes, so listen to those.
2020-09-15 15:29:05 +02:00
Bastien Nocera
44c8c17904 utils: Add sysfs attribute monitor helper 2020-09-15 15:29:05 +02:00
Bastien Nocera
4c98dee979 main: Add "profile-changed" signal
To be used when the driver has detected that its own profile changed
without user involvement.
2020-09-15 15:29:05 +02:00
Bastien Nocera
7f74321381 lenovo-dytc: Use new gudev helper 2020-09-15 15:29:05 +02:00
Bastien Nocera
b219d729d7 tests: Crash if there are warnings in the daemon 2020-09-15 11:51:11 +02:00
Bastien Nocera
07ad49a0f8 tests: Remove a number of uses of have_text_in_log()
have_text_in_log() just checks for the presence of that string in the
log for the *whole* test, not just for that text to appear. We should be
checking the number of instances before the change and after the change
if we wanted to do this well, but it's easier to wait a little for a
property change on the D-Bus interface.
2020-09-15 11:51:04 +02:00
Bastien Nocera
7b5321131a README: Some layout fixes 2020-09-14 13:42:21 +02:00
Bastien Nocera
35f0c41a63 README: Add slimbookbattery section
See https://twitter.com/davidgxxl/status/1305203186068848642 and
https://slimbook.es/tutoriales/aplicaciones-slimbook/100-slimbook-battery-3-app-optimizar-bateria-portatil#modo-avanzado
2020-09-14 13:03:32 +02:00
Bastien Nocera
b1e33ea10c README: Fix example command-line
Closes: #18
2020-09-14 10:42:20 +02:00
Bastien Nocera
baad70f81b README: Some editorial changes 2020-09-10 16:29:45 +02:00
Bastien Nocera
dfeeebc929 data: Tell service whether to restart 2020-09-09 13:50:48 +02:00
Bastien Nocera
27af826a71 data: Tell service when and how to start 2020-09-09 13:50:48 +02:00
Bastien Nocera
ea4821c087 lenovo-dytc: Also handle "balanced" profiles
The driver does have a "balanced" profile it deals with.
2020-09-09 12:33:20 +02:00
Bastien Nocera
ebf9e5b7c8 lenovo-dytc: Implement perfmode
Implement dytc_perfmode, as per https://patchwork.kernel.org/patch/11678983/
2020-09-09 12:33:20 +02:00
Bastien Nocera
953eb716fd tests: Fix tests for lenovo_dytc driver changes
We'll also need a dytc_perfmode sysfs file to have a working lenovo_dytc
PpdDriver.
2020-09-09 12:33:20 +02:00
Bastien Nocera
d6ef7bcfc8 tests: Fix one of the tests for slower machines
======================================================================
FAIL: test_intel_pstate_balance (__main__.Tests)
Intel P-State driver (balance)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/power-profiles-daemon-0.1/tests/integration-test", line 375, in test_intel_pstate_balance
    self.assertEqual(contents, b'balance_power')
AssertionError: b'' != b'balance_power'
----------------------------------------------------------------------
2020-09-09 11:39:45 +02:00
Bastien Nocera
95a67713cf intel-pstate: Inhibit perf mode when overheating
thermald can disable turbo altogether if needed to avoid reaching
too high operating temperatures, so make the p-state driver monitor
this, and mark the performance mode as inhibited if "no_turbo" is
set.

Closes: #14
2020-09-08 18:09:04 +02:00
Bastien Nocera
82141045e3 main: Add "high temperature" inhibition reason 2020-09-08 18:08:30 +02:00
Bastien Nocera
9980f5a9f3 docs: Update D-Bus API introduction
And link to the new README.md
2020-09-04 16:27:55 +02:00
Bastien Nocera
8b6e766e94 docs: Don't document the internal Intel P-State driver 2020-09-04 16:19:53 +02:00
Bastien Nocera
6d2ede54e0 main: Add PpdAction API docs 2020-09-04 16:19:52 +02:00
Bastien Nocera
8a0be71e6c main: Add PpdDriver API docs 2020-09-04 16:19:50 +02:00
Bastien Nocera
5404f4d46e README: Explain reason for existence 2020-09-04 16:19:46 +02:00
Bastien Nocera
38df9b32ce docs: Don't document object methods
They're only going to be used by the core daemon, not during
implementation of the actions or drivers.
2020-09-04 15:57:12 +02:00
Bastien Nocera
72b5c548ea docs: Build internal API documentation 2020-09-04 15:57:12 +02:00
Bastien Nocera
42d130494a main: Build a uninstalled solib for gtk-doc 2020-09-04 15:57:12 +02:00
Bastien Nocera
e8b9bc324c data: Also conflict with auto-cpufreq
As it might change the p-state configuration behind us.

See: 74c74b8cf9
2020-09-04 15:57:12 +02:00
Bastien Nocera
8243b945ce tests: Add tests for on-battery P-State driver 2020-09-04 15:10:16 +02:00
Bastien Nocera
3af71eb131 intel-pstate: Monitor battery status to choose right balanced pref
Prefer "balance_performance" p-state preference when the machine is on
mains, and "balance_power" when it's on battery.
2020-09-04 15:10:16 +02:00
Bastien Nocera
cbde91c758 ci: Add upower-glib package to CI 2020-09-04 15:10:16 +02:00
Bastien Nocera
45ccd0b230 tests: Add Intel P-State driver tests 2020-09-04 15:10:16 +02:00
Bastien Nocera
09283442cd main: Add intel_pstate-based driver
Intel's p-state driver provides "Energy vs. Performance" hints that
user-space can use to set a policy for the P-state selection logic.
On all supported Intel systems that should have a range from "power"
to "performance" with steps in between.

Depending on the selected profile, performance or power will be selected
for the equivalent power profile.

See https://www.kernel.org/doc/html/v4.12/admin-guide/pm/intel_pstate.html#energy-vs-performance-hints
and https://www.kernel.org/doc/html/v4.12/admin-guide/pm/intel_pstate.html#turbo-p-states-support

Closes: #13
2020-09-04 15:01:30 +02:00
Bastien Nocera
369723f6d7 utils: Add ppd_utils_write() helper function 2020-09-01 15:58:42 +02:00
Bastien Nocera
85b5dafaa7 fake: Add a way to quit from interactive fake driver 2020-08-13 17:23:50 +02:00
Bastien Nocera
60f875ad60 main: Add --replace and --verbose command-line options 2020-08-13 17:23:50 +02:00
Bastien Nocera
8b3d366219 main: Get rid of "SelectedProfile" property
The original idea was to have a "SelectedProfile" property that would be
settable by the user, but could be different from the "ActiveProfile" if
the hardware's performance mode wasn't available for example.

It turns out that having 2 separate states makes for very confusing UI,
so if the performance profile becomes inhibited and it's the current one,
the active profile will automatically switch to balanced and stay there.
2020-08-12 16:55:58 +02:00
Bastien Nocera
a531044de4 main: Add fake performance driver 2020-08-12 15:31:54 +02:00
Bastien Nocera
f5b489aaf9 tests: Test previous commit fix
Test for "main: Fix PerformanceInhibited property not being up-to-date"
2020-08-12 15:22:41 +02:00
Bastien Nocera
499aaada6c main: Fix PerformanceInhibited property not being up-to-date
When something other than the performance profile was selected, the
PerformanceInhibited property was never set or updated. This meant that
front-ends couldn't make the performance mode temporarily unavailable
to the user.
2020-08-12 15:22:41 +02:00
Bastien Nocera
97f449a497 main: Add "Actions" property
That allows API users to programmatically check whether a particular
functionality is implemented in the daemon, eg. if we wanted to move
GPU performance modes from gamemode to this daemon, gamemode could
query whether that feature was implemented and available in the backend.

Closes: #12
2020-08-12 11:31:34 +02:00
Bastien Nocera
e347845096 main: Rename Inhibited to PerformanceInhibited
Make it clear that we don't expect any profile to ever be inhibited,
apart from the performance profile.
2020-08-10 16:42:07 +02:00
Bastien Nocera
bc2961a406 tests: Test "Fix transitions if one profile is inhibited" 2020-08-10 15:43:20 +02:00