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
21 changes: 14 additions & 7 deletions EXAMPLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ Options:
--intrusion
Show status of intrusion switch
--inputdeck
Show status of the input modules (Framework 16 only)
Show status of the input modules
--inputdeck-mode <INPUTDECK_MODE>
Set input deck power mode [possible values: auto, off, on] (Framework 16 only) [possible values: auto, off, on]
Set input deck power mode [possible values: auto, off, on] (Laptop 12, 13, 16) [possible values: auto, off, on]
--expansion-bay
Show status of the expansion bay (Framework 16 only)
--charge-limit [<CHARGE_LIMIT>]
Expand Down Expand Up @@ -349,9 +349,12 @@ ESRT Entry 3
> framework_tool --inputdeck
Input Deck
Chassis Closed: true
Power Button Board: Present
Audio Daughterboard: Present
Touchpad: Present
Power Button Board: Present (10)
ADC Value 1655mV
Audio Daughterboard: Present (2)
ADC Value 0302mV
Touchpad: Present (10)
ADC Value 1655mV
```

### On Framework 13
Expand All @@ -360,8 +363,12 @@ Input Deck
> framework_tool --inputdeck
Input Deck
Chassis Closed: true
Audio Daughterboard: Present
Touchpad: Present
Audio Daughterboard: Present (7)
ADC Value 1056mV
Touchpad: Present (7)
ADC Value 1042mV
Deck State: On
Touchpad present: true
```

