Commit graph

163 commits

Author SHA1 Message Date
Bastien Nocera
cea4e1a249 build: Add check-news.sh script 2021-04-01 10:30:39 +02:00
Bastien Nocera
915320e3cf intel-pstate: Disable on-battery behaviour
Because of the way gnome-shell's animation framework is built, setting
energy_performance_preference to balance_power has a visible impact
on the smoothness of animations, as the CPU will clock down too quickly
between frames, leading to the appearance of a performance regression.

Disable the on-battery behaviour until gnome-shell is fixed to avoid
being accused of slowing systems down.

See https://gitlab.freedesktop.org/hadess/power-profiles-daemon/-/issues/28#note_862766
2021-04-01 10:14:18 +02:00
Bastien Nocera
510951ab6c 0.8 2021-03-22 11:45:05 +01:00
Bastien Nocera
d00d02c951 ci: Export dist'ed tarballs too 2021-03-22 11:45:05 +01:00
Bastien Nocera
1883a773a1 fake: Print debug when fake driver profile is activated 2021-03-19 17:31:14 +01:00
Bastien Nocera
c318eacbb0 main: Move activation reason helper to PpdDriver 2021-03-19 17:31:14 +01:00
Bastien Nocera
a53fa663c9 ci: Don't install unused build dependencies 2021-03-19 17:26:42 +01:00
Bastien Nocera
62a8116989 main: Pass reason for profile change
When activating a new profile.
2021-03-19 14:22:16 +01:00
Bastien Nocera
334e64ea64 main: Add PpdProfileActivationReason enum 2021-03-19 14:22:16 +01:00
Bastien Nocera
2fbf57b9bd tests: Simplify reading platform_profile value
Which allows us to ignore trailing spaces in the sysfs attribute, as
power-profiles-daemon writes those mock files without a linefeed, but
the real kernel (or some of our setup functions) would always append
a linefeed.
2021-03-19 13:18:43 +01:00
Bastien Nocera
d650d2e6b9 tests: Add helper which strips trailing newlines from sysfs attributes
This will come in handy.
2021-03-19 13:18:43 +01:00
Bastien Nocera
4fc05c84d6 main: Don't throw an error if we select the same profile twice
Just say it worked if we've already selected this profile.
2021-03-19 13:03:16 +01:00
Bastien Nocera
f35453ad2d placeholder: More indentation
Every couple of days, indentation gets broken, and we fix it, like a
rake evening out the stones in our meditation garden.
2021-03-19 13:03:16 +01:00
Bastien Nocera
67be161793 main: Remove early setting of active_profile
The active profile setting might fail, and we already set it in the
function we call 2 lines below. This avoids the debug function in
activate_target_profile() saying the profile we activate is already the
current one.
2021-03-19 13:03:16 +01:00
Bastien Nocera
c7fb31632b main: Use a single driver for all the profiles
Of all the drivers that we've implemented, not a single one needed to
have different drivers to handle its different profiles, so simplify
things by having all the profiles be handled by a unique driver.

We still have separate drivers for separate types of hardware.
2021-03-19 11:06:37 +01:00
Martin Pitt
225d6e51d5 tests: Close leaked "unclosed file"
Fixes warning:
/usr/lib64/python3.9/unittest/case.py:550: ResourceWarning: unclosed file <_io.BufferedReader name=10>
  method()

See https://github.com/martinpitt/python-dbusmock/issues/67#issuecomment-800979091
2021-03-17 14:10:18 +01:00
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