Files
Pulse/internal/sensors/temperature_input.go
pulse-triage[bot] 66fa10fd1a Keep non-temperature sensor inputs out of Celsius readings
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
2026-10-30 14:18:25 +00:00

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
}