Skip to content

Commit

Permalink
Merge pull request #629 from zacikpa/ppd-bug-fixes
Browse files Browse the repository at this point in the history
Bug fixes in tuned-ppd
  • Loading branch information
yarda authored May 23, 2024
2 parents de2cf68 + 31b21ed commit c523813
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tuned/ppd/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def remove(self, cookie):
self._controller.switch_profile(new_profile)

def clear(self):
for cookie in self._holds:
for cookie in list(self._holds.keys()):
self._cancel(cookie)


Expand Down Expand Up @@ -125,12 +125,10 @@ def setup_battery_signaling(self):

def _check_performance_degraded(self):
performance_degraded = PerformanceDegraded.NONE
if os.path.exists(NO_TURBO_PATH):
if int(self._cmd.read_file(NO_TURBO_PATH)) == 1:
performance_degraded = PerformanceDegraded.HIGH_OPERATING_TEMPERATURE
if os.path.exists(LAP_MODE_PATH):
if int(self._cmd.read_file(LAP_MODE_PATH)) == 1:
performance_degraded = PerformanceDegraded.LAP_DETECTED
if os.path.exists(NO_TURBO_PATH) and self._cmd.read_file(NO_TURBO_PATH).strip() == "1":
performance_degraded = PerformanceDegraded.HIGH_OPERATING_TEMPERATURE
if os.path.exists(LAP_MODE_PATH) and self._cmd.read_file(LAP_MODE_PATH).strip() == "1":
performance_degraded = PerformanceDegraded.LAP_DETECTED
if performance_degraded != self._performance_degraded:
log.info("Performance degraded: %s" % performance_degraded)
self._performance_degraded = performance_degraded
Expand All @@ -155,6 +153,7 @@ def terminate(self):

def load_config(self):
self._config = PPDConfig(PPD_CONFIG_FILE)
log.debug("Setting base profile to %s" % self._config.default_profile)
self._base_profile = self._config.default_profile
self.switch_profile(self._config.default_profile)
if self._config.battery_detection:
Expand Down Expand Up @@ -194,6 +193,7 @@ def ProfileReleased(self, cookie):
def set_active_profile(self, profile):
if profile not in self._config.ppd_to_tuned:
raise dbus.exceptions.DBusException("Invalid profile '%s'" % profile)
log.debug("Setting base profile to %s" % profile)
self._base_profile = profile
self._profile_holds.clear()
self.switch_profile(profile)
Expand Down

0 comments on commit c523813

Please sign in to comment.