lkml.org 
[lkml]   [2012]   [Apr]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC]Is usb port number fixed?
On Fri, Apr 20, 2012 at 05:37:38PM +0800, Wang YanQing wrote:
> On Fri, Apr 20, 2012 at 05:25:25PM +0800, Wang YanQing wrote:
> > Hi!
> > when I execute the command below:
> >
> > "ls /sys/bus/usb/devices/"
> >
> > I get:
> > "1-0:1.0 1-1 1-1:1.0 2-0:1.0 2-1 2-1.1 2-1:1.0 2-1.1:1.0 2-1.5 2-1.5:1.0 2-1.5:1.1 usb1 usb2"
> >
> > the output format is bus-port.port:config.interface
> > I want to know whether the port number is fixed after I reboot machine time by time.
> > And if it is fixed, then what make it.
> >
> > Thanks!
>
> 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.

good luck,

greg k-h


\
 
 \ /
  Last update: 2012-04-20 17:39    [W:0.079 / U:0.520 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site