evdev: Bindings to libevdev

[ bsd3, library, system ] [ Propose Tags ]

Provides access to the Linux event device interface, with an optional high-level Streamly-based API.

[Skip to Readme]


Maintainer's Corner

For package maintainers and hackage trustees


Versions [RSS],,,,,,,,,,,, 2.1.0 (info)
Change log CHANGELOG.md
Dependencies base (>=4.11 && <4.14), bytestring (>=0.10 && <0.11), containers (>=0.6.2 && <0.7), either (>=5.0.1 && <5.1), extra (>=1.6.18 && <1.7), hinotify (>=0.4 && <0.5), monad-loops (>=0.4.3 && <0.5), paths (>=0.2 && <0.3), posix-paths (>=0.2.1 && <0.3), process (>=1.6.5 && <1.7), rawfilepath (>=0.2.4 && <0.3), safe (>=0.3.18 && <0.4), streamly (>=0.6.1 && <0.8), streamly-fsnotify (>=1.0 && <1.1), time (>=1.9.3 && <1.10), unix (>=2.7.2 && <2.8) [details]
License BSD-3-Clause
Author George Thomas
Maintainer George Thomas
Category System
Home page https://github.com/georgefst/evdev
Source repo head: git clone git://github.com/georgefst/evdev.git
Uploaded by GeorgeThomas at 2020-02-10T23:40:55Z
Distributions NixOS:2.1.0
Downloads 2641 total (33 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for evdev-

[back to package description]

Haskell evdev library


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.


  • 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.

Still to come

Haddock documentation for the non-stream interface. I intend to redesign the interface in some minor ways first. Until then, everything maps quite directly to the C library, while taking care of the nitty-gritty low-level stuff.

There are many more methods in the C library that I'd like to expose. So far the emphasis has very much been on squeezing out the functionality I personally needed.

Some of the streaming functions print exceptions straight to stderr. Again, this was convenient at the time, but it would be cleaner to allow specifying a Writer, or passing callbacks.