On Mon, Jan 21, 2013 at 1:03 AM, Zoltán Kovács <0x4...@gmail.com> wrote: > Hi, > > I use libusbx on Linux to communicate with a weather station. I use > libusb_interrupt_transfer call to get data from the device. Sometimes there > is a communication error with the device: > [372849.680990] [0000275b] libusbx: error [reap_for_handle] reap failed > error -1 errno=14 > [372849.681752] [0000275b] libusbx: error [handle_events] backend > handle_events failed with error -1 > [372850.680466] [0000275b] libusbx: warning [handle_timeout] async cancel > failed -5 errno=22 > > in this case the program does not return from libusb_interrupt_transfer, so > I cannot handle the error in my code. I made some debugging and I think > found a bug in do_sync_bulk_transfer function: the return value of > libusb_cancel_transfer not handled. If this function returns with error, the > while loop never ends. > My proposed fix: > pi@raspberrypi ~/homectrl/libusbx-1.0.14/libusb $ diff sync_old.c sync.c > 186,189c186,189 > < libusb_cancel_transfer(transfer); > < while (!completed) > < if (libusb_handle_events_completed(HANDLE_CTX(dev_handle), &completed) < > 0) > < break; > --- >> if(libusb_cancel_transfer(transfer) == 0) >> while (!completed) >> if (libusb_handle_events_completed(HANDLE_CTX(dev_handle), &completed) < >> 0) >> break; > > the same problem exists in the libusb_control_transfer function, too. I > tested this and seems this solves the problem. > If you agree, please correct the code according to this.
Seems to make sense to me. -- Xiaofan ------------------------------------------------------------------------------ Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnnow-d2d _______________________________________________ libusbx-devel mailing list libusbx-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libusbx-devel