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.
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.
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
When transitioning from one profile to another, we only want to stop the
active profile from changing if the target profile is inhibited, which
it might not be if we want to switch to, say, the power-saver profile.
This was broken since drivers could handle more than one profile.
../src/ppd-utils.c: In function 'ppd_utils_write_sysfs':
../src/ppd-utils.c:36:3: error: format not a string literal and no format arguments [-Werror=format-security]
36 | ret = fprintf (sysfsfp, value);
| ^~~
Similarly to "main: Remove profile specificity from actions", run
activation on all the drivers when switching profiles, so a driver can
eventually handle multiple profiles.
The declaration was still using the old name.
src/ppd-action-trickle-charge.c: In function ‘set_charge_type’:
src/ppd-action-trickle-charge.c:61:5: warning: implicit declaration of function ‘ppd_utils_write_sysfs’ [-Wimplicit-function-declaration]
61 | ppd_utils_write_sysfs (dev, CHARGE_TYPE_SYSFS_NAME, charge_type, NULL);
| ^~~~~~~~~~~~~~~~~~~~~
Run "deactivate" on all the actions that don't correspond to the initial
selected profile so that non-power-saving get correctly applied if
they're not the default.