[Haskell-cafe] USB Drivers in Haskell

Jason Dagit dagit at eecs.oregonstate.edu
Fri Aug 25 13:33:25 EDT 2006

On 8/25/06, Bjorn Bringert <bringert at cs.chalmers.se> wrote:
> On 25 aug 2006, at 05.02, Jason Dagit wrote:
> > Hello,
> >
> > I recently became the owner a USB gadget that tracks movement via GPS
> > and also tracks heart rate (it's a training device for athletes).
> > This device comes with software that is windows only and...doesn't
> > like up to it's potential (to put it politely).  Being a programmer
> > type and someone that prefers to use either linux or osx I quickly
> > realized I should write my own software to use the gadget.
> > Fortunately, the company that makes the device provides documentation
> > to write drivers for the device (including a minimal example USB
> > driver for win32).
> >
> > So then I looked around the net for a few open source things, such as
> > open source drivers for the device or a Haskell library to help me
> > start writing drivers for the gadget.  I didn't see anything relevant
> > after a few minutes of searching so I figure that means there isn't
> > much.
> >
> > Did I miss a Haskell library for writing device drivers, specifically
> > USB drivers?  Would this be hard to write?  I would prefer to support
> > osx and linux at a minimum and I think it would be ideal to shoot for
> > cross platform (win32, osx, linux and *bsd).  I have this feeling that
> > it could be done by writing platform specific wrappers using hsc2hs on
> > each platform then bringing them together through a unified 'low'
> > level Haskell api.  The Haskell api would then be exposed as a module
> > for application developers.
> >
> > Any thoughts?
> >
> > For the interested, the documentation I spoke of can be found here:
> > http://www.garmin.com/support/commProtocol.html
> For cross-platform USB drivers, you may want to have a look at libusb
> [1]. I have only used it under Linux, but it seems to support Linux,
> *BSD and OS X. There also seems to be a win32 port [2]. A Haskell
> binding to libusb would be very welcome.

This is interesting, although it looks a bit under developed and
forgotten about at the moment.  A few things worry me about it, like
lack of async IO support, but overall it's probably a nice starting
point.  If nothing else I doubt it would be difficult to get a small
wrapper library up and running based on it.

Thanks for the pointer.

More information about the Haskell-Cafe mailing list