mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-12-03 18:43:38 +01:00
Use native tempN_input subfeatures in both Linux temperature parsers. Keep real CPU, core, GPU, NVMe and additional readings and fan RPM intact, with complete-report and unit-spoofing regressions. Refs #3570. Product intelligence retains reproduced-fix, published-stable and issue-disposition follow-through; this source change does not close it before release. Change-source: pulse-maintainer
20 lines
553 B
Go
20 lines
553 B
Go
package sensors
|
|
|
|
import "strings"
|
|
|
|
// IsTemperatureInput identifies an lm-sensors temperature subfeature by its
|
|
// native tempN_input key. The displayed feature label can be arbitrary; a
|
|
// fan, voltage, current or power input does not acquire Celsius units from it.
|
|
func IsTemperatureInput(key string) bool {
|
|
index := strings.TrimSuffix(strings.TrimPrefix(key, "temp"), "_input")
|
|
if index == "" || key != "temp"+index+"_input" {
|
|
return false
|
|
}
|
|
for _, digit := range index {
|
|
if digit < '0' || digit > '9' {
|
|
return false
|
|
}
|
|
}
|
|
return true
|
|
}
|