gud: set PATH connector property

Simon Ser contact at emersion.fr
Thu Mar 2 12:01:48 UTC 2023


On Tuesday, February 28th, 2023 at 16:16, Peter Stuge <peter at stuge.se> wrote:

> Simon Ser wrote:
> 
> > > > Would it be possible to set the PATH connector property based on the
> > > > USB port used by gud?
> > > 
> > > Sadly not really easily.
> > > 
> > > The physical topology underneath each host controller is stable but
> > > bus numbers (usb1, usb2 etc.) are not.
> > 
> > Oh, that's news to me. So if I unplug and replug a USB device, the bus
> > number and bus device number might change?
> 
> The bus number is stable as long as the bus (host controller) exists.
> 
> > Or does this happen after a power-cycle? Or is this hardware-specific?
> 
> Consider a host controller on a plug-in card, like ExpressCard (usb1)
> and perhaps Thunderbolt (usb2) for a more modern example.
> 
> The bus on each new host controller gets the next available bus number.
> 
> Plug ExpressCard before Thunderbolt to get the order above. Unplug
> both (usb1+usb2 disappear) then plug Thunderbolt back in before
> ExpressCard; now Thunderbolt is usb1 and ExpressCard usb2.

Hm, right. With a first-come-first-served scheme, there is no way to
have stable identifiers.

I'm having a look at prior art: udev has similar needs for network
interface names. For USB they use [2] a scheme with
port/config/interface. I have no idea what meaning these have, but
would they be useful for building a PATH KMS property?

[1]: https://www.freedesktop.org/software/systemd/man/systemd.net-naming-scheme.html
[2]: https://github.com/systemd/systemd/blob/7a67afe33192ce4a55e6825b80554fb4ebbb4b03/src/udev/udev-builtin-net_id.c#L758

> > > For onboard host controllers it could be possible to anchor to a
> > > PCI or platform bus device.
> > 
> > But the PCI bus device isn't enough I think? If I have a onboard host
> > controller with 2 physical USB ports, the PCI bus device isn't enough
> > to tell these 2 physical ports apart?
> 
> Only the PCI bus device is not enough, but it could serve as a
> unique anchor and some host controller-specific information (e.g.
> root port number) can be added to that.
> 
> > > How about using e.g. the serial number of the gud USB device instead
> > > of host topology, or maybe some other information from the panel
> > > behind it?
> > 
> > The PATH property is really about the port path, not the sink. IOW, if
> > I have two USB displays, one USB port, and switch between the two
> > displays on this one port, the PATH property isn't supposed to change.
>  
> Hmm. What is "port path" supposed to mean across a hot-pluggable bus?
> 
> Should PATH refer to the one ExpressCard host controller if it moves
> between slots (assuming a computer with two slots) or should it
> rather refer to "the upper USB port on the right hand side ExpressCard"
> so I can insert another brand host controller in that slot without
> PATH changing?

I think the latter makes most sense. I'll try to send a patch to improve
the PATH property docs.


More information about the dri-devel mailing list