From 95489e28d096039e22d1a42e12b1cd938f48d568 Mon Sep 17 00:00:00 2001 From: Mert Can Demir Date: Tue, 24 Mar 2020 22:53:10 +0300 Subject: [PATCH] Fix the EPP error for older CPUs (#48) --- source/core.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/source/core.py b/source/core.py index 4057ea9..61c6db8 100644 --- a/source/core.py +++ b/source/core.py @@ -186,9 +186,11 @@ def countdown(s): # set powersave and enable turbo def set_powersave(): - print("Setting to use: powersave") + print("Setting to use: \"powersave\" governor") s.run("cpufreqctl --governor --set=powersave", shell=True) - s.run("cpufreqctl --epp --set=balance_power", shell=True) + if (os.path.exists("/sys/devices/system/cpu/cpu0/cpufreq/energy_performance_preference")): + s.run("cpufreqctl --epp --set=balance_power", shell=True) + print("Setting to use: \"balance_power\" EPP") # get system/CPU load load1m, _, _ = os.getloadavg() @@ -250,7 +252,10 @@ def mon_powersave(): def set_performance(): print("Setting to use \"performance\" governor") s.run("cpufreqctl --governor --set=performance", shell=True) - s.run("cpufreqctl --epp --set=balance_performance", shell=True) + if (os.path.exists("/sys/devices/system/cpu/cpu0/cpufreq/energy_performance_preference")): + s.run("cpufreqctl --epp --set=balance_performance", shell=True) + print("Setting to use: \"balance_performance\" EPP") + # get system/CPU load load1m, _, _ = os.getloadavg() @@ -465,4 +470,4 @@ def running_daemon(): exit(1) elif os.getenv("PKG_MARKER") == "SNAP" and dcheck == "enabled": deploy_complete_msg() - exit(1) \ No newline at end of file + exit(1)