### On Framework 16
Expand Down
2 changes: 1 addition & 1 deletion framework_lib/src/chromium_ec/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ pub enum EcCommands {
PriavcySwitchesCheckMode = 0x3E14,
/// Not used by this library
ChassisCounter = 0x3E15,
/// On Framework 16, check the status of the input module deck
/// Check the status of the input module deck (Laptop 12, 13, 16)
CheckDeckState = 0x3E16,
/// Not used by this library
GetSimpleVersion = 0x3E17,
Expand Down
13 changes: 9 additions & 4 deletions framework_lib/src/chromium_ec/input_deck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ pub struct InputDeckStatus {
pub state: InputDeckState,
pub hubboard_present: bool,
pub touchpad_present: bool,
pub touchpad_id: u8,
pub top_row: TopRowPositions,
}

Expand Down Expand Up @@ -177,16 +178,20 @@ impl InputDeckStatus {

impl From<EcResponseDeckState> for InputDeckStatus {
fn from(item: EcResponseDeckState) -> Self {
let tp_id = InputModuleType::from(item.board_id[InputDeckMux::Touchpad as usize]);
let tp_present = !matches!(
tp_id,
InputModuleType::Short | InputModuleType::Disconnected
);

InputDeckStatus {
state: InputDeckState::from(item.deck_state),
hubboard_present: matches!(
InputModuleType::from(item.board_id[InputDeckMux::HubBoard as usize],),
InputModuleType::HubBoard
),
touchpad_present: matches!(
InputModuleType::from(item.board_id[InputDeckMux::Touchpad as usize],),
InputModuleType::Touchpad
),
touchpad_present: tp_present,
touchpad_id: item.board_id[InputDeckMux::Touchpad as usize],
top_row: TopRowPositions {
pos0: InputModuleType::from(item.board_id[InputDeckMux::TopRow0 as usize]),
pos1: InputModuleType::from(item.board_id[InputDeckMux::TopRow1 as usize]),
Expand Down
67 changes: 53 additions & 14 deletions framework_lib/src/chromium_ec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -638,17 +638,52 @@ impl CrosEc {

pub fn print_fw12_inputdeck_status(&self) -> EcResult<()> {
let intrusion = self.get_intrusion_status()?;
let pwrbtn = self.read_board_id(Framework12Adc::PowerButtonBoardId as u8)?;
let audio = self.read_board_id(Framework12Adc::AudioBoardId as u8)?;
let tp = self.read_board_id(Framework12Adc::TouchpadBoardId as u8)?;
let pwrbtn = self.read_board_id_npc_db(Framework12Adc::PowerButtonBoardId as u8)?;
let audio = self.read_board_id_npc_db(Framework12Adc::AudioBoardId as u8)?;
let tp = self.read_board_id_npc_db(Framework12Adc::TouchpadBoardId as u8)?;

let is_present = |p| if p { "Present" } else { "Missing" };

println!("Input Deck");
println!(" Chassis Closed: {}", !intrusion.currently_open);
println!(" Power Button Board: {}", is_present(pwrbtn.is_some()));
println!(" Audio Daughterboard: {}", is_present(audio.is_some()));
println!(" Touchpad: {}", is_present(tp.is_some()));
println!(
" Power Button Board: {}",
if let Some(pwrbtn) = pwrbtn {
format!("{} ({})", is_present(true), pwrbtn)
} else {
is_present(false).to_string()
}
);
if let Ok(adc) = self.adc_read(Framework12Adc::PowerButtonBoardId as u8) {
println!(" ADC Value {:04}mV", adc);
}
println!(
" Audio Daughterboard: {}",
if let Some(audio) = audio {
format!("{} ({})", is_present(true), audio)
} else {
is_present(false).to_string()
}
);
if let Ok(adc) = self.adc_read(Framework12Adc::AudioBoardId as u8) {
println!(" ADC Value {:04}mV", adc);
}
println!(
" Touchpad: {}",
if let Some(tp) = tp {
format!("{} ({})", is_present(true), tp)
} else {
is_present(false).to_string()
}
);
if let Ok(adc) = self.adc_read(Framework12Adc::TouchpadBoardId as u8) {
println!(" ADC Value {:04}mV", adc);
}

if let Ok(status) = self.get_input_deck_status() {
println!(" Deck State: {:?}", status.state);
println!(" Touchpad present: {}", status.touchpad_present);
}

Ok(())
}
Expand All @@ -674,6 +709,7 @@ impl CrosEc {

println!("Input Deck");
println!(" Chassis Closed: {}", !intrusion.currently_open);

println!(
" Audio Daughterboard: {}",
if let Some(audio) = audio {
Expand All @@ -682,10 +718,9 @@ impl CrosEc {
is_present(false).to_string()
}
);
println!(
" ADC Value (mV) {:?}",
self.adc_read(Framework13Adc::AudioBoardId as u8)
);
if let Ok(adc) = self.adc_read(Framework13Adc::AudioBoardId as u8) {
println!(" ADC Value {:04}mV", adc);
}
println!(
" Touchpad: {}",
if let Some(tp) = tp {
Expand All @@ -694,10 +729,14 @@ impl CrosEc {
is_present(false).to_string()
}
);
println!(
" ADC Value (mV) {:?}",
self.adc_read(Framework13Adc::TouchpadBoardId as u8)
);
if let Ok(adc) = self.adc_read(Framework13Adc::TouchpadBoardId as u8) {
println!(" ADC Value {:04}mV", adc);
}

if let Ok(status) = self.get_input_deck_status() {
println!(" Deck State: {:?}", status.state);
println!(" Touchpad present: {}", status.touchpad_present);
}

Ok(())
}
Expand Down
4 changes: 2 additions & 2 deletions framework_lib/src/commandline/clap_std.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,11 @@ struct ClapCli {
#[arg(long)]
intrusion: bool,

/// Show status of the input modules (Framework 16 only)
/// Show status of the input modules
#[arg(long)]
inputdeck: bool,

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

Expand Down
12 changes: 10 additions & 2 deletions framework_lib/src/commandline/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1360,7 +1360,15 @@ pub fn run_with_args(args: &Cli, _allupdate: bool) -> i32 {
if ec.get_gpio("sleep_l").is_ok() {
ec.print_fw16_inputdeck_status()
} else {
println!(" Unable to tell");
if let Ok(status) = ec.get_input_deck_status() {
println!(" Deck State: {:?}", status.state);
println!(
" Touchpad present: {} ({})",
status.touchpad_present, status.touchpad_id
);
} else {
println!(" Unable to tell");
}
Ok(())
}
}
Expand Down Expand Up @@ -1855,7 +1863,7 @@ Options:
--s0ix-counter Show S0ix counter
--intrusion Show status of intrusion switch
--inputdeck Show status of the input deck
--inputdeck-mode Set input deck power mode [possible values: auto, off, on] (Framework 16 only)
--inputdeck-mode Set input deck power mode [possible values: auto, off, on] (Framework 12, 13, 16)
--expansion-bay Show status of the expansion bay (Framework 16 only)
--nvidia Show NVIDIA GPU information (Framework 16 only)
--charge-limit [<VAL>] Get or set battery charge limit (Percentage number as arg, e.g. '100')
Expand Down
4 changes: 2 additions & 2 deletions framework_tool/completions/fish/framework_tool.fish
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ 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] (Framework 16 only)' -r -f -a "auto\t''
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''
off\t''
on\t''"
complete -c framework_tool -l charge-limit -d 'Get or set max charge limit' -r
Expand Down Expand Up @@ -87,7 +87,7 @@ complete -c framework_tool -l dp-hdmi-info -d 'Show details about connected DP o
complete -c framework_tool -l audio-card-info -d 'Show details about connected Audio Expansion Cards (Needs root privileges)'
complete -c framework_tool -l privacy -d 'Show privacy switch statuses (camera and microphone)'
complete -c framework_tool -l intrusion -d 'Show status of intrusion switch'
complete -c framework_tool -l inputdeck -d 'Show status of the input modules (Framework 16 only)'
complete -c framework_tool -l inputdeck -d 'Show status of the input modules'
complete -c framework_tool -l expansion-bay -d 'Show status of the expansion bay (Framework 16 only)'
complete -c framework_tool -l stylus-battery -d 'Check stylus battery level (USI 2.0 stylus only)'
complete -c framework_tool -l uptimeinfo
Expand Down
4 changes: 2 additions & 2 deletions 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\] (Framework 16 only)]:INPUTDECK_MODE:(auto off on)' \
'--inputdeck-mode=[Set input deck power mode \[possible values\: auto, off, on\] (Laptop 12, 13, 16)]:INPUTDECK_MODE:(auto off on)' \
'--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 Expand Up @@ -78,7 +78,7 @@ _framework_tool() {
'--audio-card-info[Show details about connected Audio Expansion Cards (Needs root privileges)]' \
'--privacy[Show privacy switch statuses (camera and microphone)]' \
'--intrusion[Show status of intrusion switch]' \
'--inputdeck[Show status of the input modules (Framework 16 only)]' \
'--inputdeck[Show status of the input modules]' \
'--expansion-bay[Show status of the expansion bay (Framework 16 only)]' \
'--stylus-battery[Check stylus battery level (USI 2.0 stylus only)]' \
'--uptimeinfo[]' \
Expand Down
2 changes: 1 addition & 1 deletion support-matrices.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
| `--privacy` | EC Communication | All Laptops |
| `--intrusion` | EC Communication | All Laptops |
| `--inputdeck` | EC Communication | All Laptops |
| `--inputdeck-mode` | EC Communication | Framework 16 |
| `--inputdeck-mode` | EC Communication | Framework 13, 16 |
| `--console` | EC Communication | All |
| `--get-gpio` | EC Communication | All |
| `--kblight` | EC Communication | Framework 13 |
Expand Down
Loading