Commit graph

147 commits

Author SHA1 Message Date
Bastien Nocera
4c86f30cda tests: Add HP WMI test 2021-03-17 13:25:30 +01:00
Bastien Nocera
2095f03c8c platform-profile: Handle "cool" platform_profile
Handle "cool" platform_profile the same way we do "low-power". This
fixes the platform_profile driver not being probed successfully with the
new HP WMI driver.

See https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/commit/?h=for-next&id=4296f679ca50f97c4973715f1e9e72357d2eb251

Closes: #20
2021-03-17 13:25:30 +01:00
Bastien Nocera
d3b84091a8 platform-profile: Save the available profile choices
Save the available profile choices so that we can make sure to only try
to set ones that are available.
2021-03-17 13:21:49 +01:00
Bastien Nocera
a12820ab4f platform-profile: Restore existing profile on start 2021-03-16 17:11:37 +01:00
Bastien Nocera
d99a0f774a platform-profile: Split off reading active platform_profile
To make it easier to re-use.
2021-03-16 17:08:33 +01:00
Bastien Nocera
57ee7a9e50 main: Restore profile from kernel configuration
When possible, try to restore the previous profile from the kernel
configuration. This makes it easier to force a profile in a startup
script, or pick up in the same configuration if power-profiles-daemon
was restarted for some reason.

Note that this does not save the active profile across reboots (a
systemd unit could be used for that if necessary), and that it will
likely apply the wrong profile if the daemon crashed when an inhibition
or a profile hold were in place.

Closes: #5
2021-03-16 16:59:26 +01:00
Bastien Nocera
c06f53cadc tests: Add missing trailing linefeeds to platform_profile tests 2021-03-16 16:50:37 +01:00
Bastien Nocera
59c5bc1749 tests: Add missing trailing linefeeds to intel-pstate tests 2021-03-16 16:50:37 +01:00
Bastien Nocera
b3ab935ac8 intel-pstate: Fix inhibition not being detected
We should have inhibited the performance profile when "no_turbo" was set
to "1", but we didn't take the linefeed into account, so we never
actually read that value.
2021-03-16 16:49:36 +01:00
Bastien Nocera
0e02519880 balanced: Fix indentation 2021-03-16 16:34:31 +01:00
Hans de Goede
efa7e4f48e platform-profile: Fix ThinkPad lapmode detection with libgudev <= 234
g_udev_device_get_sysfs_attr_as_boolean_uncached in libgudev <= 234 does
not work, see: https://gitlab.gnome.org/GNOME/libgudev/-/issues/7

Since the dytc_lapmode file always contains an integer 0/1 value we
can easily workaround this libgudev issue by switching to
g_udev_device_get_sysfs_attr_as_int_uncached.

Also update the tests to include the '\n' for the dytc_lapmode sysfs
attribute values, like on real hardware.
2021-03-16 12:06:30 +01:00
Hans de Goede
1cbeca326e platform-profile: Fix the driver to work with real hardware
The platform_profile_choices sysfs file contains the available profiles
separated by spaces, not newlines, with a newline at the end (as all
text based sysfs files have a newline at the end).

Replace the g_strsplit(..., "\n", -1) with a g_strsplit_set (..., " \n", -1)
so that the choices get split on the spaces, and the trailing "\n" gets
discarded.

Also update the integration-test to match.
2021-03-16 12:06:28 +01:00
Bastien Nocera
86d087fb30 main: Namespace ProbeResult
And add PpdProbeResult to the API documentation.
2021-03-15 14:00:53 +01:00
Bastien Nocera
07dbe8e8da tests: Change platform_profile in the right order
Change platform_profile_choices before platform_profile, so we only get
probed when all the profile choices are available.

This behaviour is similar to what the kernel drivers do, setting up
the bitmask of choices, before running platform_profile_register().
2021-03-15 13:18:17 +01:00
Bastien Nocera
8a25eb43de platform-profile: Print debug when deferring probe 2021-03-15 12:53:54 +01:00
Bastien Nocera
556b8b3f98 tests: Work-around profiles reload taking too long 2021-03-15 12:38:55 +01:00
Bastien Nocera
862c7db8a8 ci: Add pylint to run pylint test 2021-03-15 12:17:37 +01:00
Bastien Nocera
29b8b52308 ci: Remove unknown meson option 2021-03-15 12:16:21 +01:00
Bastien Nocera
97325e12ed ci: Export test logs from CI 2021-03-15 12:09:46 +01:00
Bastien Nocera
3d1b91eb2c main: Run new script through pylint 2021-03-12 08:59:38 +01:00
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