Repository navigation
CPU (Linux): fixes x86_pkg_temp and cputemp.* temperature detection - #2774
Merged
CarterLi merged 1 commit intoDec 1, 2026
Merged
Conversation
`parseTZDir` reads `/sys/class/thermal/thermal_zone*/type` without trimming the trailing newline sysfs appends, so `ffStrbufEqualS(buffer, "x86_pkg_temp")` never matched. Trim trailing whitespace like `parseHwmonDir` does. `detectCPUTemp` also opened `/sys/class/platform/` when `tempSensor` started with `cputemp.`, which does not exist in Linux sysfs. Open `/sys/devices/platform/` to match the auto-detection loop below it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes two cases in
src/detection/cpu/cpu_linux.cwhere Linux CPU temperature detection always returns unset:parseTZDir()reads/sys/class/thermal/thermal_zone*/typewithout trimming the trailing\nfrom sysfs, soffStrbufEqualS(buffer, "x86_pkg_temp")never matches. Trimming trailing whitespace fixes it, matchingparseHwmonDir().detectCPUTemp()opens/sys/class/platform/whentempSensorstarts withcputemp., which doesn't exist in Linux sysfs. Opening/sys/devices/platform/matches the auto-detection loop below it.I verified both cases in an
unshare --user --map-root-user --mountnamespace with bind-mounted sysfs fixtures: an empty/sys/class/hwmon,thermal_zone0(type=x86_pkg_temp\n,temp=47500\n), and/sys/devices/platform/cputemp.0/temp1_input(51200\n).cpu-auto.jsonuses{"modules":[{"type":"cpu","temp":true}]}andcpu-cputemp.jsonadds"tempSensor":"cputemp.0".ctestpasses (21/21).