Commit 74735e14 authored by Ren Chen's avatar Ren Chen Committed by github-actions[bot]
Browse files

drivers: i3c: shell: fix the judgement/argc count for getstatus/ibi tir

The errno for format 2 of the getstatus ccc always returns an error.
The check for the invalid defining byte should use the "AND" operation
instead of "OR." Additionally, the first byte of the ibi tir sending
request is ignored due to the incorrect argument count.
This commit fixes both issues.

Signed-off-by: default avatarRen Chen <Ren.Chen@ite.com.tw>
(cherry picked from commit 20dbf4d7)
parent 9511aac2
Loading
Loading
Loading
Loading
+3 −3
Changes for drivers/i3c/i3c_shell.c: 3 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -1430,7 +1430,7 @@ static int cmd_i3c_ccc_getstatus(const struct shell *sh, size_t argc, char **arg
	if (argc > 3) {
		fmt = GETSTATUS_FORMAT_2;
		defbyte = strtol(argv[3], NULL, 16);
		if (defbyte != GETSTATUS_FORMAT_2_TGTSTAT || defbyte != GETSTATUS_FORMAT_2_PRECR) {
		if (defbyte != GETSTATUS_FORMAT_2_TGTSTAT && defbyte != GETSTATUS_FORMAT_2_PRECR) {
			shell_error(sh, "Invalid defining byte.");
			return -EINVAL;
		}
@@ -2075,9 +2075,9 @@ static int cmd_i3c_ibi_tir(const struct shell *sh, size_t argc, char **argv)
		return -ENODEV;
	}

	data_length = argc - 3;
	data_length = argc - 2;
	for (i = 0; i < data_length; i++) {
		buf[i] = (uint8_t)strtol(argv[3 + i], NULL, 16);
		buf[i] = (uint8_t)strtol(argv[2 + i], NULL, 16);
	}

	request.ibi_type = I3C_IBI_TARGET_INTR;