Re: [RFC]Is usb port number fixed?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux