Fixed major bug

* Resolved the hwmon not found problem
This commit is contained in:
Daniel Legt 2024-01-22 12:39:31 +02:00
parent d6588742d3
commit de08a7f970
1 changed files with 11 additions and 8 deletions

View File

@ -44,16 +44,19 @@ type Snapshots struct {
}
func (h *HardDrive) GetTemperature() int {
possiblePaths := []string{
"/sys/block/" + h.Name + "/device/hwmon/",
"/sys/block/" + h.Name + "/device/",
"/sys/block/" + h.Name + "/device/generic/device/",
}
for _, path := range possiblePaths {
// Try HDD/SSD path
temp, found := h.getTemperatureFromPath("/sys/block/" + h.Name + "/device/hwmon/")
temp, found := h.getTemperatureFromPath(path)
if found {
return temp
}
// Try NVMe path
temp, found = h.getTemperatureFromPath("/sys/block/" + h.Name + "/device/")
if found {
return temp
}
fmt.Printf("[🛑] Failed to get temperature for %s\n", h.Name)