From 7830c7986f16181b233411d317f3bf9f8c112267 Mon Sep 17 00:00:00 2001 From: Ondrej Jirman Date: Wed, 12 Jan 2022 13:36:47 +0100 Subject: [PATCH] Fix writing charger registers (result detection was broken) --- i2c-charger-ctl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/i2c-charger-ctl.c b/i2c-charger-ctl.c index 18de5c6..2b8b7bc 100644 --- a/i2c-charger-ctl.c +++ b/i2c-charger-ctl.c @@ -201,12 +201,12 @@ void write_power(int fd, uint8_t reg, uint8_t val) ret = ioctl(fd, I2C_RDWR, &msg2); syscall_error(ret < 0, "I2C_RDWR failed"); - if (buf3[1] == REG_SYS_COMMAND_CHG_WRITE) + if (buf3[0] == REG_SYS_COMMAND_CHG_WRITE) continue; - if (buf3[1] == 0) + if (buf3[0] == 0) return; - if (buf3[1] == 0xff) + if (buf3[0] == 0xff) error("Proxy write failed with %x\n", buf3[0]); } }