From: "Benoît Monin" <benoit.monin@bootlin.com>
To: linux-i2c@vger.kernel.org
Cc: "Jean Delvare" <jdelvare@suse.de>,
"Wolfram Sang" <wsa+renesas@sang-engineering.com>,
"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
"Benoît Monin" <benoit.monin@bootlin.com>
Subject: [PATCH] i2ctransfer: Print modifier flags in PRINT_HEADER
Date: Mon, 06 Jul 2026 15:18:46 +0200 [thread overview]
Message-ID: <20260706-print-header-flags-v1-1-6d63b357d77b@bootlin.com> (raw)
Print the optional message modifier flags when printing the message
header. For example:
i2ctransfer -v -y 3 pr1@0x33 itr1@0x33
msg 0: addr 0x33, read, len 1, emit STOP, buf 0x10
msg 1: addr 0x33, read, len 1, ignore NACK, toggle read/write bit, buf 0x10
If no optional flag is set, the output is unchanged.
Signed-off-by: Benoît Monin <benoit.monin@bootlin.com>
---
tools/i2ctransfer.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/tools/i2ctransfer.c b/tools/i2ctransfer.c
index a49b734..0a310a7 100644
--- a/tools/i2ctransfer.c
+++ b/tools/i2ctransfer.c
@@ -123,6 +123,26 @@ static void print_msgs(struct i2c_msg *msgs, __u32 nmsgs, unsigned int flags)
fprintf(output, "%u", len);
else
fprintf(output, "TBD");
+#ifdef I2C_M_IGNORE_NAK
+ if (msgs[i].flags & I2C_M_IGNORE_NAK)
+ fprintf(output, ", ignore NACK");
+#endif
+#ifdef I2C_M_NO_RD_ACK
+ if (msgs[i].flags & I2C_M_NO_RD_ACK)
+ fprintf(output, ", no master ACK/NACK bit");
+#endif
+#ifdef I2C_M_STOP
+ if (msgs[i].flags & I2C_M_STOP)
+ fprintf(output, ", emit STOP");
+#endif
+#ifdef I2C_M_NOSTART
+ if (msgs[i].flags & I2C_M_NOSTART)
+ fprintf(output, ", skip repeated start");
+#endif
+#ifdef I2C_M_REV_DIR_ADDR
+ if (msgs[i].flags & I2C_M_REV_DIR_ADDR)
+ fprintf(output, ", toggle read/write bit");
+#endif
}
if (len && print_buf) {
---
base-commit: 5852f5375eea6ca9dabf31f4772cb8b8ecc905d8
change-id: 20260706-print-header-flags-e841fc4398ed
Best regards,
--
Benoît Monin, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
next reply other threads:[~2026-07-06 13:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-06 13:18 Benoît Monin [this message]
2026-07-07 13:48 ` [PATCH] i2ctransfer: Print modifier flags in PRINT_HEADER Wolfram Sang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260706-print-header-flags-v1-1-6d63b357d77b@bootlin.com \
--to=benoit.monin@bootlin.com \
--cc=jdelvare@suse.de \
--cc=linux-i2c@vger.kernel.org \
--cc=thomas.petazzoni@bootlin.com \
--cc=wsa+renesas@sang-engineering.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox