> Would mind trying to confirm it? I will check the docs, but if you can > reproduce it (either with legacy libusb or with libusb-compat) is > better.
I've tested with both pyusb 0.4.2-2 (as packaged with ubuntu 10.04 package), as well as latest pyusb cloned github using libusb01 back-end. I can confirm the issue does exist in libusb-0.1 too, but I don't think the issue can be fixed in libusb01 backend? usb_bulk_read returns number of bytes read on success or < 0 on error. There's no mechanism in API to both communicate a timeout and data. Do you know if libusb-0.1 is supposed to be thread safe? I have not had success reproducing the error with only one thread. libusb-1.0 docs state that that version is thread safe. Thanks and Regards, On Wed, Feb 8, 2012 at 8:58 AM, Wander Lairson Costa <wander.lair...@gmail.com> wrote: > 2012/2/8 Braiden Kindt <brai...@braiden.org>: >> PyUSB raises timeout after reading non-zero amount of data from bulk endpoint >> >> libusb_bulk_transfer may return both a non-zero transferred size and >> also an errno indicating timeout. >> >> In such cases, pyusb raises an exception, and there's no way for my >> application to retrieved the data that was read from USB. As a result, >> the data is lost. Subsequent reads will not return it. >> >> See libusb-1.0 docs: >> http://libusb.sourceforge.net/api-1.0/group__syncio.html#gab8ae853ab492c22d707241dc26c8a805 >> ...check transferred when dealing with a timeout error code. libusb >> may have to split your transfer into a number of chunks to satisfy >> underlying O/S requirements, meaning that the timeout may expire after >> the first few chunks have completed. libusb is careful not to lose any >> data that may have been transferred; do not assume that timeout >> conditions indicate a complete lack of I/O. >> > > Thanks for the report. > >> You can pull my my patched version here: >> git://github.com/braiden/pyusb.git (up-to-date with your master >> branch) >> >> I've been using this for a couple weeks without issue. Patch is pretty >> trivial. in libusb10, don't call _check unless zero bytes transferred. >> I've only seen the issue while reading from device, but I assume it >> possible on write too. > > And thanks for the patch. I will apply it asap. > >> >> I think the issue applies to libusb01 too. >> > > Would mind trying to confirm it? I will check the docs, but if you can > reproduce it (either with legacy libusb or with libusb-compat) is > better. > >> I can pretty reliably reproduce issue. Let me know if I can provide >> more detail or help verify fix. >> > > After I apply the patch I might ask you to re-test. > > > -- > Best Regards, > Wander Lairson Costa > > ------------------------------------------------------------------------------ > Keep Your Developer Skills Current with LearnDevNow! > The most comprehensive online learning library for Microsoft developers > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, > Metro Style Apps, more. Free future releases when you subscribe now! > http://p.sf.net/sfu/learndevnow-d2d > _______________________________________________ > pyusb-users mailing list > pyusb-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/pyusb-users ------------------------------------------------------------------------------ Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d _______________________________________________ pyusb-users mailing list pyusb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyusb-users