Re: RFC: Platform data for onboard USB assets

Alan Stern
2011-03-12T16:00:12Z

On Fri, 11 Mar 2011, Greg KH wrote:

> > Alright: is there a better invariant nomenclature to talk about "the
> > gadget / host that is running on a particular pair of pins"? That's
> > the ultimate definition of what's wired to what.
>
> For USB, there is no such thing, sorry. You can see the "device
> connected to the 3rd port of the second hub" but that's a mess and those
> numbers can (and do) change randomly at boot time.

The situation isn't quite that bad.

For gadgets this issue doesn't really arise. Until very recently it
wasn't possible to have more that one gadget driver loaded at any time
(in fact, it still may not be possible -- I don't recall whether the
changes have been merged yet). In any case, gadget drivers are usually
build as modules, so any necessary information could be passed as a
module parameter.

For USB devices, the topology path below the root hub _is_ fixed. If
you know that a particular device is hardwired to port 2 of a
particular root hub, that's not going to change. The problem is how to
identify the root hub.

This depends on the platform. On PCs, USB host controllers are usually
PCI devices. The only way to identify them is by the PCI device name.
Although these names don't change often, they _can_ change. On an
embedded system there usually are only a couple of host controllers and
they have more or less fixed names.

Alan Stern