[PATCH 3/3] commands: i2c: add message if write is not successful

Silvio Fricke silvio.fricke at gmail.com
Thu Jul 10 07:19:56 PDT 2014


Signed-off-by: Silvio Fricke <silvio.fricke at gmail.com>
---
 commands/i2c.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/commands/i2c.c b/commands/i2c.c
index e3d79b0..d6c5412 100644
--- a/commands/i2c.c
+++ b/commands/i2c.c
@@ -114,8 +114,12 @@ static int do_i2c_write(int argc, char *argv[])
 		*(buf + i) = (char) simple_strtol(argv[optind+i], NULL, 16);
 
 	ret = i2c_write_reg(&client, reg | wide, buf, count);
-	if (ret != count)
+	if (ret != count) {
+		if (verbose)
+			printf("write aborted, count(%i) != writestatus(%i)\n",
+				count, ret);
 		goto out;
+	}
 	ret = 0;
 
 	if (verbose) {
-- 
2.0.1




More information about the barebox mailing list