MCPcopy Index your code
hub / github.com/FrameworkComputer/framework-system / check_mem_magic

Method check_mem_magic

framework_lib/src/chromium_ec/mod.rs:286–306  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

284 }
285
286 pub fn check_mem_magic(&self) -> EcResult<()> {
287 match self.read_memory(EC_MEMMAP_ID, 2) {
288 Some(ec_id) => {
289 if ec_id.len() != 2 {
290 Err(EcError::DeviceError(format!(
291 " Unexpected length returned: {:?}",
292 ec_id.len()
293 )))
294 } else if ec_id[0] != b'E' || ec_id[1] != b'C' {
295 Err(EcError::DeviceError(
296 "This machine doesn't look like it has a Framework EC".to_string(),
297 ))
298 } else {
299 Ok(())
300 }
301 }
302 None => Err(EcError::DeviceError(
303 "Failed to read EC ID from memory map".to_string(),
304 )),
305 }
306 }
307
308 pub fn cmd_version_supported(&self, cmd: u32, version: u8) -> EcResult<bool> {
309 let res = EcRequestGetCmdVersionsV1 { cmd }.send_command(self);

Callers 1

selftestFunction · 0.80

Calls 1

read_memoryMethod · 0.80

Tested by

no test coverage detected