@hackage evdev1.2.0.0

Bindings to libevdev

Haskell evdev library

http://hackage.haskell.org/package/evdev

This library provides access to the Linux evdev interface, for reading input events from devices. It uses c2hs-generated bindings to libevdev, which should be available on almost any modern Linux distro.

Modules

  • Evdev provides the basic functionality for initialising devices, reading events etc.
  • Evdev.Codes contains datatypes corresponding to the constants in input-event-codes.h, such as keys and device properties.
  • Evdev.Stream provides a higher-level Streamly-based interface, for obtaining a stream of events.

Why streamly?

Compared to other Haskell streaming libraries, I've found streamly to have a remarkably easy-to-use API, and the best, simplest support for concurrency. For example, merging concurrent streams of events, from different devices, is trivial.

If you wish to use this library alongside conduit, pipes etc. then see here for a guide on interoperation.

Getting started

Your user will need to be a member of the input group in order to read from devices. Try usermod -a -G input [username].

If you wish to make use of concurrency, e.g. to use functions like allEvents, be sure to pass the option -threaded to GHC, in order to enable the threaded runtime.

The evdev-examples folder contains a basic evtest clone, with the added ability to read events from multiple devices concurrently.

See Hackage for further documentation. Full descriptions for each function, datatype etc. will be uploaded in the very near future.