From: Nicolas P. <nic...@aa...> - 2016-05-13 15:35:41
|
Le 13/05/2016 à 16:39, Nicolas Pinault a écrit : > Le 13/05/2016 à 15:10, Jeffrey Nichols a écrit : >> On 5/13/2016 9:03 AM, Nicolas Pinault wrote: >>> Le 12/05/2016 à 17:15, Wander Lairson Costa a écrit : >>>> 2016-05-12 11:40 GMT-03:00 Nicolas Pinault<nic...@aa...>: >>>>> Hi, >>>>> >>>>> Is it possible to retrieve USB bus topology with PyUSB ? >>>>> >>>> Yes, you will need to use the Device object "port_number" and "bus" properties. >>> While it is enough for my application, I don't see how to >>> reconstruct the USB tree with just "port_number". >> There's also "port_numbers", assuming you're using a somewhat recent >> libusb-1.0 version as your backend. Combine that with the bus >> attribute, and you can get a representation of the physical >> attachment point of the device. > I already tried to use "port_numbers" but this field was always blank. > After updating libusb-1.0, this field is not blank anymore. > > What I don't understand is that bus/port_number numbers are not unique. > On my system : > IdVendor8086 IdProduct=1E26 bus=1 Address=1 port=0 > IdVendor8086 IdProduct=1E2D bus=2 Address=1 port=0 > * IdVendor0204 IdProduct=6025 bus=1 Address=6 port=1 ports = (1, 6, 1) > IdVendor0424 IdProduct=2513 bus=1 Address=2 port=6 ports = (1, 6) > + IdVendor046D IdProduct=C061 bus=2 Address=5 port=1 ports = (1, 1) > IdVendor0529 IdProduct=0001 bus=1 Address=4 port=5 ports = (1, 5) > IdVendor2CFF IdProduct=0002 bus=1 Address=5 port=2 ports = (1, 6, 2) > IdVendor413C IdProduct=2107 bus=2 Address=2 port=2 ports = (1, 2) > + IdVendor8087 IdProduct=0024 bus=2 Address=4 port=1 ports = (1,) > * IdVendor8087 IdProduct=0024 bus=1 Address=3 port=1 ports = (1,) > IdVendor8564 IdProduct=4000 bus=3 Address=20 port=8 ports = (8,) > IdVendor8086 IdProduct=1E31 bus=3 Address=1 port=0 > > The lines marked with a + or a * contains same bus/port_number numbers. > Only port_numbers field is different. > What does this mean ? > After sorting results and analysing further, I understand the whole picture. port_numbers like (1,) references a hub port_numbers like (1, 6, 2) indicate the full path to reach the device (root/hub/device) port_number references the port number of the last hub the device is connected on.. Nicolas |