Skip to content

Commit

Permalink
Fix CPU temp sensors
Browse files Browse the repository at this point in the history
  • Loading branch information
shadeyg56 committed Mar 1, 2025
1 parent beafca2 commit 6be1547
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 3 additions & 1 deletion auto_cpufreq/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@
IS_INSTALLED_WITH_AUR = path.isfile("/etc/arch-release") and bool(getoutput("pacman -Qs auto-cpufreq"))
IS_INSTALLED_WITH_SNAP = getenv("PKG_MARKER") == "SNAP"
POWER_SUPPLY_DIR = "/sys/class/power_supply/"
SNAP_DAEMON_CHECK = getoutput("snapctl get daemon")
SNAP_DAEMON_CHECK = getoutput("snapctl get daemon")

CPU_TEMP_SENSOR_PRIORITY = ("coretemp", "acpitz", "k10temp", "zenpower")
9 changes: 8 additions & 1 deletion auto_cpufreq/modules/system_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from auto_cpufreq.core import get_power_supply_ignore_list
from auto_cpufreq.globals import (
AVAILABLE_GOVERNORS_SORTED,
CPU_TEMP_SENSOR_PRIORITY,
IS_INSTALLED_WITH_SNAP,
POWER_SUPPLY_DIR,
)
Expand Down Expand Up @@ -104,7 +105,13 @@ def get_cpu_info() -> List[CoreInfo]:

try:
temps = psutil.sensors_temperatures()
core_temps = [temp.current for temp in temps.get("coretemp", [])]
temp_sensor = []
for sensor in CPU_TEMP_SENSOR_PRIORITY:
temp_sensor = temps.get(sensor, [])
if temp_sensor != []:
break

core_temps = [temp.current for temp in temp_sensor]
except AttributeError:
core_temps = []

Expand Down

0 comments on commit 6be1547

Please sign in to comment.