Skip to content

Commit 9532636

Browse files
committed
i2c_passthru: Use single byte address if enough
Double byte address if the address is low causes issues on some devices (PS8835). Signed-off-by: Daniel Schaefer <[email protected]>
1 parent 7a3660b commit 9532636

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

framework_lib/src/chromium_ec/i2c_passthrough.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,11 @@ pub fn i2c_read(
7979
len
8080
)));
8181
}
82-
let addr_bytes = u16::to_le_bytes(addr);
82+
let addr_bytes = if addr < 0xFF {
83+
vec![addr as u8]
84+
} else {
85+
u16::to_le_bytes(addr).to_vec()
86+
};
8387
let messages = vec![
8488
EcParamsI2cPassthruMsg {
8589
addr_and_flags: i2c_addr,

0 commit comments

Comments
 (0)