Safe Haskell | None |
---|---|
Language | Haskell2010 |
The main module for working with devices and events.
Synopsis
- data Device
- newDevice :: RawFilePath -> IO Device
- nextEvent :: Device -> IO Event
- evdevDir :: RawFilePath
- deviceName :: Device -> IO ByteString
- devicePath :: Device -> RawFilePath
- deviceProperties :: Device -> IO [DeviceProperty]
- deviceFd :: Device -> IO Fd
- grabDevice :: Device -> IO ()
- ungrabDevice :: Device -> IO ()
- data Event = Event {}
- data EventData
- = SyncEvent SyncEvent
- | KeyEvent Key KeyEvent
- | RelativeEvent RelativeAxis EventValue
- | AbsoluteEvent AbsoluteAxis EventValue
- | MiscEvent MiscEvent EventValue
- | SwitchEvent SwitchEvent EventValue
- | LEDEvent LEDEvent EventValue
- | SoundEvent SoundEvent EventValue
- | RepeatEvent RepeatEvent EventValue
- | ForceFeedbackEvent EventCode EventValue
- | PowerEvent EventCode EventValue
- | ForceFeedbackStatusEvent EventCode EventValue
- | UnknownEvent Word16 EventCode EventValue
- data KeyEvent
- newtype EventCode = EventCode Word16
- newtype EventValue = EventValue Int32
- data CEvent = CEvent {}
- toCEvent :: Event -> CEvent
- fromCEvent :: CEvent -> Event
- data CTimeVal = CTimeVal {}
- toCTimeVal :: DiffTime -> CTimeVal
- fromCTimeVal :: CTimeVal -> DiffTime
Devices
An input device.
newDevice :: RawFilePath -> IO Device Source #
Create a device from a valid path - usually /dev/input/eventX for some X.
evdevDir :: RawFilePath Source #
The usual directory containing devices ("/dev/input").
Properties
deviceName :: Device -> IO ByteString Source #
devicePath :: Device -> RawFilePath Source #
deviceProperties :: Device -> IO [DeviceProperty] Source #
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
An input event, including the timestamp.
An input event, without the timestamp.
Each constructor corresponds to one event type, except for UnknownEvent
.
SyncEvent SyncEvent | |
KeyEvent Key KeyEvent | |
RelativeEvent RelativeAxis EventValue | |
AbsoluteEvent AbsoluteAxis EventValue | |
MiscEvent MiscEvent EventValue | |
SwitchEvent SwitchEvent EventValue | |
LEDEvent LEDEvent EventValue | |
SoundEvent SoundEvent EventValue | |
RepeatEvent RepeatEvent EventValue | |
ForceFeedbackEvent EventCode EventValue | |
PowerEvent EventCode EventValue | |
ForceFeedbackStatusEvent EventCode EventValue | |
UnknownEvent Word16 EventCode EventValue | We include this primarily so that |
The status of a key.
Instances
Bounded KeyEvent Source # | |
Enum KeyEvent Source # | |
Eq KeyEvent Source # | |
Ord KeyEvent Source # | |
Read KeyEvent Source # | |
Show KeyEvent Source # | |
A direct representation of the code field of the C input_event, for when there is no obvious meaningful sum type.
Instances
Enum EventCode Source # | |
Defined in Evdev succ :: EventCode -> EventCode # pred :: EventCode -> EventCode # fromEnum :: EventCode -> Int # enumFrom :: EventCode -> [EventCode] # enumFromThen :: EventCode -> EventCode -> [EventCode] # enumFromTo :: EventCode -> EventCode -> [EventCode] # enumFromThenTo :: EventCode -> EventCode -> EventCode -> [EventCode] # | |
Eq EventCode Source # | |
Integral EventCode Source # | |
Defined in Evdev | |
Num EventCode Source # | |
Ord EventCode Source # | |
Defined in Evdev | |
Read EventCode Source # | |
Real EventCode Source # | |
Defined in Evdev toRational :: EventCode -> Rational # | |
Show EventCode Source # | |
newtype EventValue Source #
A direct representation of the value field of the C input_event, for when there is no obvious meaningful sum type.
Instances
Lower-level types
These correspond more directly to C's input_event and timeval. They are used internally, but may be useful for advanced users.
CEvent | |
|
fromCEvent :: CEvent -> Event Source #
toCTimeVal :: DiffTime -> CTimeVal Source #
fromCTimeVal :: CTimeVal -> DiffTime Source #