Skip to content

Commit

Permalink
Fix empty temp sensor files (#341)
Browse files Browse the repository at this point in the history
  • Loading branch information
yubiuser committed Apr 7, 2023
2 parents 1778193 + 05cfda1 commit 95e6b2d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions padd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,15 @@ GetSystemInformation() {

# CPU temperature
if [ -d "/sys/devices/platform/coretemp.0/hwmon/" ]; then
cpu=$(cat "$(find /sys/devices/platform/coretemp.0/hwmon/ -maxdepth 2 -name "temp1_input" 2>/dev/null | head -1)")
elif [ -f /sys/class/thermal/thermal_zone0/temp ]; then
cpu=$(cat "$(find /sys/devices/platform/coretemp.0/hwmon/ -maxdepth 2 -name "temp1_input" 2>/dev/null | head -1)" 2>/dev/null)
fi
if [ -z "${cpu}" ] && [ -f /sys/class/thermal/thermal_zone0/temp ]; then
cpu=$(cat /sys/class/thermal/thermal_zone0/temp)
elif [ -f /sys/class/hwmon/hwmon0/temp1_input ]; then
fi
if [ -z "${cpu}" ] && [ -f /sys/class/hwmon/hwmon0/temp1_input ]; then
cpu=$(cat /sys/class/hwmon/hwmon0/temp1_input)
else
fi
if [ -z "${cpu}" ]; then
cpu=0
fi

Expand Down

0 comments on commit 95e6b2d

Please sign in to comment.