diff options
author | Puthikorn Voravootivat <puthik@chromium.org> | 2014-08-13 10:29:53 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-08-18 23:16:32 +0000 |
commit | be060242e310090a421f70caa5917e2808f26433 (patch) | |
tree | 1634c2c5ec94af51f1573cac990bc98a0e0c6faa /util/comm-i2c.c | |
parent | a25d675bc00fdbde0f30b31af4a58a9616aa8eed (diff) | |
download | chrome-ec-be060242e310090a421f70caa5917e2808f26433.tar.gz |
Fix ec detection for i2c protocol
ectool seems to looks at wrong location for ec.
This patch fix that
BRANCH=none
BUG=chromium:402581,chrome-os-partner:30707
TEST=ectool hello runs fine on ryu
Change-Id: I7b847b0eaf3fd39a8ba2948a87879b3f8223c582
Signed-off-by: Puthikorn Voravootivat <puthik@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/212483
Reviewed-by: Vic Yang <victoryang@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'util/comm-i2c.c')
-rw-r--r-- | util/comm-i2c.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/util/comm-i2c.c b/util/comm-i2c.c index a6fc8691dd..aa1e4f64d8 100644 --- a/util/comm-i2c.c +++ b/util/comm-i2c.c @@ -21,8 +21,8 @@ #define EC_I2C_ADDR 0x1e -#define I2C_ADAPTER_NODE "/sys/class/i2c-adapter/i2c-%d/name" -#define I2C_ADAPTER_NAME "cros_ec_i2c" +#define I2C_ADAPTER_NODE "/sys/class/i2c-adapter/i2c-%d/%d-%04x/name" +#define I2C_ADAPTER_NAME "cros-ec-i2c" #define I2C_MAX_ADAPTER 32 #define I2C_NODE "/dev/i2c-%d" @@ -179,7 +179,8 @@ int comm_init_i2c(void) /* find the device number based on the adapter name */ for (i = 0; i < I2C_MAX_ADAPTER; i++) { - if (asprintf(&file_path, I2C_ADAPTER_NODE, i) < 0) + if (asprintf(&file_path, I2C_ADAPTER_NODE, + i, i, EC_I2C_ADDR) < 0) return -1; f = fopen(file_path, "r"); if (f) { |