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
26 changes: 13 additions & 13 deletions framework_lib/src/chromium_ec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,25 +276,25 @@ impl CrosEc {
}
}

pub fn check_mem_magic(&self) -> Option<()> {
pub fn check_mem_magic(&self) -> EcResult<()> {
match self.read_memory(EC_MEMMAP_ID, 2) {
Some(ec_id) => {
if ec_id.len() != 2 {
error!(" Unexpected length returned: {:?}", ec_id.len());
return None;
}
if ec_id[0] != b'E' || ec_id[1] != b'C' {
error!(" This machine doesn't look like it has a Framework EC");
None
Err(EcError::DeviceError(format!(
" Unexpected length returned: {:?}",
ec_id.len()
)))
} else if ec_id[0] != b'E' || ec_id[1] != b'C' {
Err(EcError::DeviceError(
"This machine doesn't look like it has a Framework EC".to_string(),
))
} else {
println!(" Verified that Framework EC is present!");
Some(())
Ok(())
}
}
None => {
error!(" Failed to read EC ID from memory map");
None
}
None => Err(EcError::DeviceError(
"Failed to read EC ID from memory map".to_string(),
)),
}
}

Expand Down
16 changes: 16 additions & 0 deletions framework_lib/src/chromium_ec/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ use windows::{
use crate::chromium_ec::protocol::HEADER_LEN;
use crate::chromium_ec::EC_MEMMAP_SIZE;
use crate::chromium_ec::{EcError, EcResponseStatus, EcResult};
use crate::smbios;
use crate::util::Platform;

// Create a wrapper around HANDLE to mark it as Send.
// I'm not sure, but I think it's safe to do that for this type of HANDL.
Expand Down Expand Up @@ -46,6 +48,20 @@ fn init() -> bool {
let handle = match res {
Ok(h) => h,
Err(err) => {
let platform = smbios::get_platform();
match platform {
Some(platform @ Platform::IntelGen11)
| Some(platform @ Platform::IntelGen12)
| Some(platform @ Platform::IntelGen13)
| Some(platform @ Platform::Framework13Amd7080)
| Some(platform @ Platform::Framework16Amd7080) => {
println!("The windows driver is not enabled on {:?}.", platform);
println!("Please stay tuned for future BIOS and driver updates.");
println!();
}
_ => (),
}

error!("Failed to find Windows driver. {:?}", err);
return false;
}
Expand Down
5 changes: 3 additions & 2 deletions framework_lib/src/commandline/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,7 @@ pub fn run_with_args(args: &Cli, _allupdate: bool) -> i32 {
} else if args.version {
print_tool_version();
} else if args.features {
ec.get_features().unwrap();
print_err(ec.get_features());
} else if args.esrt {
print_esrt();
} else if let Some(compare_version_ver) = &args.compare_version {
Expand Down Expand Up @@ -1340,7 +1340,8 @@ fn selftest(ec: &CrosEc) -> Option<()> {
}

println!(" Checking EC memory mapped magic bytes");
ec.check_mem_magic()?;
print_err(ec.check_mem_magic())?;
println!(" Verified that Framework EC is present!");

println!(" Reading EC Build Version");
print_err(ec.version_info())?;
Expand Down
3 changes: 3 additions & 0 deletions framework_tool/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ version = "0.3.9"
features = [
"wincon"
]

[package.metadata.winresource]
LegalCopyright = "Framework Computer Inc © 2022"
Loading