mirror of
https://gitlab.freedesktop.org/upower/power-profiles-daemon.git
synced 2026-05-09 07:08:10 +02:00
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.
This commit is contained in:
parent
86d087fb30
commit
1cbeca326e
2 changed files with 3 additions and 3 deletions
|
|
@ -101,7 +101,7 @@ verify_acpi_platform_profile_choices (void)
|
|||
return PPD_PROBE_RESULT_FAIL;
|
||||
}
|
||||
|
||||
choices = g_strsplit (choices_str, "\n", -1);
|
||||
choices = g_strsplit_set (choices_str, " \n", -1);
|
||||
if (g_strv_contains ((const char * const*) choices, "low-power") &&
|
||||
g_strv_contains ((const char * const*) choices, "balanced") &&
|
||||
g_strv_contains ((const char * const*) choices, "performance"))
|
||||
|
|
|
|||
|
|
@ -222,9 +222,9 @@ class Tests(dbusmock.DBusTestCase):
|
|||
acpi_dir = os.path.join(self.testbed.get_root_dir(), "sys/firmware/acpi/")
|
||||
os.makedirs(acpi_dir)
|
||||
with open(os.path.join(acpi_dir, "platform_profile") ,'w') as profile:
|
||||
profile.write("performance")
|
||||
profile.write("performance\n")
|
||||
with open(os.path.join(acpi_dir, "platform_profile_choices") ,'w') as choices:
|
||||
choices.write("low-power\nbalanced\nperformance\n")
|
||||
choices.write("low-power balanced performance\n")
|
||||
|
||||
def assertEventually(self, condition, message=None, timeout=50):
|
||||
'''Assert that condition function eventually returns True.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue