Skip to content

Commit

Permalink
chromium_ec: Add more command IDs
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Schaefer <[email protected]>
  • Loading branch information
JohnAZoidberg committed Oct 18, 2023
1 parent 4630bdf commit a64ea36
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 12 deletions.
22 changes: 22 additions & 0 deletions framework_lib/src/chromium_ec/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,34 @@ pub enum EcCommands {
ChassisOpenCheck = 0x3E0F,
/// Get information about historical chassis open/close (intrusion) information
ChassisIntrusion = 0x3E09,

/// Not used by this library
AcpiNotify = 0xE10,

/// Get information about PD controller version
ReadPdVersion = 0x3E11,

/// Not used by this library
StandaloneMode = 0x3E13,
/// Get information about current state of privacy switches
PriavcySwitchesCheckMode = 0x3E14,
/// Not used by this library
ChassisCounter = 0x3E15,
/// On Framework 16, check the status of the input module deck
CheckDeckState = 0x3E16,
/// Not used by this library
GetSimpleVersion = 0x3E17,
/// GetActiveChargePdChip
GetActiveChargePdChip = 0x3E18,

/// Set UEFI App mode
UefiAppMode = 0x3E19,
/// Get UEFI APP Button status
UefiAppBtnStatus = 0x3E1A,
/// Get expansion bay status
ExpansionBayStatus = 0x3E1B,
/// Get hardware diagnostics
GetHwDiag = 0x3E1C,
}
pub trait EcRequest<R> {
fn command_id() -> EcCommands;
Expand Down
24 changes: 12 additions & 12 deletions framework_lib/src/chromium_ec/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,9 @@ pub struct EcRequestUefiAppMode {
pub enable: u8,
}

impl EcRequestRaw<()> for EcRequestUefiAppMode {
fn command_id_u16() -> u16 {
0x3E19
impl EcRequest<()> for EcRequestUefiAppMode {
fn command_id() -> EcCommands {
EcCommands::UefiAppMode
}
}

Expand All @@ -226,9 +226,9 @@ pub struct EcResponseUefiAppBtnStatus {
pub status: u8,
}

impl EcRequestRaw<EcResponseUefiAppBtnStatus> for EcRequestUefiAppBtnStatus {
fn command_id_u16() -> u16 {
0x3E1A
impl EcRequest<EcResponseUefiAppBtnStatus> for EcRequestUefiAppBtnStatus {
fn command_id() -> EcCommands {
EcCommands::UefiAppBtnStatus
}
}

Expand Down Expand Up @@ -294,9 +294,9 @@ impl EcResponseExpansionBayStatus {
}
}

impl EcRequestRaw<EcResponseExpansionBayStatus> for EcRequestExpansionBayStatus {
fn command_id_u16() -> u16 {
0x3E1B
impl EcRequest<EcResponseExpansionBayStatus> for EcRequestExpansionBayStatus {
fn command_id() -> EcCommands {
EcCommands::ExpansionBayStatus
}
}

Expand Down Expand Up @@ -354,8 +354,8 @@ impl EcResponseGetHwDiag {
}
}

impl EcRequestRaw<EcResponseGetHwDiag> for EcRequestGetHwDiag {
fn command_id_u16() -> u16 {
0x3E1C
impl EcRequest<EcResponseGetHwDiag> for EcRequestGetHwDiag {
fn command_id() -> EcCommands {
EcCommands::GetHwDiag
}
}

0 comments on commit a64ea36

Please sign in to comment.