Re: [Haskell-cafe] Need comments on a libusb asynchronous select/poll loop

2011-04-20 Thread John Obbele
On Tue, Apr 19, 2011 at 10:36:50PM +0200, Bas van Dijk wrote: Great! I have wished for an asynchronous implementation since version 0.1 of usb but didn't really had a need for it nor the time to implement it. However recently at work I have begun using my usb library in an application which

Re: [Haskell-cafe] Need comments on a libusb asynchronous select/poll loop

2011-04-20 Thread Bas van Dijk
On 20 April 2011 12:16, John Obbele john.obb...@gmail.com wrote: On Tue, Apr 19, 2011 at 10:36:50PM +0200, Bas van Dijk wrote: Great! I have wished for an asynchronous implementation since version 0.1 of usb but didn't really had a need for it nor the time to implement it. However recently at

Re: [Haskell-cafe] Need comments on a libusb asynchronous select/poll loop

2011-04-20 Thread Bas van Dijk
On 20 April 2011 14:10, Bas van Dijk v.dijk@gmail.com wrote: I haven't implemented asynchronous transfers yet that actually transfer user data... And now I have: asynchronously implemented readControl and writeControl:

Re: [Haskell-cafe] Need comments on a libusb asynchronous select/poll loop

2011-04-20 Thread Johan Tibell
On Tue, Apr 19, 2011 at 10:36 PM, Bas van Dijk v.dijk@gmail.com wrote: On 19 April 2011 15:06, John Obbele john.obb...@gmail.com wrote:        -- Step 3 is the most important step. Submitting the transfer:        handleUSBException $ c'libusb_submit_transfer transPtr        -- TODO: Now

Re: [Haskell-cafe] Need comments on a libusb asynchronous select/poll loop

2011-04-20 Thread Bas van Dijk
On 20 April 2011 17:04, Johan Tibell johan.tib...@gmail.com wrote: On Tue, Apr 19, 2011 at 10:36 PM, Bas van Dijk v.dijk@gmail.com wrote: On 19 April 2011 15:06, John Obbele john.obb...@gmail.com wrote:        -- Step 3 is the most important step. Submitting the transfer:        

Re: [Haskell-cafe] Need comments on a libusb asynchronous select/poll loop

2011-04-20 Thread Johan Tibell
On Wed, Apr 20, 2011 at 5:22 PM, Bas van Dijk v.dijk@gmail.com wrote: On 20 April 2011 17:04, Johan Tibell johan.tib...@gmail.com wrote: Not that evtRead and evtWrite maps to different things on different platforms. Do you mean Not or Note? Yes, sorry.

Re: [Haskell-cafe] Need comments on a libusb asynchronous select/poll loop

2011-04-20 Thread Bas van Dijk
On 20 April 2011 17:55, Johan Tibell johan.tib...@gmail.com wrote: On Wed, Apr 20, 2011 at 5:22 PM, Bas van Dijk v.dijk@gmail.com wrote: On 20 April 2011 17:04, Johan Tibell johan.tib...@gmail.com wrote: Not that evtRead and evtWrite maps to different things on different platforms. Do

Re: [Haskell-cafe] Need comments on a libusb asynchronous select/poll loop

2011-04-20 Thread Johan Tibell
On Wed, Apr 20, 2011 at 6:11 PM, Bas van Dijk v.dijk@gmail.com wrote: I still need to add appropriate conditions for checking whether the program is using the threaded RTS. What is the recommended approach for this? I see GHC.Conc.IO uses a dynamic check: foreign import ccall unsafe

Re: [Haskell-cafe] Need comments on a libusb asynchronous select/poll loop

2011-04-20 Thread Bas van Dijk
On 20 April 2011 18:34, Johan Tibell johan.tib...@gmail.com wrote: On Wed, Apr 20, 2011 at 6:11 PM, Bas van Dijk v.dijk@gmail.com wrote: I still need to add appropriate conditions for checking whether the program is using the threaded RTS. What is the recommended approach for this? I see

Re: [Haskell-cafe] Need comments on a libusb asynchronous select/poll loop

2011-04-20 Thread Bas van Dijk
On 20 April 2011 20:27, Bas van Dijk v.dijk@gmail.com wrote: On 20 April 2011 18:34, Johan Tibell johan.tib...@gmail.com wrote: On Wed, Apr 20, 2011 at 6:11 PM, Bas van Dijk v.dijk@gmail.com wrote: I still need to add appropriate conditions for checking whether the program is using the

[Haskell-cafe] Need comments on a libusb asynchronous select/poll loop

2011-04-19 Thread John Obbele
I was reading the recent thread about select/poll, events handling and why forkIO is the only thing you should need (sorry if this is a horrible summary ;) and I'm realizing I could use some advice concerning my last project. I'm trying to implement an asynchronous interface to libusb, re-using

Re: [Haskell-cafe] Need comments on a libusb asynchronous select/poll loop

2011-04-19 Thread Antoine Latter
On Tue, Apr 19, 2011 at 8:06 AM, John Obbele john.obb...@gmail.com wrote: I was reading the recent thread about select/poll, events handling and why forkIO is the only thing you should need (sorry if this is a horrible summary ;) and I'm realizing I could use some advice concerning my last

Re: [Haskell-cafe] Need comments on a libusb asynchronous select/poll loop

2011-04-19 Thread John Obbele
On Tue, Apr 19, 2011 at 08:52:44AM -0500, Antoine Latter wrote: Maybe I'm misunderstanding something, but why why I want to use epoll directly instead of just using forkIO plus threadWaitRead and threadWaitWrite?

Re: [Haskell-cafe] Need comments on a libusb asynchronous select/poll loop

2011-04-19 Thread Antoine Latter
On Tue, Apr 19, 2011 at 9:35 AM, John Obbele john.obb...@gmail.com wrote: On Tue, Apr 19, 2011 at 08:52:44AM -0500, Antoine Latter wrote: Maybe I'm misunderstanding something, but why why I want to use epoll directly instead of just using forkIO plus threadWaitRead and threadWaitWrite?

Re: [Haskell-cafe] Need comments on a libusb asynchronous select/poll loop

2011-04-19 Thread Bas van Dijk
On 19 April 2011 15:06, John Obbele john.obb...@gmail.com wrote: I'm trying to implement an asynchronous interface to libusb, re-using the raw bindings-usb (by Maurício C. Antunes) and partially copying what can be found in the (great but synchronous-only) usb package (from Bas van Dijk).