Hi,
I'm using every 60 seconds 2 times the method usb.core.find(). After maybe
10-15 calls I get the error
"[Errno 19] No such device (it may have been disconnected)"
I don't no why, but in an older version of my project, pyUSB didn't even care
when I called this function every second! I didn't even change the version of
pyUSB or libusbx!
I'have attached a code snippet of 30 lines.
Maybe someone could look over it?
Best regards
Stefano
def watch_devices_on_hub(self):
# ...
while self._run:
try:
pid_vid_names = get_devices_connected_to_usb_hub(usb_hub_vid, usb_hub_pid)
except usb.core.USBError, e:
self.write_to_log(e, tag='error')
continue
# ...
self._wait_max_seconds(60)
def get_devices_connected_to_usb_hub(usb_hub_vid, usb_hub_pid):
deviceDict = dict()
usb_hub = usb.core.find(idVendor=usb_hub_vid, idProduct=usb_hub_pid)
if usb_hub is None:
raise usb.core.USBError('USB Hub not found')
devices = usb.core.find(find_all=True, bDescriptorType=usb.DT_DEVICE, bus=usb_hub.bus)
if devices is None:
return deviceDict
for device in devices:
if device.port_number != 0 and device.port_number != usb_hub.port_number:
deviceDict[device.port_number] = DeviceInfo(device)
return deviceDict
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_nov
_______________________________________________
pyusb-users mailing list
pyusb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users