Commit graph

127 commits

Author SHA1 Message Date
Bastien Nocera
45ad07eb9b main: Add powerprofilesctl command-line tool 2021-03-12 08:59:34 +01:00
Bastien Nocera
2569d8e59f tests: Add test for the deferred probe 2021-02-09 10:06:43 +01:00
Bastien Nocera
e06ad1ea65 platform-profile: Handle kernel driver being loaded after we start
Closes: #22
2021-02-09 09:57:55 +01:00
Bastien Nocera
f3be2c760b main: Catch "probe-request" signal and restart drivers
Restart all the drivers when a "probe-request" comes in. This is pretty
inefficient, but it should happen at most once in a session, if ever at
all, depending on how fast the kernel driver gets loaded.
2021-02-09 09:56:38 +01:00
Bastien Nocera
02a2e6363c main: Add "probe-request" signal
This should be emitted by PROBE_RESULT_DEFER drivers when the device
becomes available.
2021-02-09 09:55:44 +01:00
Bastien Nocera
a1e77b7186 platform-profile: Stylistic fixes
Fix indentation caused by the renaming of the driver, as well as driver
being assigned to a "dytc" variable.
2021-02-09 09:44:46 +01:00
Bastien Nocera
5b11c24695 main: Change probe result to have 4 states
Including a "defer" result which we'll soon be using.
2021-02-09 09:41:01 +01:00
Bastien Nocera
da1e08e68e fake: Add key press to stop and start profile drivers
This would be what we ultimately use to re-probe for the
platform_profile once registered.
2021-02-08 17:27:37 +01:00
Bastien Nocera
f75d35f756 main: Add helper to stop the running drivers 2021-02-08 17:23:09 +01:00
Bastien Nocera
0c576e3467 main: Split off detecting and starting drivers 2021-02-08 17:23:09 +01:00
Bastien Nocera
a6e9299a8a main: Move main_loop to app data structure 2021-02-08 17:22:30 +01:00
Bastien Nocera
6236c1bccf main: Exit with 1 if there are startup D-Bus errors
If there are D-Bus errors on startup such as the daemon already being
started, make main() return with an error.
2021-02-08 16:58:41 +01:00
Bastien Nocera
74bfb0fd32 main: Exit the mainloop on error rather than simply exiting 2021-02-08 16:47:44 +01:00
Bastien Nocera
ec1188d347 lenovo-dytc: Rename to platform-profile
As the only Lenovo DYTC specific interface is now optional, rename the
driver.
2021-02-08 16:01:18 +01:00
Bastien Nocera
3b949722e9 tests: Remove dytc_lapmode creation from tests
This ensures that commit "lenovo-dytc: Make dytc_lapmode proximity
sensor optional" works as expected.
2021-02-08 15:58:04 +01:00
Bastien Nocera
24e03e5c2d lenovo-dytc: Make dytc_lapmode proximity sensor optional
So that the driver can work on any device with a platform_profile
driver.
2021-02-08 15:57:53 +01:00
Bastien Nocera
faa555d4e5 lenovo-dytc: Better debug on probe failure 2021-02-08 15:53:00 +01:00
Bastien Nocera
7efbfec6fc tests: Split off creation of platform_profile from dytc device
As the proximity sensor should be optional.
2021-02-08 15:25:11 +01:00
Bastien Nocera
8c5e48ff81 ci: Use libgudev from rawhide
Now that it's landed, no need to compile our own.
2021-01-15 12:39:28 +01:00
Bastien Nocera
19199f8673 tests: Remove extra debug 2020-11-19 17:32:13 +01:00
Bastien Nocera
4242f2a127 lenovo-dytc: Use new ACPI platform_profile API
See https://patchwork.kernel.org/project/platform-driver-x86/patch/20201115004402.342838-1-markpearson@lenovo.com/
2020-11-19 17:32:13 +01:00
Bastien Nocera
28ae49375d build: Pass top_srcdir to test suite 2020-11-19 17:32:13 +01:00
Bastien Nocera
169a8cd788 tests: Factor out creation of dytc device 2020-11-19 17:32:13 +01:00
Bastien Nocera
d9beb68863 intel-pstate: Simplify code using new UMOCKDEV_DIR helper 2020-11-19 17:06:27 +01:00
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