Fix: bidirectional Quiet<->LowPower fallback in platform_profile setters#133
Open
f4mrfaux wants to merge 1 commit into
Open
Fix: bidirectional Quiet<->LowPower fallback in platform_profile setters#133f4mrfaux wants to merge 1 commit into
f4mrfaux wants to merge 1 commit into
Conversation
On hardware where the kernel ACPI platform_profile sysfs exposes only one of Quiet / LowPower for the same semantic profile (different ASUS DMI quirks expose different names), setting the absent variant fails with "platform_profile: (low-power) not supported" even when the equivalent IS in choices. The previous fallback in set_platform_profile_on_battery / set_platform_profile_on_ac only handled Quiet -> LowPower, and the bare set_platform_profile property had no fallback at all. This patch: - Adds bidirectional Quiet <-> LowPower substitution in set_platform_profile so user-facing CLI/D-Bus calls succeed regardless of which name the kernel exposes. - Extends the existing one-direction fallback in set_platform_profile_on_battery and set_platform_profile_on_ac to be bidirectional, so the canonical name is what gets persisted to /etc/asusd/asusd.ron. - Extends select_power_profile_for_source to normalize both directions at apply-time, fixing stale-config rehydration after reboot. EPP behavior is preserved: get_config_epp_for_throttle and impl From<PlatformProfile> for CPUEPP already map both Quiet and LowPower to the same source (profile_quiet_epp / CPUEPP::Power), so substitution does not change EPP outcomes. Tested live on GA503QR (linux-g14 7.0.5, platform_profile_choices = quiet balanced performance) against a swap-in-place patched daemon: - asusctl profile set LowPower -> kernel writes 'quiet', active=Quiet (previously errored NotSupported) - asusctl profile set Quiet / Balanced / Performance unchanged - asusctl profile set LowPower -b / -a -> config persists 'Quiet' (the canonical name for this hardware), not LowPower - CLI parser still rejects bogus profile names at argument-parse time Closes gitlab #648 follow-up (the CLI-parsing portion was fixed by gitlab MR !226 / commit 9366b0e but the platform-aliasing portion at the D-Bus property layer was not addressed). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
On hardware where the kernel ACPI platform_profile sysfs exposes only one of
Quiet/LowPowerfor the same semantic profile (different ASUS DMI quirks expose different names — e.g. GA503QR exposesquiet balanced performance, neverlow-power), setting the absent variant fails with:even when the equivalent IS in choices. The existing fallback in
set_platform_profile_on_battery/set_platform_profile_on_aconly handledQuiet -> LowPower, and the bareset_platform_profileD-Bus property had no fallback at all.This PR makes the alias bidirectional everywhere it matters:
set_platform_profile(asusd/src/ctrl_platform.rs:469) — substitutesQuiet <-> LowPowerwhen the requested variant isn't inplatform_profile_choicesbut its semantic equivalent is.set_platform_profile_on_battery(~line 523) andset_platform_profile_on_ac(~line 562) — extended from one-direction to bidirectional, so the canonical name (the one the kernel exposes) is what gets persisted to/etc/asusd/asusd.ron.select_power_profile_for_source(~line 260) — extended to normalize both directions at apply-time, fixing stale-config rehydration after reboot or AC/BAT transitions.Background — relation to #648
The CLI-string-parsing portion of GitLab issue #648 was fixed by GitLab MR !226 (commit
9366b0e) which madelow-power/lowpower/LowPower/low_powerall parse toPlatformProfile::LowPower. That fix is necessary but not sufficient: the parsed enum then reachesset_platform_profile, which checkschoices.contains(&policy)and rejects on hardware exposing only the kernel-renamed sibling name. This PR closes that follow-up gap.EPP / behavior preservation
EPP outcomes are unchanged. Both
QuietandLowPoweralready map to the same source in:get_config_epp_for_throttle(asusd/src/ctrl_platform.rs:254-255) — both →profile_quiet_eppimpl From<PlatformProfile> for CPUEPP(rog-platform/src/cpu.rs:209-210) — both →CPUEPP::PowerSo substitution does not affect what EPP gets written; only what name is stored in config and which sysfs string the kernel sees.
Test plan — executed locally on patched daemon
Tested live on GA503QR (linux-g14 7.0.5,
/sys/firmware/acpi/platform_profile_choices = quiet balanced performance) via a swap-in-place patched daemon (systemctl stop asusd; systemd-run /target/release/asusd):asusctl profile set LowPowerNotSupported (low-power)quiet, active=Quietasusctl profile set Quietasusctl profile set Balancedasusctl profile set Performanceasusctl profile set NotARealProfileasusctl profile set LowPower -bQuiet(canonical), appliedasusctl profile set LowPower -aQuiet(canonical), appliedConfig persistence verified —
/etc/asusd/asusd.ronafterset LowPower -b -a:(both stored as
Quiet, the available canonical name, notLowPower).cargo check -p asusdandcargo build --release -p asusdboth clean onogc/maintip.What we did NOT validate locally
This hardware exposes
quiet balanced performanceonly — neverlow-power. So the reverse direction of the bidirectional fallback (a user passingQuieton a hypotheticallow-power-only machine) was reasoned-through (matches the existing one-direction precedent) but not hardware-tested. The patch is a strict no-op when the requested profile IS in choices, so on dual-choice or LowPower-only hardware the behavior should be unchanged from before this PR.Reviewer notes
set_platform_profilewrites config (line 480 in main) before validating againstchoices. The alias substitution doesn't widen that pre-existing window — the substitution only triggers when the validation would otherwise reject. Worth a separate cleanup PR if desired.#[cfg(test)]forset_platform_profileor the alias paths (verified viarg). Happy to add unit tests in a follow-up if maintainers prefer.🤖 Generated with Claude Code