[PATCH] Allow to interrupt ftdi_transfer_data_done() by signals

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH] Allow to interrupt ftdi_transfer_data_done() by signals

Michał Semeniuk
Hello,

I would like to propose a patch which allow to not block signals
during execution of ftdi_transfer_data_done() function.
If we would like to have possibility to interrupt the
ftdi_transfer_data_done by signals we should use call the new function
ftdi_transfer_set_sigblock() before calling ftdi_transfer_data_done(),
example workflow:

ctrl = ftdi_write_data_submit() / ftdi_read_data_submit()
ftdi_transfer_set_sigblock(ctrl, 0);
ftdi_transfer_data_done(ctrl); // now signals can interrupt
ftdi_transfer_data_done()

If we don't call ftdi_transfer_set_sigblock() we will have the old
behaviour: the ftdi_transfer_data_done() will not be interrupted by
signals:

ctrl = ftdi_write_data_submit() / ftdi_read_data_submit()
ftdi_transfer_data_done(ctrl); // old behaviour:
ftdi_transfer_data_done() blocks signals

Best Regards
Michal Semeniuk


--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]  

allow_signals_in_ftdi_transfer_data_done.patch (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH] Allow to interrupt ftdi_transfer_data_done() by signals

Thomas Jarosch
Hello Michal,

On Friday, 15. July 2016 14:23:03 Michał Semeniuk wrote:

> I would like to propose a patch which allow to not block signals
> during execution of ftdi_transfer_data_done() function.
> If we would like to have possibility to interrupt the
> ftdi_transfer_data_done by signals we should use call the new function
> ftdi_transfer_set_sigblock() before calling ftdi_transfer_data_done(),
> example workflow:
>
> ctrl = ftdi_write_data_submit() / ftdi_read_data_submit()
> ftdi_transfer_set_sigblock(ctrl, 0);
> ftdi_transfer_data_done(ctrl); // now signals can interrupt
> ftdi_transfer_data_done()
>
> If we don't call ftdi_transfer_set_sigblock() we will have the old
> behaviour: the ftdi_transfer_data_done() will not be interrupted by
> signals:

your patch looks good.

One question though: What happens to the tc once a signal triggered?
As far as I can tell, libusb_cancel_transfer(tc->transfer) is called.

-> How do you "recover" / handle the signal?

Cheers,
Thomas


--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]

Loading...