Is usb port number fixed?
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!
Quoted 5 lines · Wang YanQing
Hi!
when I execute the command below:"ls
/sys/bus/usb/devices/"
Quoted 8 lines
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, the test result above will be the same.And if it will be the same, then why it will be the same.
Quoted 15 lines · Wang YanQing
Quoted 5 lines · Wang YanQing
Hi!
when I execute the command below:"ls
/sys/bus/usb/devices/"Quoted 8 lines
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!
Quoted 7 lines
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.0I want to know whether it is right that no matter how many times I reboot the machine,
Not always.
Quoted 1 line
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
A message that is not in the archive (sent off-list or not yet received): CAHkwNT=VW8qF-7QRxpiaWkmQm0UFdsbahFLhT-PCc4OMnVs1Gg@mail.gmail.com
<Please don't post HTML email, the mailing lists reject your messages that way>
Quoted 8 lines · Anil Nair
Quoted 4 lines
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.
Does every device assigned a port number serially, that is in increasing order?
Yes.
Quoted 3 lines
If a USB port number is assigned to a USB device then are other USB devices able to use it,
if connected USB device is Disconnected?
It can, why? USB devices don't care about their device number.
Quoted 9 lines
Quoted 5 lines
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.
Does the Linux Kernel keeps the history of connected devices? So that next time, the same USB device get assigned the same USB port number.
No. I think you are confusing port number with the USB device number, both of which mean nothing to a USB device at all, and they shouldn't to anyone else.
greg k-h
Quoted 14 lines · Greg KH
Quoted 7 lines
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.0I want to know whether it is right that no matter how many times I reboot the machine,
Not always.
Quoted 1 line
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 :)
Quoted 8 lines
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
Quoted 8 lines · Alan Stern
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.
Yes, configuration and interface come from the hardware,
but I don't know where the port come from, at least I don't think the port comes from the same hardware with the configuration and interface, do you mean port come from the hub?
Quoted 6 lines · Wang YanQing
Quoted 5 lines · Alan Stern
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.
Quoted 7 lines
Quoted 3 lines
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.
Yes, configuration and interface come from the hardware,
but I don't know where the port come from, at least I don't think the port comes from the same hardware with the configuration and interface, do you mean port come from the hub?
Yes, it does.
Alan Stern