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
5 changes: 4 additions & 1 deletion EXAMPLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Options:
--inputdeck
Show status of the input modules
--inputdeck-mode <INPUTDECK_MODE>
Set input deck power mode [possible values: auto, off, on] (Laptop 12, 13, 16) [possible values: auto, off, on]
Set input deck power mode [possible values: auto, off, on, reset] (Laptop 12, 13, 16)
--expansion-bay
Show status of the expansion bay (Laptop 16 only)
--charge-limit [<CHARGE_LIMIT>]
Expand Down Expand Up @@ -414,6 +414,9 @@ framework_tool --inputdeck-mode on

# Auto detect (Default behavior)
framework_tool --inputdeck-mode auto

# Reset (Turn off and then auto)
framework_tool --inputdeck-mode resets
```

## Checking board ID
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 @@ -171,7 +171,7 @@ struct ClapCli {
#[arg(long)]
inputdeck: bool,

/// Set input deck power mode [possible values: auto, off, on] (Laptop 12, 13, 16)
/// Set input deck power mode [possible values: auto, off, on, reset] (Laptop 12, 13, 16)
#[arg(long)]
inputdeck_mode: Option<InputDeckModeArg>,

Expand Down
15 changes: 13 additions & 2 deletions framework_lib/src/commandline/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,16 @@ pub enum InputDeckModeArg {
Auto,
Off,
On,
Reset,
}
impl From<InputDeckModeArg> for DeckStateMode {
fn from(w: InputDeckModeArg) -> DeckStateMode {
match w {
InputDeckModeArg::Auto => DeckStateMode::Required,
InputDeckModeArg::Off => DeckStateMode::ForceOff,
InputDeckModeArg::On => DeckStateMode::ForceOn,
// Actually should turn off first
InputDeckModeArg::Reset => DeckStateMode::Required,
}
}
}
Expand Down Expand Up @@ -1380,8 +1383,16 @@ pub fn run_with_args(args: &Cli, _allupdate: bool) -> i32 {
};
print_err(res);
} else if let Some(mode) = &args.inputdeck_mode {
println!("Set mode to: {:?}", mode);
ec.set_input_deck_mode((*mode).into()).unwrap();
if *mode == InputDeckModeArg::Reset {
println!("Resetting input deck (off => auto)");
ec.set_input_deck_mode(DeckStateMode::ForceOff).unwrap();
// Make sure it has time to fully turn off
os_specific::sleep(100);
ec.set_input_deck_mode(DeckStateMode::Required).unwrap();
} else {
println!("Set mode to: {:?}", mode);
ec.set_input_deck_mode((*mode).into()).unwrap();
}
} else if args.expansion_bay {
if let Err(err) = ec.check_bay_status() {
error!("{:?}", err);
Expand Down
4 changes: 3 additions & 1 deletion framework_lib/src/commandline/uefi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,13 +256,15 @@ pub fn parse(args: &[String]) -> Cli {
Some(InputDeckModeArg::Off)
} else if inputdeck_mode == "on" {
Some(InputDeckModeArg::On)
} else if inputdeck_mode == "reset" {
Some(InputDeckModeArg::Reset)
} else {
println!("Invalid value for --inputdeck-mode: {}", inputdeck_mode);
None
}
} else {
println!(
"Need to provide a value for --inputdeck-mode. Either `auto`, `off`, or `on`"
"Need to provide a value for --inputdeck-mode. Either `auto`, `off`, `on`, or `reset`"
);
None
};
Expand Down
2 changes: 1 addition & 1 deletion framework_tool/completions/bash/framework_tool
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ _framework_tool() {
return 0
;;
--inputdeck-mode)
COMPREPLY=($(compgen -W "auto off on" -- "${cur}"))
COMPREPLY=($(compgen -W "auto off on reset" -- "${cur}"))
return 0
;;
--charge-limit)
Expand Down
5 changes: 3 additions & 2 deletions framework_tool/completions/fish/framework_tool.fish
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ complete -c framework_tool -l flash-full-ec -d 'Flash full EC flash with new fir
complete -c framework_tool -l flash-ec -d 'Flash EC (RO+RW) with new firmware from file - may render your hardware unbootable!' -r -F
complete -c framework_tool -l flash-ro-ec -d 'Flash EC with new RO firmware from file - may render your hardware unbootable!' -r -F
complete -c framework_tool -l flash-rw-ec -d 'Flash EC with new RW firmware from file' -r -F
complete -c framework_tool -l inputdeck-mode -d 'Set input deck power mode [possible values: auto, off, on] (Laptop 12, 13, 16)' -r -f -a "auto\t''
complete -c framework_tool -l inputdeck-mode -d 'Set input deck power mode [possible values: auto, off, on, reset] (Laptop 12, 13, 16)' -r -f -a "auto\t''
off\t''
on\t''"
on\t''
reset\t''"
complete -c framework_tool -l charge-limit -d 'Get or set max charge limit' -r
complete -c framework_tool -l charge-current-limit -d 'Set max charge current limit' -r
complete -c framework_tool -l charge-rate-limit -d 'Set max charge current limit' -r
Expand Down
2 changes: 1 addition & 1 deletion framework_tool/completions/zsh/_framework_tool
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ _framework_tool() {
'--flash-ec=[Flash EC (RO+RW) with new firmware from file - may render your hardware unbootable!]:FLASH_EC:_files' \
'--flash-ro-ec=[Flash EC with new RO firmware from file - may render your hardware unbootable!]:FLASH_RO_EC:_files' \
'--flash-rw-ec=[Flash EC with new RW firmware from file]:FLASH_RW_EC:_files' \
'--inputdeck-mode=[Set input deck power mode \[possible values\: auto, off, on\] (Laptop 12, 13, 16)]:INPUTDECK_MODE:(auto off on)' \
'--inputdeck-mode=[Set input deck power mode \[possible values\: auto, off, on, reset\] (Laptop 12, 13, 16)]:INPUTDECK_MODE:(auto off on reset)' \
'--charge-limit=[Get or set max charge limit]::CHARGE_LIMIT:_default' \
'*--charge-current-limit=[Set max charge current limit]:CHARGE_CURRENT_LIMIT:_default' \
'*--charge-rate-limit=[Set max charge current limit]:CHARGE_RATE_LIMIT:_default' \
Expand Down
Loading