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 wrote: > On 20 April 2011 18:34, Johan Tibell wrote: >> On Wed, Apr 20, 2011 at 6:11 PM, Bas van Dijk wrote: >>> I still need to add appropriate conditions for checking whether the >>> program is using the threaded RTS. What is the recommended approach >>> fo

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 wrote: > On Wed, Apr 20, 2011 at 6:11 PM, Bas van Dijk 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 chec

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 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 "rtsSupportsBound

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 wrote: > On Wed, Apr 20, 2011 at 5:22 PM, Bas van Dijk wrote: >> On 20 April 2011 17:04, Johan Tibell wrote: >>> Not that evtRead and evtWrite maps to different things on different >>> platforms. >> >> Do you mean "Not" or "Note"? > > Yes, sorry. Ok thanks.

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 wrote: > On 20 April 2011 17:04, Johan Tibell wrote: >> Not that evtRead and evtWrite maps to different things on different >> platforms. > > Do you mean "Not" or "Note"? Yes, sorry. ___ Haskell-Cafe mail

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 wrote: > On Tue, Apr 19, 2011 at 10:36 PM, Bas van Dijk wrote: >> On 19 April 2011 15:06, John Obbele wrote: >>        -- Step 3 is the most important step. Submitting the transfer: >>        handleUSBException $ c'libusb_submit_transfer transPtr >> >>      

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 wrote: > On 19 April 2011 15:06, John Obbele wrote: >        -- Step 3 is the most important step. Submitting the transfer: >        handleUSBException $ c'libusb_submit_transfer transPtr > >        -- TODO: Now we need to do the complicated stuff de

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 wrote: > I haven't implemented asynchronous transfers yet that actually > transfer user data... And now I have: asynchronously implemented readControl and writeControl: https://github.com/basvandijk/usb/blob/async/System/USB/Internal.hs#L1360 Next up are rea

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 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 work I have beg

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-19 Thread Bas van Dijk
On 19 April 2011 15:06, John Obbele 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). Great! I have wished

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 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? >> >> http://hackage.h

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? > > http://hackage.haskell.org/packages/archive/base/latest/doc/html/Control-Co

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 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 project. > > I'm tryi

[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 th