Hi,
I'm trying to improve the times in a code. In the 99% of the times, when
youdoes the "discover" process (to check if your device is connected) you make:
list = []for bus in usb.busses(): for dev in bus.devices: if
dev.idVendor == SOME_VENDOR and dev.idProduct == SOME_PRODUCT:
list.append(dev)return list
But this function takes a lot of time! The "bus.devices" is:
self.devices = [Device(d) for d in core.find(find_all=True)]
I change my function to more elegant:
list = usb.core.find(find_all=True, idVendor=SOME_VENDOR,
idProduct=SOME_PRODUCT):
This is more efficient, but I have one problem: why this function returns
"devices" without the"interface"??
If I try to get the same that in the first function, have to do:
list = usb.core.find(find_all=True, idVendor=SOME_VENDOR,
idProduct=SOME_PRODUCT):d = []for dev in list: d.append(Device(dev))return d
Why no have a function that makes it?
Regards!
Alan
------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
pyusb-users mailing list
pyusb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users