Skip to content

--thermal: Hide AP throttle status when unsupported by EC - #410

Merged
JohnAZoidberg merged 1 commit into
FrameworkComputer:mainfrom
techmandan:fix/issue-386-thermal-throttle-unsupported
Dec 6, 2026
Merged

JohnAZoidberg merged 1 commit into
FrameworkComputer:mainfrom
techmandan:fix/issue-386-thermal-throttle-unsupported

Conversation

@techmandan

Copy link
Copy Markdown
Contributor

Summary

 get_thermal(ec)
-  ec.get_ap_throttle_status().ok()
+  decode_ap_throttle(ec.get_ap_throttle_status())
+    Ok(t)               -> Some(ApThrottleInfo { soft, hard })
+    Err(InvalidCommand) -> debug!(...); None
+    Err(other)          -> warn!(...); None

 print_thermal(ec)
-  println!("  AP Throttle Status")
-  if Some(t) { ... } else { println!("    Unknown") }
+  if Some(t) { println!("  AP Throttle Status\n    ...") }
+  else       { info!("  AP Throttle Status: Not supported") }

Keeps ThermalInfo.throttle: Option<ApThrottleInfo> unchanged so the public framework_lib API is preserved and matches FanSpeed::NotPresent (logged at info!, hidden by default).

Evidence

  • Before: On ECs without EC_CMD_GET_AP_THROTTLE_STATUS (0x3E22), get_ap_throttle_status() returned Err(InvalidCommand) which was silently discarded via .ok(), causing --thermal to print AP Throttle Status / Unknown.
  • After:
    • cargo fmt --all -- --check — pass
    • cargo clippy -p framework_lib -p framework_tool -- -D warnings — pass
    • cargo test -p framework_lib -p framework_tool — 65 passed, 0 failed (including new decode_ap_throttle_supported and decode_ap_throttle_unsupported_and_errors), 2 doc-tests passed
    • cargo check -p framework_lib --target x86_64-unknown-uefi --no-default-features --features uefi — pass
    • RUSTDOCFLAGS="-Dwarnings" cargo doc --no-deps — pass
    • Shell completions & manpage diffs — unchanged

Merge Danger

Door: Two-way

Blast Radius: Low — isolated to framework_lib/src/power.rs (get_thermal / print_thermal); no public struct or CLI flag changes.

Fixes #386

Instead of silently swallowing `get_ap_throttle_status()` errors via
`.ok()` and printing `AP Throttle Status: Unknown` on platforms whose
EC firmware does not implement `0x3E22`, distinguish `InvalidCommand`
(logged at debug level) from unexpected errors (logged at warn level)
and only print the AP Throttle Status section when supported—logging
`Not supported` at info level like absent fans.

Fixes FrameworkComputer#386
@JohnAZoidberg
JohnAZoidberg force-pushed the fix/issue-386-thermal-throttle-unsupported branch from 24dd336 to 23ac5ae Compare December 6, 2026 15:07
@JohnAZoidberg
JohnAZoidberg merged commit 164f28f into FrameworkComputer:main Dec 6, 2026
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.

--thermal: "AP Throttle Status: Unknown" on Laptop 13 AMD 7040 (EC lacks 0x3E22)

2 participants