Re: [linux-usb-devel] synchronous ops with urbs
Prageeth wrote: hi all, in my driver i need to provide synchronous read/write operations to the application. moreover, operation cancellation is also needed. -what is the most recommended way to wait for completion of an urb? Submit using usb_submit_urb(), then if you don't need operation cancellation, use linux/completion.h primitives to wait. If you need cancelation, linux/wait.h primitives are one option, like: - wait_event_interruptible() - wait_event_interruptible_timeout() Yes, there's no wait_event_timeout() without the option of breaking out on interrupts; sigh. But it seems like you don't need that option. When those primitives complete early, then call usb_unlink_urb() and then use wait_event() to catch the canceled URB. (Even if you gave up just a smidgeon too early, and it already completed...) You can use a struct completion with these, and have the urb completion handler calling complete(). There's another wait/synchronize primitive that I found at one point, I think the block layer used it, which involved a bit less inlined code and didn't necessarily require everything to be interruptible. I lost track of it though. -i was planning to use a modified version of usb_start_wait_urb() used inside usb_bulk_msg() is any better methods possible? Absolutely. That code needs to be replaced, it's not even correct in certain cases. - Dave --- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa0013ave/direct;at.aspnet_072303_01/01 ___ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
Re: [linux-usb-devel] synchronous ops with urbs
David Brownell wrote: There's another wait/synchronize primitive that I found at one point, I think the block layer used it, which involved a bit less inlined code and didn't necessarily require everything to be interruptible. I lost track of it though. Found it again, also in linux/wait.h: prepare_to_wait(..., TASK_{UN,}INTERRUPTIBLE); ... do stuff finish_wait(...); The stuff can include schedule_timeout() and so on. - Dave --- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa0013ave/direct;at.aspnet_072303_01/01 ___ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
[linux-usb-devel] synchronous ops with urbs
hi all, in my driver i need to provide synchronous read/write operations to the application. moreover, operation cancellation is also needed. -what is the most recommended way to wait for completion of an urb? -i was planning to use a modified version of usb_start_wait_urb() used inside usb_bulk_msg() is any better methods possible? rgds, prageeth __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com --- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa0013ave/direct;at.aspnet_072303_01/01 ___ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
Re: [linux-usb-devel] synchronous ops with urbs
hi, thanks for all the replies. -i call wait_for_completion() from my read/write entry points -in URB's completion handler, call complete() -when cancellation needed, call usb_unlink_urb() -the URB's completion handler gets called with err code on cancellation -thus, cancellation also uses the same strategy hope this will work fine.. thanks, prageeth --- Oliver Neukum [EMAIL PROTECTED] wrote: Am Freitag, 8. August 2003 10:37 schrieb Prageeth: hi all, in my driver i need to provide synchronous read/write operations to the application. moreover, operation cancellation is also needed. -what is the most recommended way to wait for completion of an urb? Use a struct completion and call complete() on it from inside your URB's completion handler. -i was planning to use a modified version of usb_start_wait_urb() used inside usb_bulk_msg() That's old and crufty code written before modern waiting primitives were available. Please don't copy it. HTH Oliver __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com --- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa0013ave/direct;at.aspnet_072303_01/01 ___ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
Re: [linux-usb-devel] synchronous ops with urbs
Am Freitag, 8. August 2003 10:37 schrieb Prageeth: hi all, in my driver i need to provide synchronous read/write operations to the application. moreover, operation cancellation is also needed. -what is the most recommended way to wait for completion of an urb? Use a struct completion and call complete() on it from inside your URB's completion handler. -i was planning to use a modified version of usb_start_wait_urb() used inside usb_bulk_msg() That's old and crufty code written before modern waiting primitives were available. Please don't copy it. HTH Oliver --- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa0013ave/direct;at.aspnet_072303_01/01 ___ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel