Prevent platform profile error on unsupported systems

If a system does not support setting the platform profile (i.e., does
not have the file /sys/firmware/acpi/platform_profile), then everything
that interacts with it is skipped to prevent errors. This situation is
more common than I expected.[1]

[1] https://github.com/FeralInteractive/gamemode/issues/524
This commit is contained in:
MithicSpirit
2025-03-12 13:11:39 -04:00
committed by afayaz-feral
parent 5f691c3171
commit 499af4c7bb
4 changed files with 28 additions and 4 deletions

View File

@@ -317,7 +317,7 @@ static int game_mode_set_governor(GameModeContext *self, enum GameModeGovernor g
static void game_mode_store_profile(GameModeContext *self)
{
if (self->current_profile != GAME_MODE_PROFILE_DEFAULT)
if (!profile_exists() || self->current_profile != GAME_MODE_PROFILE_DEFAULT)
return;
const char *initial_state = get_profile_state();
@@ -335,6 +335,11 @@ static int game_mode_set_profile(GameModeContext *self, enum GameModeProfile pro
return 0;
}
if (!profile_exists()) {
LOG_MSG("Setting platform profile unsupported; skipping\n");
return 0;
}
const char *prof_str = NULL;
char prof_config_str[CONFIG_VALUE_MAX] = { 0 };
switch (prof) {