[Haskell-cafe] ANN: usb-1.0, bindings-libusb-1.4.4 and usb-iteratee-0.4

Bas van Dijk v.dijk.bas at gmail.com
Sun Sep 18 20:25:57 CEST 2011


Fellow Haskellers,

I would like to announce the 1.0 release of the usb library! This
library lets you to communicate with USB devices from userspace. It is
implemented as a high-level wrapper around bindings-libusb[1] which is
a low-level binding to the portable C library: libusb-1.0 (
http://libusb.org ).

I think a 1.0 release is warranted since I have been successfully
using the library in an industrial application at Sensor Sense for
some time now. This release also adds the last piece of functionality
that was missing from previous releases: isochronous transfers. These
let you communicate with USB video or audio devices for example.

A second major change is that all I/O functions, while still having a
synchronous interface (they block), are now implemented
asynchronously. This makes them more efficient (no busy-loops) and
interruptible (just throw an asynchronous exception to the thread
executing a transfer and the transfer is automatically canceled). The
implementation uses the GHC event manager for event handling. If the
event manager is not available, because you're either: not using GHC,
building your program without -threaded or you're on Windows the
implementation degrades gracefully to the synchronous implementation.

Other changes:

* Added writeControlExact :: DeviceHandle -> ControlAction WriteExactAction.

* All I/O functions which previously returned the boolean TimedOut
  now return a: data Status = Completed | TimedOut.

* Added the timeout constant: noTimeout :: Timeout.

* Added function: maxIsoPacketSize :: EndpointDesc -> Size
  Which calculates the maximum packet size which a specific endpoint
  is capable of sending or receiving in the duration of 1 microframe.
  This function is mainly useful for setting up isochronous transfers.

* Added some specific IOExceptions:
  ioException :: USBException
  incompleteReadException :: USBException
  incompleteWriteException :: USBException

* Renamed System.USB.IO.Synchronous to just System.USB.IO.

* Renamed System.USB.Unsafe to System.USB.Internal and exported more
  functions from it which are primarily needed in the usb-iteratee
  package.

* Fixed some bugs.

* Switched from darcs to git and hosted the project on github:
  https://github.com/basvandijk/usb/

API Docs:
http://hackage.haskell.org/package/usb-1.0

Installing:
$ cabal update
$ cabal install usb

I would like to thank John Obbele for pushing me to write the
asynchronous implementation and for testing the library.

Also thanks to Joris Putcuyps for testing the library on Windows.
Unfortunately the library doesn't yet work on that platform due to a
weird segmentation fault:
http://hackage.haskell.org/trac/ghc/ticket/5254. Hopefully we will
solve it in the near future.


bindings-libusb
===============

The usb library is based on bindings-libusb which is a low-level
binding to the libusb C library. I recently took over maintenance of
this package from Maurício Antunes. Maurício, thanks for creating and
maintaining this package! It greatly simplified the task of writing
the high-level wrapper.

API Docs:
http://hackage.haskell.org/package/bindings-libusb-1.4.4


usb-iteratee
============

I also released a new library: usb-iteratee which provides iteratee
enumerators for the usb package. Note that this package was previously
called usb-enumerator. However I'm planning to rewrite the latter to
offer enumerators for the enumerator package instead.

API Docs:
http://hackage.haskell.org/package/usb-iteratee-0.4


Regards,

Bas



More information about the Haskell-Cafe mailing list