|
@@ -173,27 +173,17 @@ func getCPUFreq() string {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func getCPUTemperature() string {
|
|
func getCPUTemperature() string {
|
|
|
- files, _ := filepath.Glob("/sys/class/thermal/thermal_zone*/temp")
|
|
|
|
|
-
|
|
|
|
|
- max := 0
|
|
|
|
|
-
|
|
|
|
|
- for _, f := range files {
|
|
|
|
|
- data, err := os.ReadFile(f)
|
|
|
|
|
- if err != nil {
|
|
|
|
|
- continue
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- temp, err := strconv.Atoi(strings.TrimSpace(string(data)))
|
|
|
|
|
- if err == nil && temp > max {
|
|
|
|
|
- max = temp
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ data, err := os.ReadFile("/sys/class/thermal/thermal_zone0/temp")
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ return noValue
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if max == 0 {
|
|
|
|
|
|
|
+ temp, err := strconv.Atoi(strings.TrimSpace(string(data)))
|
|
|
|
|
+ if err != nil {
|
|
|
return noValue
|
|
return noValue
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- return fmt.Sprintf("%d℃", max/1000)
|
|
|
|
|
|
|
+ return fmt.Sprintf("%d℃", temp/1000)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func getMemInfo() (int, string, string) {
|
|
func getMemInfo() (int, string, string) {
|