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 { func (h *HardDrive) GetTemperature() int {
// Try HDD/SSD path
temp, found := h.getTemperatureFromPath("/sys/block/" + h.Name + "/device/hwmon/") possiblePaths := []string{
if found { "/sys/block/" + h.Name + "/device/hwmon/",
return temp "/sys/block/" + h.Name + "/device/",
"/sys/block/" + h.Name + "/device/generic/device/",
} }
// Try NVMe path for _, path := range possiblePaths {
temp, found = h.getTemperatureFromPath("/sys/block/" + h.Name + "/device/") // Try HDD/SSD path
if found { temp, found := h.getTemperatureFromPath(path)
return temp if found {
return temp
}
} }
fmt.Printf("[🛑] Failed to get temperature for %s\n", h.Name) fmt.Printf("[🛑] Failed to get temperature for %s\n", h.Name)