Re: [RFC]Is usb port number fixed?

From: Alan Stern
Date: Tue Apr 24 2012 - 10:14:13 EST


On Tue, 24 Apr 2012, Wang YanQing wrote:

> On Mon, Apr 23, 2012 at 11:13:06AM -0400, Alan Stern wrote:
> > The port numbers are determined by the hardware -- each set of wires
> > has its own port number. The numbers have nothing to do with
> > bandwidth.
> Could you figure out the codes in kernel that read out the port number from
> hub, if there is a piece of codes do that things?

In drivers/usb/core/hub.c, look through the hub_events() routine.
There are several function calls similar to this one:

ret = hub_port_status(hub, i,
&portstatus, &portchange);

Here i is the port number. This asks the hub to send back status and
change information for port i. (See also the code for the
hub_port_status() and get_port_status() routines.)

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/