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>
This commit is contained in:
Gaël PORTAY 2023-03-03 10:18:59 +01:00 committed by Carles Cufí
parent 0931d8da93
commit 2be2fa8bd6

View file

@ -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;
}