Add safe Automatic and Max Cooling fan control - #28
Open
LeonidasZhak wants to merge 2 commits into
Open
Conversation
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.
Summary
Adds a deliberately constrained fan control to the existing Fan card:
The UI does not accept arbitrary RPM values, so it cannot request a lower-than-normal cooling target.
Safety behavior
FNum, so a fan-bearing Mac at 0 RPM still shows the controls while fanless Macs do notF*Mxkey, bounded to a plausible 1,000–20,000 RPM range, encoded according to the key's actual SMC data type, written, and read back for verificationF*md/F*Md, withFtstarbitration) and the legacyFS!mask are handledPrivilege hardening
The existing helper receives two exact commands:
--fan-maxand--fan-auto. Every other argument is rejected.Before invoking sudo, MacMonitor now requires both the helper and its parent directory to be root-owned, non-symlinked, and not group/other-writable. The sudoers entry is migrated from an unrestricted helper command to three exact command lines: no-argument sampling, Max Cooling, and Automatic.
Verification
flt,fpe2,ui8, andui16numeric round-trip tests pass-Wall -Wextra -Werrorgit diff --checkpassesHardware-validation note
The repository's documented test Mac and the machine available for this patch are fanless. No write command was run against physical fan hardware. The PR is implementation-complete and thermally conservative, but actual fan actuation and automatic-mode restoration should be confirmed on a fan-bearing Apple Silicon Mac before merge.
Closes #27