Linux I2C development
 help / color / mirror / Atom feed
From: "Benoît Monin" <benoit.monin@bootlin.com>
To: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: linux-i2c@vger.kernel.org, Jean Delvare <jdelvare@suse.de>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH i2c-tools v3 2/2] i2ctransfer: Add optional message modifier flags
Date: Thu, 04 Jun 2026 18:00:17 +0200	[thread overview]
Message-ID: <oyWrZgMUT2iRI0tfI5ARxw@bootlin.com> (raw)
In-Reply-To: <ah_Y0bOyXRajpp8O@ninjato>

Hi Wolfram,

On Wednesday, 3 June 2026 at 09:33:37 CEST, Wolfram Sang wrote:
[...]
> This error message now only shows up if the 'rw'-flag is missing at the
> end of the commandline:
> 
> # ./i2ctransfer -y 0 p
> Error: Missing direction flag 'r' or 'w'
> Error: faulty argument is 'p'
> 
> Otherwise it complains about '@' not being a flag:
> 
> # ./i2ctransfer -y 0 p@0x1a
> Error: Unsupported flag '@'
> Error: faulty argument is 'p@0x1a'
> 
> It would be nice if '@' would be recognized as a terminator for the
> flags and would then complain about the missing direction flag, or?

It's true that the error message is imprecise but I wanted to avoid
duplicating the parsing that is done after parsing the flags. I can add
something like the following in the switch case in add_flag_if_supported():


@@ -202,6 +202,20 @@ static int add_flag_if_supported(__u16 *flags, unsigned long funcs, char arg)
                        break;
 #endif
 
+               case '0':
+               case '1':
+               case '2':
+               case '3':
+               case '4':
+               case '5':
+               case '6':
+               case '7':
+               case '8':
+               case '9':
+               case '?':
+               case '@':
+                       return 0;
+
                default:


With this we get out of the flags parsing and the "Missing direction flag"
error message is shown. What's your opinion on this?

Best regards,
-- 
Benoît Monin, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com




  reply	other threads:[~2026-06-04 16:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-27  9:25 [PATCH i2c-tools v3 0/2] Add support for message modifier flags Benoît Monin
2026-01-27  9:25 ` [PATCH i2c-tools v3 1/2] i2cdetect: Display mangling and nostart support Benoît Monin
2026-06-03  7:33   ` Wolfram Sang
2026-01-27  9:25 ` [PATCH i2c-tools v3 2/2] i2ctransfer: Add optional message modifier flags Benoît Monin
2026-06-03  7:33   ` Wolfram Sang
2026-06-04 16:00     ` Benoît Monin [this message]
2026-06-08  9:21       ` Wolfram Sang
2026-06-08 13:26         ` Benoît Monin
2026-02-17 12:13 ` [PATCH i2c-tools v3 0/2] Add support for " Jean Delvare
2026-03-23  9:12   ` Benoît Monin
2026-05-29 19:58     ` 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=oyWrZgMUT2iRI0tfI5ARxw@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