Skip to content

Preserve advanced fan mode across user mode changes - #327

Open
DKalimist wants to merge 1 commit into
dmitry-s93:mainfrom
DKalimist:fix-advanced-fan-mode-persistence
Open

Preserve advanced fan mode across user mode changes#327
DKalimist wants to merge 1 commit into
dmitry-s93:mainfrom
DKalimist:fix-advanced-fan-mode-persistence

Conversation

@DKalimist

Copy link
Copy Markdown

Root cause

Operate::setUserMode() unconditionally forces fan_mode back to auto,
regardless of whether advanced/custom fan control is active.

On startup, MainWindow::loadConfigs() calls operate.loadSettings()
(which correctly restores UserMode first, then fanModeAdvanced last -
ending in advanced mode), immediately followed by updateUserMode(). That
function calls radioButton->click() to sync the UI, which fires the
button's toggled signal and re-enters setUserMode() as a side effect -
silently dropping advanced mode back to auto right after it was restored.

The same happens any time the shift/user mode changes while advanced is
active, not just at startup.

Confirmed at the raw EC register level (fan curve arrays stay correctly
loaded at their addresses, only fan_mode gets reset).

Fix

Skip the fan_mode write in setUserMode() when advanced mode is already
active, unless the target mode is silent_mode (which intentionally
forces silent fan mode on purpose).

Testing

Built from source, reproduced the bug pre-patch (fresh launch with
fanModeAdvanced=true saved always came up in auto). Post-patch, tested
two independent cold launches: fan_mode comes up and stays advanced
automatically, curve values unchanged, no manual re-toggle needed.

Fixes #246

setUserMode() unconditionally forced fan_mode back to auto. On startup,
loadConfigs() calls loadSettings() (which correctly restores advanced mode)
immediately followed by updateUserMode(), which re-syncs the mode radio
buttons via click() and re-enters setUserMode() as a side effect, silently
dropping advanced mode back to auto. Same happens on any shift-mode change
while advanced is active.

Skip the fan_mode write in setUserMode() when advanced mode is already
active, unless switching to silent mode (which intentionally forces
silent fan mode).

Fixes dmitry-s93#246
@mahdishariatzade

Copy link
Copy Markdown

Tested PR #327 successfully on a real MSI Stealth 14 Studio A13VF.

Environment:

Ubuntu 26.04 LTS
Kernel 7.0.0-29-generic
MControlCenter 0.5.1 baseline
msi-ec kernel module

Before this patch, enabling Advanced Fan mode worked initially, but starting MControlCenter or changing the Shift/User Mode silently changed fan_mode from advanced back to auto. The saved fanModeAdvanced=true setting was therefore not reliably preserved.

Built and installed this PR from commit cbdba55 and verified:

MControlCenter starts with Advanced Fan mode preserved.
Changing Shift Mode (e.g. Turbo -> Comfort) keeps fan_mode=advanced.
Closing MControlCenter does not reset Advanced Fan mode.
After reboot, with fanModeAdvanced=true saved in ~/.config/MControlCenter.conf, Advanced Fan mode is restored correctly.
The custom fan curve continues to operate correctly.

The built binaries matched the installed binaries by SHA-256 after installation, confirming that the PR build was the version being tested.

This fixes the issue for my hardware/configuration. Thanks!

@Valarck82

Valarck82 commented Aug 25, 2026

Copy link
Copy Markdown

Working wonderfully, thank you so much.

Cachyos
kernel: 7.2.0

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.

Fan Mode resets to Auto on Restart and Performance Mode Change

3 participants