From 7379c6a2c7800a9e96b65ff847083c0e17623401 Mon Sep 17 00:00:00 2001 From: Kieran Levin Date: Thu, 14 May 2026 17:45:03 -0700 Subject: [PATCH 1/3] fw16: fix invalid length read length This fixes an invalid read length that was truncating reads from the GPU descriptor EEPROM as the length is header+descriptor Signed-off-by: Kieran Levin --- framework_lib/src/chromium_ec/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework_lib/src/chromium_ec/mod.rs b/framework_lib/src/chromium_ec/mod.rs index c538c75..f6fe27e 100644 --- a/framework_lib/src/chromium_ec/mod.rs +++ b/framework_lib/src/chromium_ec/mod.rs @@ -1551,7 +1551,7 @@ impl CrosEc { "Invalid descriptor hdr magic".to_string(), )); } - self.read_ec_gpu_chunk(0x00, header.descriptor_length as u16) + self.read_ec_gpu_chunk(0x00, (header.descriptor_length + header.length) as u16) } pub fn read_gpu_desc_header(&self) -> EcResult { From 10bea528b177ed00aa6eaf42121b605a7139af00 Mon Sep 17 00:00:00 2001 From: Kieran Levin Date: Thu, 14 May 2026 21:45:46 -0700 Subject: [PATCH 2/3] i2c passthrough, add trace for i2c response data Signed-off-by: Kieran Levin --- framework_lib/src/chromium_ec/i2c_passthrough.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/framework_lib/src/chromium_ec/i2c_passthrough.rs b/framework_lib/src/chromium_ec/i2c_passthrough.rs index 323b490..aca6a5a 100644 --- a/framework_lib/src/chromium_ec/i2c_passthrough.rs +++ b/framework_lib/src/chromium_ec/i2c_passthrough.rs @@ -179,6 +179,11 @@ pub fn i2c_read_16bit_addr( let res: _EcI2cPassthruResponse = unsafe { std::ptr::read(data.as_ptr() as *const _) }; let res_data = &data[size_of::<_EcI2cPassthruResponse>()..]; debug_assert!(res.messages as usize == messages.len() || res.messages == 0); + trace!( + " i2c_read_16bit_addr response (len: {}, data: {:#04X?})", + res_data.len(), + res_data.to_vec() + ); Ok(EcI2cPassthruResponse { i2c_status: res.i2c_status, data: res_data.to_vec(), From d8ca131464894884ffd4916bd1ac69699897da66 Mon Sep 17 00:00:00 2001 From: Kieran Levin Date: Fri, 15 May 2026 01:09:10 -0700 Subject: [PATCH 3/3] i2c read - truncate return buf to request size i2c verification was failing due to on windows there are additional bytes in the response from send_command. So truncate the extra bytes to the request size Signed-off-by: Kieran Levin --- framework_lib/src/chromium_ec/i2c_passthrough.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/framework_lib/src/chromium_ec/i2c_passthrough.rs b/framework_lib/src/chromium_ec/i2c_passthrough.rs index aca6a5a..3649ac2 100644 --- a/framework_lib/src/chromium_ec/i2c_passthrough.rs +++ b/framework_lib/src/chromium_ec/i2c_passthrough.rs @@ -177,7 +177,9 @@ pub fn i2c_read_16bit_addr( let data = ec.send_command(EcCommands::I2cPassthrough as u16, 0, &buffer)?; let res: _EcI2cPassthruResponse = unsafe { std::ptr::read(data.as_ptr() as *const _) }; - let res_data = &data[size_of::<_EcI2cPassthruResponse>()..]; + let header_len: usize = size_of::<_EcI2cPassthruResponse>(); + /* Note on windows, you can get extra bytes back, so truncate this to the requested size */ + let res_data = &data[header_len..(len as usize + header_len)]; debug_assert!(res.messages as usize == messages.len() || res.messages == 0); trace!( " i2c_read_16bit_addr response (len: {}, data: {:#04X?})",