evdev-2.3.1.1: Bindings to libevdev
Safe HaskellSafe-Inferred
LanguageGHC2021

Evdev

Description

The main module for working with devices and events.

Synopsis

Devices

data Device Source #

An input device.

Instances

Instances details
Show Device Source # 
Instance details

Defined in Evdev

newDevice :: RawFilePath -> IO Device Source #

Create a device from a valid path - usually /dev/input/eventX for some numeric X. Use newDeviceFromFd if you need more control over how the device is created.

nextEvent :: Device -> IO Event Source #

Get the next event from the device.

evdevDir :: RawFilePath Source #

The usual directory containing devices ("/dev/input").

Properties

data AbsInfo Source #

Instances

Instances details
Show AbsInfo Source # 
Instance details

Defined in Evdev.LowLevel

Grabbing

grabDevice :: Device -> IO () Source #

Prevent other clients (including kernel-internal ones) from receiving events. Often a bad idea.

ungrabDevice :: Device -> IO () Source #

Release a grabbed device.

Events

data Event Source #

An input event, including the timestamp.

Constructors

Event 

Instances

Instances details
Read Event Source # 
Instance details

Defined in Evdev

Show Event Source # 
Instance details

Defined in Evdev

Methods

showsPrec :: Int -> Event -> ShowS #

show :: Event -> String #

showList :: [Event] -> ShowS #

Eq Event Source # 
Instance details

Defined in Evdev

Methods

(==) :: Event -> Event -> Bool #

(/=) :: Event -> Event -> Bool #

Ord Event Source # 
Instance details

Defined in Evdev

Methods

compare :: Event -> Event -> Ordering #

(<) :: Event -> Event -> Bool #

(<=) :: Event -> Event -> Bool #

(>) :: Event -> Event -> Bool #

(>=) :: Event -> Event -> Bool #

max :: Event -> Event -> Event #

min :: Event -> Event -> Event #

data EventData Source #

An input event, without the timestamp. Each constructor corresponds to one event type, except for UnknownEvent.

Instances

Instances details
Read EventData Source # 
Instance details

Defined in Evdev

Show EventData Source # 
Instance details

Defined in Evdev

Eq EventData Source # 
Instance details

Defined in Evdev

Ord EventData Source # 
Instance details

Defined in Evdev

data KeyEvent Source #

The status of a key.

Constructors

Released 
Pressed 
Repeated 

Instances

Instances details
Bounded KeyEvent Source # 
Instance details

Defined in Evdev

Enum KeyEvent Source # 
Instance details

Defined in Evdev

Read KeyEvent Source # 
Instance details

Defined in Evdev

Show KeyEvent Source # 
Instance details

Defined in Evdev

Eq KeyEvent Source # 
Instance details

Defined in Evdev

Ord KeyEvent Source # 
Instance details

Defined in Evdev

newtype EventCode Source #

A direct representation of the code field of the C input_event, for when there is no obvious meaningful sum type.

Constructors

EventCode Word16 

newtype EventValue Source #

A direct representation of the value field of the C input_event, for when there is no obvious meaningful sum type.

Constructors

EventValue Int32 

Lower-level

newDeviceFromFd :: Fd -> IO Device Source #

Generalisation of newDevice, in case one needs control over the file descriptor, e.g. in order to set a particular FileMode, OpenMode, or OpenFileFlags. Note that:

newDevice path = newDeviceFromFd =<< openFd path ReadOnly Nothing defaultFileFlags

WARNING: Don't attempt to reuse the Fd - it will be closed when the Device is garbage collected.

nextEventMay :: Device -> IO (Maybe Event) Source #

Get the next event from the device, if one is available. Designed for use with devices created from a non-blocking file descriptor. Otherwise equal to fmap Just . nextEvent.

data LEDValue Source #

LEDs values

Constructors

LedOn 
LedOff 

setDeviceLED :: Device -> LEDEvent -> LEDValue -> IO () Source #

Set the state of a LED on a device.

C-style types

These correspond more directly to C's input_event and timeval. They are used internally, but may be useful for advanced users.

data CEvent Source #

Instances

Instances details
Read CEvent Source # 
Instance details

Defined in Evdev.LowLevel

Show CEvent Source # 
Instance details

Defined in Evdev.LowLevel

Eq CEvent Source # 
Instance details

Defined in Evdev.LowLevel

Methods

(==) :: CEvent -> CEvent -> Bool #

(/=) :: CEvent -> CEvent -> Bool #

Ord CEvent Source # 
Instance details

Defined in Evdev.LowLevel

data CTimeVal Source #

Constructors

CTimeVal 

Fields

Instances

Instances details
Read CTimeVal Source # 
Instance details

Defined in Evdev.LowLevel

Show CTimeVal Source # 
Instance details

Defined in Evdev.LowLevel

Eq CTimeVal Source # 
Instance details

Defined in Evdev.LowLevel

Ord CTimeVal Source # 
Instance details

Defined in Evdev.LowLevel