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

List:       libusb-devel
Subject:    Re: [libusb] How to free transfer before closing libusb ?
From:       Tim Roberts <timr () probo ! com>
Date:       2019-01-04 17:29:17
Message-ID: 61e47ff6-82da-18e0-2cbd-2359863d8042 () probo ! com
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


M BIASUTTI Valentin via libusb-devel wrote:
>
> I am currently working on a 'usb-driver' in order to control a camera.
> I am using asynchronous tranfer with the isochronous mode.
> The opening goes well so as the communcation (fps steady, start/stop ok).
> I am using a thread to retrieve transfer from my usb device, this 
> thread is basicly calling libubs_handle_events({my_libusb_context}) in 
> a while loop.
>
> Here is my question : how to effectively free transfer allocated 
> considering that I already stopped video flux ? (stopping video flux, 
> stops libsub from calling callback)

That shouldn't be true with an isochronous pipe.   If you were using 
bulk, then your request won't be completed until you get data, but 
isochronous requests are all based on timing.   If you submit an 
isochronous read that spans 24 packets, then your request should be 
completed after 24 microframes whether you received any data or not.

Even so, there are many ways to solve this.   You can set a flag that 
says "we are stopping", then have your callback not resubmit the request 
when it sees that flag.   Once your outstanding requests clear, you can 
switch your alternate setting to stop the flow.

You can always set a timeout on your requests, but again that shouldn't 
be necessary with isochronous transfers.

-- 
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.



["smime.p7s" (application/pkcs7-signature)]



_______________________________________________
libusb-devel mailing list
libusb-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusb-devel


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

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