Repository navigation
feat: add hwmon fan profiles - #54
sknowledge1 wants to merge 2 commits into
Conversation
8c74ffe to
7264e1f
Compare
|
Please rebase on latest main |
|
This can't be merged or reviewed as is. The history is all messed up. I'd suggest you delete your local branch, check out an pull main, remake the branch, cherry pick your commits, and then force push |
58fcde8 to
9b82591
Compare
|
Rebuilt from 35 locked tests and 26 lifecycle assertions pass, along with formatting, Clippy using the existing upstream allowances, both release builds, and both distribution targets. Historical hardware results remain attributed to their tested build. Ready for another look. |
pastaq
left a comment
There was a problem hiding this comment.
I got through most of the readme file before I had to stop. I don't think this is the correct direction for the interface.
I think it should be much more simple. For curves, a yaml or toml that identifies the fan and its sensors, and a simple curve matrix of quant temp to %. hwmon internals don't need relaying, it should handle that transition directly. An average user should be able to read, write, and understand the configuration directly. We should have some hardware pre-built curves in /usr/powerstation/platform/fan_curves and allow for distros to ship overrides in /etc/powerstation/platform/fan_curves.d/. userspace should load a profile on boot if a user has customized it.
For the dbus, loading the profile or accepting one over JSON, listing the current profile name/path, listing available fans and sensors, and listing available/current modes (automatic, manual, fw curve, sw curve) should be sufficient.
Critical safety temps (100% fan, hw takeover) should be baked into the algorithm and not left up to the user.
|
Implemented the profile design from your overall review in cb75669. YAML/JSON profiles now contain fan/sensor IDs, modes and percentages; packaged Quiet and whole-file distro overrides are separate from trusted driver configuration. API v0.2 adds profile loading, fan/sensor enumeration and current profile/mode reporting, with valid 0–100% values and no public RPM/PWM/ownership/policy properties. The revised proposal and short examples are documented. Fresh starts, clean/crash/watchdog restarts and reboots enter firmware Automatic; user applications own profile persistence/reloading. Successful suspend/resume keeps only the live selection. Complete validation precedes hardware writes, and application or partial-resume failure rolls every affected fan back to Automatic. The provisional 95°C/98°C policy is internal, with thermal acceptance explicitly pending. The push-only workflow and custom-only generated fan docs address the inline review. I have replied in each original thread and left all threads unresolved. Actual local validation on For the earlier rebase request and history request, current upstream main remains The successful uninterrupted five-minute, 9 W, 352-sample, 64°C-peak device result is preserved as evidence for GitHub CI was inspected on this exact SHA at 2026-10-15 09:04 UTC: no runs, check runs or statuses were present in either repository. All validation claims above are from the completed local software gate. |
|
@pastaq, the follow-up is implemented at fffb4b9. Unprivileged clients can read startup identity/eligibility without accessing recorder files; the startup file/JSON load methods recheck it under the complete profile transaction lock, closing the status-to-write race. Existing profile validation, caller policy, partial-write Automatic fallback and 95°C/98°C policy remain service-owned. Local validation on that commit passes 52 locked tests, 77 real-systemd/private-D-Bus/fake-sysfs assertions, formatting, strict Clippy with the existing allowances, both release architectures and both archive/RPM payload checks. The actual OpenGamepadUI API v0.2 client additionally passes 32 Godot/native integration assertions with fake hardware. New-head GitHub inspection reports no native test check contexts; these are local results. The base/history requests are also rechecked: current main is Physical results remain pinned to 255e680 (352 samples / 64°C) and 1b7330e (342 samples / 65.5°C). Revised-code/device acceptance, the provisional high-temperature policy, native-curve hardware coverage and official testing/stable/ARM package qualification remain open release gates. Firmware handoff transfers responsibility; it does not prove stronger cooling. This is ready for another review. |
This is not necessary. As the API hasn't been accepted there is no v1/v2 yet. We're on v0 which in semantic versioning means there is no stable API. |
fair - I'll change it to API v0.2 |
pastaq
left a comment
There was a problem hiding this comment.
I stopped my review.
Please read this:
https://www.eff.org/about/opportunities/volunteer/coding-with-eff
This PR is over 6k lines and half of it is slop readme. I should not be the first person to read "your" PR.
|
Appreciate the feedback - still new to this, not sure what to add / what to keep when reviewing the code. |
|
Following the version discussion, the description and documentation now describe an experimental, unmerged interface. Stable API-break/migration claims are removed. The existing integer revision marker remains provisional and has not been bumped. |
|
The revision removes startup records and guarded loading in favor of ordinary FD/JSON profile transactions, adds DT/XDG portability and reduces the documentation and repeated implementation. I have reviewed the revised code. These changes are AI-assisted. The complete PR adds 5,606 lines versus 6,664 previously. The README adds eight lines; the profile guide is 422 words and validation instructions are 187. Shared error, curve and fixture code retains the distinct failure scenarios. Local validation matches this commit's source: 46 Rust tests, 71 lifecycle assertions, formatting, Clippy with existing allowances, both architecture builds, live XML and archive/RPM inspection. OpenGamepadUI and Decky integration pass 28 and 11 assertions respectively against the real daemon with fake sysfs/private D-Bus. GitHub reports no CI runs or check contexts for this SHA; the validation above is local. The branch contains base Revised-device, thermal/95°C/98°C, native-curve/HX 370, actual NixOS and qualified ARM/package acceptance remain pending. Historical device observations remain attributed to their original builds. |
Add fan control for fans with hwmon pwmN and pwmN_enable files. Profiles are TOML files or JSON strings that set each fan to automatic, manual, software_curve or firmware_curve mode using the fan and sensor IDs from hwmon. Userspace opens the profile file and passes the file descriptor. Installed profiles can be limited to a device with DMI or device tree matching. Fans start in automatic mode and return to it when PowerStation stops or a sensor cannot be read. A fan runs at 100% when one of its sensors reaches 95°C. Tested on an AYANEO 3 (Bazzite 45, ayaneo_ec). Assisted-by: LLM
5913268 to
5833241
Compare
The AYANEO 3 embedded controller occasionally fails a single pwm1 read with an I/O error. Return a fan to automatic only after three failed updates in a row instead of on the first error. Tctl jumps by several degrees from one second to the next, so a software curve made the fan follow every spike. Software curves now lower the fan speed by at most 2% per update; increases and the 95°C override still apply at once. Assisted-by: LLM
|
down to 1100 lines - simple TOML profiles in |
PowerStation can now set fan profiles (ShadowBlip/PowerStation#54), but OpenGamepadUI has no way to choose one. Add a Fan card to the quick bar. The card lists Automatic, the profiles PowerStation has installed for this device, and Manual with a speed slider. The choice is saved in the settings. PowerStation does not save it, so it is loaded again whenever PowerStation starts or the choice changes. The new Fan class only wraps PowerStation's fan D-Bus API, like the existing Cpu and Gpu classes. Automatic and Manual are sent as small JSON profiles, and installed profiles are opened and passed as a file. The card is hidden when PowerStation has no fans to control. Assisted-by: LLM
Adds fan control for fans with hwmon
pwmNandpwmN_enablefiles.Problem: PowerStation can't control fans, so each handheld needs its own fan daemon.
Approach: a profile is a short TOML file (or JSON string) that sets each fan to
automatic,manual,software_curveorfirmware_curveusing fan and sensor IDs from hwmon (e.g.ayaneo_ec/fan1,k10temp/Tctl). Userspace opens the file and sends the fd, and saves/reloads the user's profile itself. Installed profiles live in/usr/share/powerstation/platform/fan_curves/with overrides in/etc/powerstation/platform/fan_curves.d/, matched to a device by DMI or device tree. Fans start in automatic, return to it on stop or after three failed updates in a row, and run at 100% at 95°C. Software curves speed the fan up at once but slow it down by at most 2% per second.Testing: on an AYANEO 3 (Bazzite 45): manual mode, software curve, the packaged Quiet profile loaded by fd, invalid profiles rejected without changing the fans, firmware taking control back being reverted, the 95°C override (with a test build set to 40°C), stop returning the fan to automatic, and a software curve winding the fan down from 57% to 11% over about 20 s after a CPU load ended.
firmware_curveis untested because this device has nopwmN_auto_pointfiles.See
docs/fan.mdfor the profile format and DBus API.Assisted-by: LLM