Skip to content

Commit b36a001

Browse files
committed
autofanctrl: Allow specifying fan index
Signed-off-by: Daniel Schaefer <[email protected]>
1 parent ca1f347 commit b36a001

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

EXAMPLES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,10 @@ Accelerometers:
441441
F75303_DDR: 38 C
442442
APU: 42 C
443443
Fan Speed: 0 RPM
444+
445+
# Or just for a specific fan (e.g. on Framework Desktop)
446+
> sudo framework_tool --autofanctrl 0
447+
> sudo framework_tool --autofanctrl 1
444448
```
445449

446450
## Check expansion bay (Framework 16)

framework_lib/src/commandline/clap_std.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ struct ClapCli {
6969

7070
/// Turn on automatic fan speed control
7171
#[arg(long)]
72-
autofanctrl: bool,
72+
autofanctrl: Option<Option<u8>>,
7373

7474
/// Show information about USB-C PD ports
7575
#[arg(long)]

framework_lib/src/commandline/mod.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ pub struct Cli {
167167
pub sensors: bool,
168168
pub fansetduty: Option<(Option<u32>, u32)>,
169169
pub fansetrpm: Option<(Option<u32>, u32)>,
170-
pub autofanctrl: bool,
170+
pub autofanctrl: Option<Option<u8>>,
171171
pub pdports: bool,
172172
pub privacy: bool,
173173
pub pd_info: bool,
@@ -1184,7 +1184,9 @@ pub fn run_with_args(args: &Cli, _allupdate: bool) -> i32 {
11841184
print_err(ec.fan_set_duty(fan, percent));
11851185
} else if let Some((fan, rpm)) = args.fansetrpm {
11861186
print_err(ec.fan_set_rpm(fan, rpm));
1187-
} else if args.autofanctrl {
1187+
} else if let Some(Some(fan_id)) = args.autofanctrl {
1188+
print_err(ec.autofanctrl(Some(fan_id)));
1189+
} else if let Some(None) = args.autofanctrl {
11881190
print_err(ec.autofanctrl(None));
11891191
} else if args.pdports {
11901192
power::get_and_print_pd_info(&ec);
@@ -1457,7 +1459,7 @@ Options:
14571459
--sensors Print sensor information (ALS, G-Sensor)
14581460
--fansetduty Set fan duty cycle (0-100%)
14591461
--fansetrpm Set fan RPM (limited by EC fan table max RPM)
1460-
--autofanctrl Turn on automatic fan speed control
1462+
--autofanctrl [<FANID>]Turn on automatic fan speed control (optionally provide fan index)
14611463
--pdports Show information about USB-C PD ports
14621464
--info Show info from SMBIOS (Only on UEFI)
14631465
--pd-info Show details about the PD controllers

0 commit comments

Comments
 (0)