USB interface in Python

跟風遠走 提交于 2019-12-12 06:19:59

问题


I have this (http://www.gesytec.de/en/download/easylon/p/16/) USB device connected to my Win7. I am just trying to read the vendor ID and product ID. I have Python 2.7.

Here is the code,

import usb
busses = usb.busses()
for bus in busses:
    devices = bus.devices
    for dev in devices:
        print "Device:", dev.filename
        print "  idVendor: %d (0x%04x)" % (dev.idVendor, dev.idVendor)
        print "  idProduct: %d (0x%04x)" % (dev.idProduct, dev.idProduct)

I am getting following error,

"File "<stdin>", line 1, in <module>
File "C:\Python27\lib\usb\core.py", line 846, in find
raise ValueError('No backend available')
ValueError: No backend available"

What am I doing wrong here?


回答1:


Did you install the usb library package? If so you may need to add it to your path.




回答2:


I ended up using the dll provided by manufacture instead of USB lib.



来源:https://stackoverflow.com/questions/29174671/usb-interface-in-python

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!