Browse Source

i2c: shell: Fix shell error output

The i2c shell write command outputs the error "Failed to read from
device" while it tries to write data to device.

This fixes the error by outputting "Failed to write to device" instead.

Fixes:

	uart:~$ i2c write i2c@3ff53000 23 01
	Failed to read from device: 23

Signed-off-by: Gaël PORTAY <gael.portay@rtone.fr>
pull/58058/head
Gaël PORTAY 2 years ago committed by Carles Cufí
parent
commit
2be2fa8bd6
  1. 2
      drivers/i2c/i2c_shell.c

2
drivers/i2c/i2c_shell.c

@ -163,7 +163,7 @@ static int i2c_write_from_buffer(const struct shell *shell_ctx, @@ -163,7 +163,7 @@ static int i2c_write_from_buffer(const struct shell *shell_ctx,
buf + MAX_BYTES_FOR_REGISTER_INDEX - reg_addr_bytes,
reg_addr_bytes + data_length, dev_addr);
if (ret < 0) {
shell_error(shell_ctx, "Failed to read from device: %s",
shell_error(shell_ctx, "Failed to write to device: %s",
s_dev_addr);
return -EIO;
}

Loading…
Cancel
Save