Skip to content

Commit e822af3

Browse files
committed
--inputdeck: Use boardid if platform cannot be determined
Signed-off-by: Daniel Schaefer <dhs@frame.work>
1 parent 55eccba commit e822af3

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

framework_lib/src/chromium_ec/command.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use crate::util;
1212
use super::{CrosEc, CrosEcDriver, EcError, EcResult};
1313

1414
#[non_exhaustive]
15-
#[derive(Debug, FromPrimitive)]
15+
#[derive(Debug, Clone, Copy, FromPrimitive)]
1616
#[repr(u16)]
1717
pub enum EcCommands {
1818
GetVersion = 0x02,

framework_lib/src/chromium_ec/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,8 @@ impl CrosEc {
298298
}
299299
}
300300

301-
pub fn cmd_version_supported(&self, cmd: u16, version: u8) -> EcResult<bool> {
302-
let res = EcRequestGetCmdVersionsV1 { cmd: cmd.into() }.send_command(self);
301+
pub fn cmd_version_supported(&self, cmd: EcCommands, version: u8) -> EcResult<bool> {
302+
let res = EcRequestGetCmdVersionsV1 { cmd: cmd as u32 }.send_command(self);
303303
let mask = if let Ok(res) = res {
304304
res.version_mask
305305
} else {

framework_lib/src/commandline/mod.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ use crate::ccgx::device::{FwMode, PdController, PdPort};
3535
use crate::ccgx::hid::{check_ccg_fw_version, find_devices, DP_CARD_PID, HDMI_CARD_PID};
3636
use crate::ccgx::{self, MainPdVersions, PdVersions, SiliconId::*};
3737
use crate::chromium_ec;
38+
use crate::chromium_ec::command;
3839
use crate::chromium_ec::commands::BoardIdType;
3940
use crate::chromium_ec::commands::DeckStateMode;
4041
use crate::chromium_ec::commands::FpLedBrightnessLevel;
@@ -1035,6 +1036,21 @@ pub fn run_with_args(args: &Cli, _allupdate: bool) -> i32 {
10351036
// Only Framework 16 has this GPIO
10361037
if ec.get_gpio("sleep_l").is_ok() {
10371038
ec.print_fw16_inputdeck_status()
1039+
} else if ec.cmd_version_supported(command::EcCommands::ReadBoardId, 0) == Ok(true) {
1040+
println!("Input Deck (Board ID - Unable to determine platform)");
1041+
let boardid = ec.read_board_id_hc(BoardIdType::Mainboard);
1042+
println!(" Mainboard: {:?}", boardid);
1043+
let boardid = ec.read_board_id_hc(BoardIdType::PowerButtonBoard);
1044+
println!(" PowerButton: {:?}", boardid);
1045+
let boardid = ec.read_board_id_hc(BoardIdType::Touchpad);
1046+
println!(" Touchpad: {:?}", boardid);
1047+
let boardid = ec.read_board_id_hc(BoardIdType::AudioBoard);
1048+
println!(" AudioBoard: {:?}", boardid);
1049+
let boardid = ec.read_board_id_hc(BoardIdType::DGpu0);
1050+
println!(" dGPU0: {:?}", boardid);
1051+
let boardid = ec.read_board_id_hc(BoardIdType::DGpu1);
1052+
println!(" dGPU1: {:?}", boardid);
1053+
Ok(())
10381054
} else {
10391055
println!(" Unable to tell");
10401056
Ok(())

0 commit comments

Comments
 (0)