Note that there are some explanatory texts on larger screens.

plurals
  1. POSimple way to query connected USB devices info in Python?
    primarykey
    data
    text
    <p>How can we query connected USB devices info in Python? I want to get UID Device Name (ex: SonyEricsson W660), path to device (ex: /dev/ttyACM0)</p> <p>And also what would be the best Parameter out of above info to be used as identifying the device whenever it's connected again? (UID?)</p> <p>I am working on Ubuntu 11.04.</p> <p>ATM I have this code (using pyUSB)</p> <pre><code>busses = usb.busses() for bus in busses: devices = bus.devices for dev in devices: print repr(dev) print "Device:", dev.filename print " idVendor: %d (0x%04x)" % (dev.idVendor, dev.idVendor) print " idProduct: %d (0x%04x)" % (dev.idProduct, dev.idProduct) print "Manufacturer:", dev.iManufacturer print "Serial:", dev.iSerialNumber print "Product:", dev.iProduct </code></pre> <p>The problem is I don't get desired output, will paste one example:</p> <pre><code>&lt;usb.legacy.Device object at 0x1653990&gt; Device: idVendor: 4046 (0x0fce) idProduct: 53411 (0xd0a3) Manufacturer: 1 Serial: 3 Product: 2 </code></pre> <p>First I don't get filename, it's most important to me. I am assuming it is the /dev/ttyACM0 etc part. Second, I guess there was some UID of every USB device, or I should use both Vendor or Product id?</p> <p><strong>EDIT: Apparently I have some setup issues, I think I am using wrong USB Library. (using libusb0.1) ATM. That's why I get Device (dev.filename) string empty. If someone can please just tell that on what operating system he is using what USB Library and what version of PyUSB I think it will solve my problems.</strong></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload