Skip to content

PhysicalDisk (Linux): detects NVMe temperature for hwmon10 and above - #2775

Closed
sagaragas wants to merge 1 commit into
fastfetch-cli:devfrom
sagaragas:fix/linux-nvme-hwmon-temp
Closed

sagaragas wants to merge 1 commit into
fastfetch-cli:devfrom
sagaragas:fix/linux-nvme-hwmon-temp

Conversation

@sagaragas

Copy link
Copy Markdown
Contributor

detectNvmeTemp() in src/detection/physicaldisk/physicaldisk_linux.c only probes hwmon0 through hwmon9, so NVMe drives at hwmon10 and above never report a temperature.

This switches detectNvmeTemp() to scan the drive's device directory with openat(devfd, ".", ...) and fdopendir(). It reads temp1_input from matching hwmon entries (hwmon followed by a digit) and caps the read at ARRAY_SIZE(buffer) - 1 before NUL-terminating.

Tested locally with {"modules":[{"type":"physicaldisk","temp":true}]} on real NVMe drives (hwmon1 and hwmon2) and a bind-mounted /sys/block fixture with hwmon2, hwmon10, and hwmon123. Before, hwmon10 and hwmon123 reported null in JSON output, while after they report 48.25 and 52.0 (48.2°C and 52.0°C by default).

@CarterLi CarterLi closed this in f628a6f Dec 2, 2026
@CarterLi

CarterLi commented Dec 2, 2026

Copy link
Copy Markdown
Member

Fixed in f628a6f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants