Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion framework_lib/src/chromium_ec/cros_ec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ struct CrosEcCommandV2 {
data: [u8; IN_SIZE],
}

const DEV_PATH: &str = "/dev/cros_ec";
pub const DEV_PATH: &str = "/dev/cros_ec";

lazy_static! {
static ref CROS_EC_FD: Arc<Mutex<Option<std::fs::File>>> = Arc::new(Mutex::new(None));
Expand Down
22 changes: 14 additions & 8 deletions framework_lib/src/chromium_ec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,14 +239,20 @@ impl Default for CrosEc {
///
/// Depending on the availability we choose the first one as default
fn available_drivers() -> Vec<CrosEcDriverType> {
vec![
#[cfg(feature = "win_driver")]
CrosEcDriverType::Windows,
#[cfg(feature = "cros_ec_driver")]
CrosEcDriverType::CrosEc,
#[cfg(not(feature = "windows"))]
CrosEcDriverType::Portio,
]
let mut drivers = vec![];

#[cfg(feature = "win_driver")]
drivers.push(CrosEcDriverType::Windows);

#[cfg(feature = "cros_ec_driver")]
if std::path::Path::new(cros_ec::DEV_PATH).exists() {
drivers.push(CrosEcDriverType::CrosEc);
}

#[cfg(not(feature = "windows"))]
drivers.push(CrosEcDriverType::Portio);

drivers
}

impl CrosEc {
Expand Down