diff --git a/crosec/src/wait_event/event.rs b/crosec/src/wait_event/event.rs index 7053345..ad61e21 100644 --- a/crosec/src/wait_event/event.rs +++ b/crosec/src/wait_event/event.rs @@ -5,7 +5,6 @@ use std::{ use bytemuck::{from_bytes, Pod, Zeroable}; use num_derive::FromPrimitive; -use strum_macros::{EnumString, IntoStaticStr}; use crate::wait_event::fingerprint::EcMkbpEventFingerprint; @@ -33,7 +32,8 @@ pub enum EcMkbpEvent { CecEvent(u32), } -#[derive(Debug, IntoStaticStr, EnumString, FromPrimitive, Clone, Copy)] +#[derive(Debug, FromPrimitive, Clone, Copy)] +#[cfg_attr(feature = "clap", derive(clap::ValueEnum))] #[repr(u8)] pub enum EcMkbpEventType { KeyMatrix, diff --git a/ectool/src/main.rs b/ectool/src/main.rs index fff505e..5b6e3aa 100644 --- a/ectool/src/main.rs +++ b/ectool/src/main.rs @@ -1,5 +1,4 @@ use std::fs::File; -use std::str::FromStr; use charge_control_subcommand::{charge_control_subcommand, ChargeControlSubcommand}; use clap::{Parser, Subcommand, ValueEnum}; @@ -105,7 +104,7 @@ enum Commands { mode: Vec, }, WaitEvent { - event_type: String, + event_type: EcMkbpEventType, /// Timeout in milliseconds timeout: Option, #[arg(short, long)] @@ -270,8 +269,7 @@ fn main() -> Result<()> { timeout, } => { let mut file = File::open(device.unwrap_or_default().get_path())?; - let result = - wait_event(&mut file, EcMkbpEventType::from_str(&event_type)?, timeout).unwrap(); + let result = wait_event(&mut file, event_type, timeout).unwrap(); println!("{result:#?}"); } Commands::FpDownload { command } => fp_download_subcommand(command)?,