(&self, ec: &CrosEc, addr: u16)
| 823 | } |
| 824 | |
| 825 | fn read_string(&self, ec: &CrosEc, addr: u16) -> EcResult<String> { |
| 826 | // SMBus strings are length-prefixed |
| 827 | let i2c_response = i2c_read(ec, self.i2c_port, self.i2c_addr >> 1, addr, 0x20)?; |
| 828 | i2c_response.is_successful()?; |
| 829 | // First byte is the returned string length |
| 830 | let str_bytes = &i2c_response.data[1..=(i2c_response.data[0] as usize)]; |
| 831 | Ok(String::from_utf8_lossy(str_bytes).to_string()) |
| 832 | } |
| 833 | |
| 834 | /// Read a block of bytes with expected length |
| 835 | fn read_bytes(&self, ec: &CrosEc, addr: u16, len: u16) -> EcResult<Vec<u8>> { |
no test coverage detected