Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More commands #4

Open
wants to merge 38 commits into
base: main
Choose a base branch
from

Conversation

ChocolateLoverRaj
Copy link
Contributor

@ChocolateLoverRaj ChocolateLoverRaj commented May 16, 2024

I'll be adding more commands to this PR, but for now the board version command is ready to merge.

Fixes #1

@lleyton
Copy link
Member

lleyton commented Jun 3, 2024

Looking good so far, let me know when you think the PR is ready for merge. Unsure if you want to add more commands or not.

Includes a big change that needs a fd to be provided to all ec command functions
Made big changes to how the ec command function works to allow different input and output sizes at runtime instead of hard-coding max sizes. Initializes the minimum amount of memory necessary for an ec command.
This command can only be run once per reboot (I'm pretty sure) so it can be hard to debug. Luckily it worked 1st try for me.
The same EC command is used for changing the fp mode and also just getting the fp mode.
The function can wait for any event and detect the type of the event. It has in depth Rust-safe types for the fingerprint events.
Also includes a fix for downloading templates
@ChocolateLoverRaj
Copy link
Contributor Author

@lleyton I'm done adding more commands. I think this PR is ready to merge.

Added an async wait_event function, added get encryption status function, made some more functions use generic trait for file.
@lleyton
Copy link
Member

lleyton commented Jun 21, 2024

Thanks, I'll review it soon. Might be a bit, since I'm still OOO

Particularly, the InterfaceReady event is useful for knowing when the FPMCU was turned on.
crosec/src/commands/fp_download.rs Fixed Show fixed Hide fixed
crosec/src/commands/fp_download.rs Fixed Show fixed Hide fixed
crosec/src/commands/fp_mode.rs Fixed Show fixed Hide fixed
crosec/src/commands/fp_mode.rs Fixed Show fixed Hide fixed
crosec/src/commands/set_fan_target_rpm.rs Fixed Show fixed Hide fixed
crosec/src/wait_event/event.rs Fixed Show fixed Hide fixed
crosec/src/wait_event/event.rs Fixed Show fixed Hide fixed
ectool/src/main.rs Fixed Show fixed Hide fixed
ectool/src/main.rs Fixed Show fixed Hide fixed
ectool/src/main.rs Fixed Show fixed Hide fixed
crosec/src/wait_event/event.rs Fixed Show fixed Hide fixed
crosec/src/wait_event/event.rs Fixed Show fixed Hide fixed
crosec/src/wait_event/event.rs Fixed Show fixed Hide fixed
crosec/src/wait_event/event.rs Fixed Show fixed Hide fixed
crosec/src/commands/charge_control.rs Fixed Show fixed Hide fixed
Comment on lines +36 to +40
pub fn ec_cmd_set_fan_target_rpm(
file: &mut File,
rpm: u32,
fan_index: Option<u8>,
) -> EcCmdResult<()> {

Check warning

Code scanning / clippy

this function depends on never type fallback being () Warning

this function depends on never type fallback being ()
use crate::ec_command::{ec_command_bytemuck, ec_command_with_dynamic_output_size};
use crate::EcCmdResult;

pub fn console(file: &mut File, protocol_info: &EcResponseGetProtocolInfo) -> EcCmdResult<String> {

Check warning

Code scanning / clippy

this function depends on never type fallback being () Warning

this function depends on never type fallback being ()
Comment on lines +47 to +50
pub fn set_charge_control<File: AsRawFd>(
file: &mut File,
charge_control: ChargeControl,
) -> EcCmdResult<()> {

Check warning

Code scanning / clippy

this function depends on never type fallback being () Warning

this function depends on never type fallback being ()

pub fn charge_current_limit_subcommand(limit: u32) -> Result<()> {
let mut file = File::open(CROS_EC_PATH)?;
set_charge_current_limit(&mut file, ElectricCurrent::new::<milliampere>(limit.into()))?;

Check failure

Code scanning / clippy

the trait bound f32: std::convert::From<u32> is not satisfied Error

the trait bound f32: std::convert::From<u32> is not satisfied
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement fingerprint commands
2 participants