-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added an async wait_event function, added get encryption status function, made some more functions use generic trait for file.
- Loading branch information
1 parent
a64baa9
commit a2d5504
Showing
15 changed files
with
680 additions
and
44 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
use std::os::fd::AsRawFd; | ||
use bytemuck::{Pod, Zeroable}; | ||
use crate::commands::CrosEcCmd; | ||
use crate::ec_command::ec_command_bytemuck; | ||
use crate::EcCmdResult; | ||
|
||
#[repr(u32)] | ||
pub enum FpEncryptionStatus { | ||
SeedSet = 0b1 | ||
} | ||
|
||
#[derive(Pod, Zeroable, Copy, Clone)] | ||
#[repr(C)] | ||
pub struct EcResponseFpGetEncryptionStatus { | ||
pub valid_flags: u32, | ||
pub status: u32, | ||
} | ||
|
||
pub fn fp_get_encryption_status<File: AsRawFd>(file: &mut File) -> EcCmdResult<EcResponseFpGetEncryptionStatus> { | ||
ec_command_bytemuck(CrosEcCmd::FpGetEncryptionStatus, 0, &(), file.as_raw_fd()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
use std::fs::File; | ||
use crosec::commands::fp_get_encryption_status::{EcResponseFpGetEncryptionStatus, fp_get_encryption_status}; | ||
use crosec::CROS_FP_PATH; | ||
|
||
pub fn fp_get_encryption_status_command() -> color_eyre::Result<()> { | ||
let mut file = File::open(CROS_FP_PATH)?; | ||
let EcResponseFpGetEncryptionStatus { status, valid_flags } = fp_get_encryption_status(&mut file)?; | ||
println!("FPMCU encryption status: {status:#b}"); | ||
println!("Valid flags: {valid_flags:#b}"); | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters