libftdi Archives

Subject: Re: Suggested patch for adding ftdi_transfer_data_cancel

From: Thomas Jarosch <thomas.jarosch@xxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx, eugene@xxxxxxxxxxxxx
Date: Sat, 26 Mar 2016 13:09:52 +0100
Hi Eugene,

Am 25.01.2016 um 08:35 schrieb Eugene Hutorny:
> I have met a problem with a submitted read request – it never ends if
> there is no input data.
> When application calls ftdi_transfer_data_done it never returns.
> libusb logs indicate that the transfer completes with status word only
> and then unconditionally resubmitted.
> Exit from the app with no call to ftdi_transfer_data_done causes random
> crashes.
>  
> Suggested patch implements a cancelation routine and solves the problem
> I’ve described.

thanks for the patch, applied! I've massaged the code indentation a bit,
since libftdi uses spaces for indentation instead of tabs.

While reviewing your changes, I wonder if
the existing libftdi code does the wrong thing:

+            if (ret < 0)
+                tc->completed = 1;



shouldn't that rather read:

if (ret <0)
    tc->completed = LIBUSB_TRANSFER_ERROR;

instead of hardcoding the enum value directly?

Cheers,
Thomas


--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Current Thread