evdev-streamly-0.0.2.0: Bridge for working with evdev and streamly
Safe HaskellSafe-Inferred
LanguageHaskell2010

Evdev.Stream

Description

Functions for working with streams of input events. Unless stated otherwise, these functions will throw exceptions if the underlying C calls fail.

Synopsis

Documentation

allDevices :: (IsStream t, Monad (t IO)) => t IO Device Source #

All valid existing devices (in /dev/input). If a device can't be initialised for an individual path, then the exception is printed, and the function continues to try to initialise the others.

allEvents :: IsStream t => t IO (Device, Event) Source #

All events on all valid devices (in /dev/input). Prints any exceptions.

allEvents == readEventsMany allDevices

makeDevices :: IsStream t => t IO RawFilePath -> t IO Device Source #

Create devices for all paths in the stream.

newDevices :: (IsStream t, Monad (t IO)) => t IO Device Source #

All new devices created (in /dev/input). Watches for new file paths (using inotify), and those corresponding to valid devices are added to the stream.

newDevices' :: (IsStream t, Monad (t IO)) => Int -> t IO Device Source #

This is a workaround for bugginess in newDevices when it comes to waiting for permissions on a new device - it just waits the number of microseconds given before trying to read from the device.

readEvents :: Device -> SerialT IO Event Source #

Read all events from a device.

readEventsMany :: IsStream t => AsyncT IO Device -> t IO (Device, Event) Source #

Concurrently read events from multiple devices. If a read fails on one, the exception is printed to stderr and the stream continues to read from the others.