Linux I2C development
 help / color / mirror / Atom feed
* [PATCH] i2ctransfer: Print modifier flags in PRINT_HEADER
@ 2026-07-06 13:18 Benoît Monin
  2026-07-07 13:48 ` Wolfram Sang
  0 siblings, 1 reply; 2+ messages in thread
From: Benoît Monin @ 2026-07-06 13:18 UTC (permalink / raw)
  To: linux-i2c; +Cc: Jean Delvare, Wolfram Sang, Thomas Petazzoni, Benoît Monin

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] i2ctransfer: Print modifier flags in PRINT_HEADER
  2026-07-06 13:18 [PATCH] i2ctransfer: Print modifier flags in PRINT_HEADER Benoît Monin
@ 2026-07-07 13:48 ` Wolfram Sang
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfram Sang @ 2026-07-07 13:48 UTC (permalink / raw)
  To: Benoît Monin; +Cc: linux-i2c, Jean Delvare, Thomas Petazzoni

[-- Attachment #1: Type: text/plain, Size: 495 bytes --]

On Mon, Jul 06, 2026 at 03:18:46PM +0200, Benoît Monin wrote:
> 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>

Applied, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-07-07 13:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-06 13:18 [PATCH] i2ctransfer: Print modifier flags in PRINT_HEADER Benoît Monin
2026-07-07 13:48 ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox