Read a block of bytes, returning whatever length the device provides
(&self, ec: &CrosEc, addr: u16, max_len: u16)
| 847 | |
| 848 | /// Read a block of bytes, returning whatever length the device provides |
| 849 | fn read_block(&self, ec: &CrosEc, addr: u16, max_len: u16) -> EcResult<Vec<u8>> { |
| 850 | let i2c_response = i2c_read(ec, self.i2c_port, self.i2c_addr >> 1, addr, max_len + 1)?; |
| 851 | i2c_response.is_successful()?; |
| 852 | let actual_len = i2c_response.data[0] as usize; |
| 853 | Ok(i2c_response.data[1..=actual_len].to_vec()) |
| 854 | } |
| 855 | |
| 856 | /// Raw I2C read without SMBus block length prefix handling |
| 857 | fn read_raw(&self, ec: &CrosEc, addr: u16, len: u16) -> EcResult<Vec<u8>> { |
no test coverage detected