我的代码是获取有关插入 USB 端口的设备的所有详细信息。但是,当我运行该程序时,我收到以下错误:
ImportError: No module named backend.libusb10
有人可以解释一下吗?我检查了我的站点包文件夹并且我有后端。提前致谢 :)
这是我的代码
import usb.core
import usb.util
import usb
# find our device
dev = usb.core.find(find_all=True)
busses = usb.busses()
# was it found?
if dev is None:
raise ValueError('Device not found')
for bus in busses:
devices = bus.devices
for dev in devices:
try:
_name = usb.util.get_string(dev.dev, 19, 1)
except:
continue
dev.set_configuration()
cfg = dev.get_active_configuration()
interface_number = cfg[(0,0)].bInterfaceNumber
alternate_settting = usb.control.get_interface(interface_number)
print "Device name:",_name
print "Device:", dev.filename
print " idVendor:",hex(dev.idVendor)
print " idProduct:",hex(dev.idProduct)
for config in dev.configurations:
print " Configuration:", config.value
print " Total length:", config.totalLength
print " selfPowered:", config.selfPowered
print " remoteWakeup:", config.remoteWakeup
print " maxPower:", config.maxPower
print