Skip to content

sensor, fan: resolve stable hwmon device paths at startup#8

Merged
mkopec merged 1 commit intomasterfrom
claude/issue-6-20260320-1829
Mar 20, 2026
Merged

sensor, fan: resolve stable hwmon device paths at startup#8
mkopec merged 1 commit intomasterfrom
claude/issue-6-20260320-1829

Conversation

@mkopec
Copy link
Copy Markdown
Owner

@mkopec mkopec commented Mar 20, 2026

hwmon numbers under /sys/class/hwmon/ are unstable and may change across reboots. This PR adds hwmon_resolve_path() which, when given a path whose last component is exactly "hwmon" (e.g. /sys/devices/platform/asus-ec-sensors/hwmon), scans that directory for the first hwmonN child and returns its full path. Paths with a concrete number are unchanged for backward compatibility.

Closes #6

Generated with Claude Code

hwmon numbers under /sys/class/hwmon/ are unstable and may change
across reboots.  Add hwmon_resolve_path() which, when given a path
whose last component is exactly "hwmon" (e.g.
/sys/devices/platform/asus-ec-sensors/hwmon), scans that directory
for the first hwmonN child and returns its full path.  Paths that
already contain a concrete hwmon number are returned unchanged, so
existing configs keep working without modification.

Both sensor_create() and fan_create() now call hwmon_resolve_path()
so users can specify stable device-tree paths in fand.conf.

Closes #6

Co-authored-by: Michał Kopeć <mkopec@users.noreply.github.com>
@mkopec mkopec merged commit 3563aeb into master Mar 20, 2026
claude Bot pushed a commit that referenced this pull request Mar 20, 2026
Bring sensor.c, fan.c, hwmon.c, hwmon.h, fand.conf, and Makefile in
line with master (PR #8) while retaining the test target added in this
branch. Makefile conflict resolved: hwmon.c added to both main and test
compilation targets.

Co-authored-by: Michał Kopeć <mkopec@users.noreply.github.com>
@claude claude Bot mentioned this pull request Mar 20, 2026
@mkopec mkopec deleted the claude/issue-6-20260320-1829 branch March 20, 2026 19:14
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.

Add support for stable hwmon paths

1 participant