All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa+renesas@sang-engineering.com>
To: Brigham Campbell <me@brighamcampbell.com>
Cc: "Jean Delvare" <jdelvare@suse.de>,
	linux-i2c@vger.kernel.org,
	"Gero Schwäricke" <gero.schwaericke@sevenlab.de>
Subject: Re: [PATCH v5 1/2] i2c-tools: Allow passing device file paths
Date: Sun, 15 Nov 2026 23:34:00 +0100	[thread overview]
Message-ID: <avozVLlVBDmYy6tc@shikoro> (raw)
In-Reply-To: <avB0jS2RfBHgZ6Zi@shikoro>

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

Hi Brigham,

> > +	i2cbus_ul = strtoul(i2cbus_arg, &end, 0);
> > +	if (!*end && *i2cbus_arg) {
> > +		if (i2cbus_ul > 0xFFFFF) {
> > +			fprintf(stderr, "Error: I2C bus out of range!\n");
> > +			return -2;
> 
> This fails if you use a name/path like "1111111111111". A diff like this
> makes it work:
> 
> diff --git a/tools/i2cbusses.c b/tools/i2cbusses.c
> index 40d863f..47ebffa 100644
> --- a/tools/i2cbusses.c
> +++ b/tools/i2cbusses.c
> @@ -436,12 +436,7 @@ int open_i2c_dev(char *i2cbus_arg, char **filename, size_t size, int quiet)
>  	char *end;
>  
>  	i2cbus_ul = strtoul(i2cbus_arg, &end, 0);
> -	if (!*end && *i2cbus_arg) {
> -		if (i2cbus_ul > 0xFFFFF) {
> -			fprintf(stderr, "Error: I2C bus out of range!\n");
> -			return -2;
> -		}
> -
> +	if (!*end && *i2cbus_arg && i2cbus_ul < 0x100000) {
>  		return open_i2c_dev_by_nr(i2cbus_ul, *filename, size, quiet);
>  	}
>  
> 
> That should do it, or?

Do you need some more time to review? Or are you okay with me applying
it with my suggested addition?

Happy hacking,

   Wolfram


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

  reply	other threads:[~2026-11-15 22:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-22  8:52 [PATCH v5 0/2] i2c-tools: Make tools accept bus path Brigham Campbell
2026-07-22  8:52 ` [PATCH v5 1/2] i2c-tools: Allow passing device file paths Brigham Campbell
2026-11-08 13:09   ` Wolfram Sang
2026-11-15 22:34     ` Wolfram Sang [this message]
2026-11-16  7:23     ` Brigham Campbell
2026-11-16  8:00       ` Wolfram Sang
2026-07-22  8:52 ` [PATCH v5 2/2] i2c-tools: Document device paths as I2CBUS arg Brigham Campbell
2026-09-07 21:18 ` [PATCH v5 0/2] i2c-tools: Make tools accept bus path Brigham Campbell
2026-09-27 16:02   ` Wolfram Sang
2026-10-04  2:57     ` Brigham Campbell
2026-11-16  8:04 ` 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=avozVLlVBDmYy6tc@shikoro \
    --to=wsa+renesas@sang-engineering.com \
    --cc=gero.schwaericke@sevenlab.de \
    --cc=jdelvare@suse.de \
    --cc=linux-i2c@vger.kernel.org \
    --cc=me@brighamcampbell.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.