Messages in this thread | | | Date | Tue, 24 Apr 2012 10:14:05 -0400 (EDT) | From | Alan Stern <> | Subject | Re: [RFC]Is usb port number fixed? |
| |
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
| |