parent
d6588742d3
commit
de08a7f970
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue