[prev in list] [next in list] [prev in thread] [next in thread] 

List:       libftdi
Subject:    Re: Suggested patch for adding ftdi_transfer_data_cancel
From:       "Eugene Hutorny" <eugene () hutorny ! in ! ua>
Date:       2016-03-28 14:22:39
Message-ID: AC5D0ADF4ADA4A0E8B18B406871D88E0 () Sonata
[Download RAW message or body]

Hi Thomas,

In the existing code tc->completed is used as boolean.
Definitely it is not an error. Perhaps it would make sense to use 
TRUE/FALSE,
but I am not sure if it worth refactoring.

Best Regards

Eugene


-----Original Message----- 
From: Thomas Jarosch
Sent: Saturday, March 26, 2016 14:09
To: libftdi@developer.intra2net.com ; eugene@hutorny.in.ua
Subject: Re: Suggested patch for adding ftdi_transfer_data_cancel

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@developer.intra2net.com   

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic