summaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2018-08-21 17:18:25 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2018-08-22 09:36:58 +0200
commit0657fdc4cdc847c3f3bdc567405c1d115fc54ba2 (patch)
tree4bb2239ff0e2bfacb526d1a512a851035ee6da94 /commands
parentf0624a701513e5444340e7f071ac875d34b39336 (diff)
downloadbarebox-0657fdc4cdc847c3f3bdc567405c1d115fc54ba2.tar.gz
i2c_write: document master send mode
When no explicit start register is given, the i2c message is emitted in master send mode. Signed-off-by: Aleksander Morgado <aleksander@aleksander.es> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands')
-rw-r--r--commands/i2c.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/commands/i2c.c b/commands/i2c.c
index f0d16af..57dc092 100644
--- a/commands/i2c.c
+++ b/commands/i2c.c
@@ -145,8 +145,12 @@ static int do_i2c_write(int argc, char *argv[])
ret = 0;
if (verbose) {
- printf("wrote %i bytes starting at reg 0x%04x to i2cdev 0x%02x on bus %i\n",
- count, reg, addr, adapter->nr);
+ if (reg >= 0)
+ printf("wrote %i bytes starting at reg 0x%04x to i2cdev 0x%02x on bus %i\n",
+ count, reg, addr, adapter->nr);
+ else
+ printf("sent %i bytes in master send mode to i2cdev 0x%02x on bus %i\n",
+ count, addr, adapter->nr);
for (i = 0; i < count; i++)
printf("0x%02x ", *(buf + i));
printf("\n");
@@ -161,7 +165,7 @@ BAREBOX_CMD_HELP_START(i2c_write)
BAREBOX_CMD_HELP_TEXT("Options:")
BAREBOX_CMD_HELP_OPT ("-b BUS\t", "i2c bus number (default 0)")
BAREBOX_CMD_HELP_OPT ("-a ADDR\t", "i2c device address")
-BAREBOX_CMD_HELP_OPT ("-r START", "start register")
+BAREBOX_CMD_HELP_OPT ("-r START", "start register (optional, master send mode if none given)")
BAREBOX_CMD_HELP_OPT ("-w\t", "use word (16 bit) wide access")
BAREBOX_CMD_HELP_OPT ("-v\t", "verbose")
BAREBOX_CMD_HELP_END