Skip to content

fix: fixed fan control helper on M5#3051

Open
c-herz wants to merge 1 commit intoexelban:masterfrom
c-herz:fix/m5-fan-control
Open

fix: fixed fan control helper on M5#3051
c-herz wants to merge 1 commit intoexelban:masterfrom
c-herz:fix/m5-fan-control

Conversation

@c-herz
Copy link

@c-herz c-herz commented Mar 18, 2026

Fan control is broken on M5 gen. Setting mode or speed through the UI or smc CLI does nothing, even though RPM reads work fine.

Two issues: M5 uses F%dmd (lowercase) for the fan mode key instead of F%dMd, and the uppercase key doesn't exist so writes are silently ignored. Second, Ftst doesn't exist on M5, but unlockFanControl bails out immediately if it can't read Ftst.

Changes:

  • Added fanModeKey() on SMC that probes F0md once and caches the result, returning the correct key name per platform (Intel always gets uppercase at compile time).
  • Restructured unlockFanControl to try a direct mode key write first (which is all M5 needs), then fall back to the Ftst unlock mechanism for M1-M4.
  • resetFanControl similarly handles missing Ftst by resetting each fan's mode key directly.
  • Extended the getValue zero-byte exemption list with the lowercase variants (F0md, F1md).
  • Replaced all hardcoded F%dMd references across smc.swift, readers.swift, and main.swift with fanModeKey().

Tested on MacBook Pro 14" M5 Pro (15-core CPU): manual mode, speed control, and reset all work correctly through both the CLI and the Stats UI. Would appreciate confirmation on base M5, M5 Max, and M1-M4 to make sure nothing regressed.

M5 gen uses lowercase fan mode key (F%dmd) instead of F%dMd, and lacks
the Ftst key used for fan unlock on M1-M4. Runtime-detect the correct
key name via SMC probe, and restructure unlockFanControl/resetFanControl
to work without Ftst in the case of M5 gen.
@exelban
Copy link
Owner

exelban commented Mar 20, 2026

can confirm that it works fine for m1

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