* [RFC][i2c-tools] Accept device-node path as alternative to bus number
@ 2025-11-10 14:57 Gero Schwäricke
2025-11-10 16:15 ` Wolfram Sang
0 siblings, 1 reply; 7+ messages in thread
From: Gero Schwäricke @ 2025-11-10 14:57 UTC (permalink / raw)
To: linux-i2c; +Cc: Jean Delvare
I'm working with multiple hotpluggable I2C adapters and have the
following proposal:
Allow all i2c-tools to accept a device-node path (e.g., /dev/i2c-5) as
the i2cbus argument.
Example:
# pre RFC:
i2cget 5 0x48
# post RFC:
i2cget /dev/i2c-5 0x48
Motivation:
- Paths can be made stable via udev symlinks even when bus numbers vary
between boots, hotplugging, or across machines.
- Scripts often already have a device node path. Accepting the path
removes the need to parse out the numeric bus ID.
Backward compatibility:
- No behavior change for existing invocations.
- The first non-option argv is treated as today unless it begins with
'/', in which case the tool treats it as a path and opens that exact
node.
Sketch of changes:
- For each tool’s argument parsing, detect a leading '/' for the bus
argument.
- If a path is given: use that path; skip bus resolution by number/name.
- Adjust control logic to work with paths instead of bus number.
- Update help/man text: add e.g., "i2cbus indicates ..., or a device
node path like /dev/i2c-5."
Questions for maintainers:
1. Is accepting a device-node path an acceptable extension to the CLI?
2. Currently the bus number/name argument is parsed to an integer and
then only stores as such in struct i2c_adap. When calling open_i2c_dev()
the number is resolved to a /dev/i2c path. Is it acceptable to instead
resolve a given number/name to a path during argument parsing and store
the path in struct i2c_adap instead of the number?
Thank you,
Gero
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC][i2c-tools] Accept device-node path as alternative to bus number
2025-11-10 14:57 [RFC][i2c-tools] Accept device-node path as alternative to bus number Gero Schwäricke
@ 2025-11-10 16:15 ` Wolfram Sang
2025-12-15 13:58 ` Wolfram Sang
2026-02-17 12:19 ` Jean Delvare
0 siblings, 2 replies; 7+ messages in thread
From: Wolfram Sang @ 2025-11-10 16:15 UTC (permalink / raw)
To: Gero Schwäricke; +Cc: linux-i2c, Jean Delvare
[-- Attachment #1: Type: text/plain, Size: 244 bytes --]
On Mon, Nov 10, 2025 at 03:57:34PM +0100, Gero Schwäricke wrote:
> I'm working with multiple hotpluggable I2C adapters and have the
> following proposal:
From my side, this all sounds reasonable. But we need Jean's opinion
here, too.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC][i2c-tools] Accept device-node path as alternative to bus number
2025-11-10 16:15 ` Wolfram Sang
@ 2025-12-15 13:58 ` Wolfram Sang
2026-01-13 17:38 ` Wolfram Sang
2026-02-17 12:19 ` Jean Delvare
1 sibling, 1 reply; 7+ messages in thread
From: Wolfram Sang @ 2025-12-15 13:58 UTC (permalink / raw)
To: Gero Schwäricke; +Cc: linux-i2c, Jean Delvare
[-- Attachment #1: Type: text/plain, Size: 274 bytes --]
> > I'm working with multiple hotpluggable I2C adapters and have the
> > following proposal:
>
> From my side, this all sounds reasonable. But we need Jean's opinion
> here, too.
Seems Jean is busy. So, from my side, let's go. I can apply it if all is
well...
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC][i2c-tools] Accept device-node path as alternative to bus number
2025-12-15 13:58 ` Wolfram Sang
@ 2026-01-13 17:38 ` Wolfram Sang
2026-01-15 13:39 ` Gero Schwäricke
0 siblings, 1 reply; 7+ messages in thread
From: Wolfram Sang @ 2026-01-13 17:38 UTC (permalink / raw)
To: Gero Schwäricke; +Cc: linux-i2c, Jean Delvare
[-- Attachment #1: Type: text/plain, Size: 437 bytes --]
Hi Gero,
On Mon, Dec 15, 2025 at 10:58:24PM +0900, Wolfram Sang wrote:
>
> > > I'm working with multiple hotpluggable I2C adapters and have the
> > > following proposal:
> >
> > From my side, this all sounds reasonable. But we need Jean's opinion
> > here, too.
>
> Seems Jean is busy. So, from my side, let's go. I can apply it if all is
> well...
Did you have time to develop this?
Happy hacking,
Wolfram
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC][i2c-tools] Accept device-node path as alternative to bus number
2026-01-13 17:38 ` Wolfram Sang
@ 2026-01-15 13:39 ` Gero Schwäricke
2026-01-15 14:16 ` Wolfram Sang
0 siblings, 1 reply; 7+ messages in thread
From: Gero Schwäricke @ 2026-01-15 13:39 UTC (permalink / raw)
To: Wolfram Sang; +Cc: linux-i2c, Jean Delvare
Hi Wolfram,
On Tue Jan 13, 2026 at 6:38 PM CET, Wolfram Sang wrote:
> Hi Gero,
>
> On Mon, Dec 15, 2025 at 10:58:24PM +0900, Wolfram Sang wrote:
>>
>> > > I'm working with multiple hotpluggable I2C adapters and have the
>> > > following proposal:
>> >
>> > From my side, this all sounds reasonable. But we need Jean's opinion
>> > here, too.
>>
>> Seems Jean is busy. So, from my side, let's go. I can apply it if all is
>> well...
>
> Did you have time to develop this?
thanks for following up on this and sorry for the late response, I'm
currently occupied with other work, but I have this still on my TODO
list. I intend to tackle this once I find some uninterrupted time.
Best,
Gero
>
> Happy hacking,
>
> Wolfram
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC][i2c-tools] Accept device-node path as alternative to bus number
2025-11-10 16:15 ` Wolfram Sang
2025-12-15 13:58 ` Wolfram Sang
@ 2026-02-17 12:19 ` Jean Delvare
1 sibling, 0 replies; 7+ messages in thread
From: Jean Delvare @ 2026-02-17 12:19 UTC (permalink / raw)
To: Wolfram Sang; +Cc: Gero Schwäricke, linux-i2c
Hi Gero, Wolfram,
On Mon, 10 Nov 2025 17:15:44 +0100, Wolfram Sang wrote:
> On Mon, Nov 10, 2025 at 03:57:34PM +0100, Gero Schwäricke wrote:
> > I'm working with multiple hotpluggable I2C adapters and have the
> > following proposal:
>
> From my side, this all sounds reasonable. But we need Jean's opinion
> here, too.
Sorry for the delay. The proposal sounds perfectly reasonable to me,
and I'd be happy to see and review a candidate implementation thereof.
Please make sure that any piece of code which is common to all tools
ends up in i2cbusses.c and does not get duplicated.
Thanks,
--
Jean Delvare
SUSE L3 Support
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-02-17 12:19 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-10 14:57 [RFC][i2c-tools] Accept device-node path as alternative to bus number Gero Schwäricke
2025-11-10 16:15 ` Wolfram Sang
2025-12-15 13:58 ` Wolfram Sang
2026-01-13 17:38 ` Wolfram Sang
2026-01-15 13:39 ` Gero Schwäricke
2026-01-15 14:16 ` Wolfram Sang
2026-02-17 12:19 ` Jean Delvare
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox