[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.44L0.1204202028250.19313-100000@netrider.rowland.org>
Date: Fri, 20 Apr 2012 20:32:37 -0400 (EDT)
From: Alan Stern <stern@...land.harvard.edu>
To: Greg KH <greg@...ah.com>
cc: Wang YanQing <Udknight@...il.com>,
lkml <linux-kernel@...r.kernel.org>, <linux-usb@...r.kernel.org>
Subject: Re: [RFC]Is usb port number fixed?
On Fri, 20 Apr 2012, Greg KH wrote:
> > Make the question precise.
> > I assme there are two usb ports in my notebook at left and right separately.
> > When I plug mouse into
> > left usb port, I get 2-1.1:1.0
> > right usb port, I get 2-1.2:1.0
> >
> > I want to know whether it is right that no matter how many times I reboot the machine,
>
> Not always.
>
> > the test result above will be the same.And if it will be the same, then why it will be the same.
>
> You got lucky :)
>
> USB ports on a hub are all enumerated the same, but the root hubs
> aren't, and sometimes hubs on the same bus are not as well.
>
> But usually, things do come up in the same way all the time, so
> depending on your use case, you can rely on this, but it is recommended
> that you look for something else a bit more unique, like a serial number
> on a device (if it is present), if you wish to uniquely identify a
> device all the time.
In this particular case, it is guaranteed that the left USB port will
always be numbered as X-1.1:1.0 and the right port as X-1.2:1.0, where
the number X may change from one boot to another. But the -1.1:1.0 and
-1.2:1.0 parts will always be the same.
This is because X is the bus number, which is allowed to change. The
-1.1:1.0 and -1.2:1.0 values are port, configuration, and interface
numbers. They will never change, because they come from the hardware.
Alan Stern
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists