Hi,
I tested it under Linux, but there was no problem. But I tested it on an
another Computer with Python 2.7 instead of 2.5.
The other thing is, I can't reproduce this problem, with C.
I made a simple stress test with python:
This works:
for i in range(100):
usb.core.find(find_all=True)
This don't work!
for i in range(100):
device_list = usb.core.find(find_all=True)
Two lines of code (besides the import), nothing more...
The error message:
"usb.core.USBError: [Errno 19] No such device (it may have been disconnected)"
Where it happens:
class _DevIterator(object):
def __init__(self):
self.dev_list = POINTER(c_void_p)()
self.num_devs = _check(_lib.libusb_get_device_list(
None,
byref(self.dev_list))
).value # Here!
def _check(retval):
if isinstance(retval, int):
retval = c_int(retval)
if isinstance(retval, c_int):
if retval.value < 0:
from usb.core import USBError
ret = retval.value
raise USBError(_str_error[ret], ret, _libusb_errno[ret]) # Here the
Exception rises.
return retval
My simple C code:
for(i = 0; i < 100; i++) {
cnt = libusb_get_device_list(NULL, &devs);
if (cnt < 0)
return (int) cnt;
if (i < 99)
libusb_free_device_list(devs, 1);
}
The C code works fine!
Best regards
Stefano
-------- Original-Nachricht --------
> Datum: Fri, 9 Nov 2012 21:42:03 +0800
> Von: Xiaofan Chen <[email protected]>
> An: [email protected]
> Betreff: Re: [pyusb-users] Devices disconnects after several request
> On Fri, Nov 9, 2012 at 7:06 PM, Stefano Di Martino <[email protected]>
> wrote:
> > Well, my "solution" is nothing else than a deferment, that is,
> > the problem still exists. It takes longer to show up, but is shows up!
>
> If you can, test your pyusb code inside Linux to see if there
> are similar problems or not. If there is no problem under Linux,
> it could well be a libusbx problem under Windows. In that case,
> you may want to write a simple C based program using
> libusbx to confirm it is indeed that case. Then you can post
> the debug log to the libusbx mailing list to see if there are
> bug fixes for that.
>
> You can also just use libusbx's xusb against your device
> to see if that works or not.
>
>
>
> --
> Xiaofan
>
> ------------------------------------------------------------------------------
> 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
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/pyusb-users
------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyusb-users