device identification

Tim Roberts timr at
Tue Mar 23 05:22:28 CET 2010

Omer Ihsan <omrihsan at> wrote:
>i have installed pyusb now and run the sample have 3
>usb ports on my PC but the results show 6 outputs to
>dev.filename..they are numbers like 001 or 005 etc.... and they
>changed when i plugged in devices...(i am no good with the usb
>standards)....i just want to identify each device/port... what
>parameter in the example would help me....

You can't identify the ports.[1]  What good would it do you?  The ports on
your PC are not numbered.

You certainly CAN identify the devices, by their VID and PID (or idVendor
and idProduct).  You identify by function, not by location.  When you plug
in a USB drive, you don't want to worry about where it's plugged in.
[1]: OK, technically, it is not impossible to identify the port numbers,
but it is quite tedious.  You need to chase through the sysfs expansion of
your buses hub/port tree and find a match for your device.  It's not worth
the trouble.
Tim Roberts, timr at
Providenza & Boekelheide, Inc.

More information about the Python-list mailing list