Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions EXAMPLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,10 @@ Accelerometers:
F75303_DDR: 38 C
APU: 42 C
Fan Speed: 0 RPM

# Or just for a specific fan (e.g. on Framework Desktop)
> sudo framework_tool --autofanctrl 0
> sudo framework_tool --autofanctrl 1
```

## Check expansion bay (Framework 16)
Expand Down
2 changes: 1 addition & 1 deletion framework_lib/src/commandline/clap_std.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ struct ClapCli {

/// Turn on automatic fan speed control
#[arg(long)]
autofanctrl: bool,
autofanctrl: Option<Option<u8>>,

/// Show information about USB-C PD ports
#[arg(long)]
Expand Down
8 changes: 5 additions & 3 deletions framework_lib/src/commandline/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ pub struct Cli {
pub sensors: bool,
pub fansetduty: Option<(Option<u32>, u32)>,
pub fansetrpm: Option<(Option<u32>, u32)>,
pub autofanctrl: bool,
pub autofanctrl: Option<Option<u8>>,
pub pdports: bool,
pub privacy: bool,
pub pd_info: bool,
Expand Down Expand Up @@ -1184,7 +1184,9 @@ pub fn run_with_args(args: &Cli, _allupdate: bool) -> i32 {
print_err(ec.fan_set_duty(fan, percent));
} else if let Some((fan, rpm)) = args.fansetrpm {
print_err(ec.fan_set_rpm(fan, rpm));
} else if args.autofanctrl {
} else if let Some(Some(fan_id)) = args.autofanctrl {
print_err(ec.autofanctrl(Some(fan_id)));
} else if let Some(None) = args.autofanctrl {
print_err(ec.autofanctrl(None));
} else if args.pdports {
power::get_and_print_pd_info(&ec);
Expand Down Expand Up @@ -1457,7 +1459,7 @@ Options:
--sensors Print sensor information (ALS, G-Sensor)
--fansetduty Set fan duty cycle (0-100%)
--fansetrpm Set fan RPM (limited by EC fan table max RPM)
--autofanctrl Turn on automatic fan speed control
--autofanctrl [<FANID>]Turn on automatic fan speed control (optionally provide fan index)
--pdports Show information about USB-C PD ports
--info Show info from SMBIOS (Only on UEFI)
--pd-info Show details about the PD controllers
Expand Down
16 changes: 14 additions & 2 deletions framework_lib/src/commandline/uefi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub fn parse(args: &[String]) -> Cli {
sensors: false,
fansetduty: None,
fansetrpm: None,
autofanctrl: false,
autofanctrl: None,
pdports: false,
pd_info: false,
pd_reset: None,
Expand Down Expand Up @@ -195,7 +195,19 @@ pub fn parse(args: &[String]) -> Cli {
};
found_an_option = true;
} else if arg == "--autofanctrol" {
cli.autofanctrl = true;
cli.autofanctrl = if args.len() > i + 1 {
if let Ok(fan_id) = args[i + 1].parse::<u8>() {
Some(Some(fan_id))
} else {
println!(
"Invalid value for --autofanctrl: '{}'. Must be integer < 256.",
args[i + 1]
);
None
}
} else {
Some(None)
};
found_an_option = true;
} else if arg == "--pdports" {
cli.pdports = true;
Expand Down
Loading