haskus-system-0.6.0.0: Haskus system programming framework

Safe HaskellNone
LanguageHaskell2010

Haskus.Arch.Linux.KernelEvent

Description

Kernel events are sent by the kernel to indicate that something changed in the device tree (e.g. device (un)plugged, moved, etc.)

Synopsis

Documentation

data KernelEvent Source #

A kernel event

Constructors

KernelEvent 

Fields

data KernelEventAction Source #

Kernel event type of action

Constructors

ActionAdd

A device has been added

ActionRemove

A device has been removed

ActionChange

A device state has been modified

ActionOnline

A device is now on-line

ActionOffline

A device is now off-line

ActionMove

A device has been moved

ActionOther Text

Other action

parseKernelEvent :: Buffer -> Maybe KernelEvent Source #

Parse a kernel event

Kernel events are received as several zero-terminal strings. The first line isn't very useful because it is redundant with the content of the following lines. The following lines have the "key=value" format.

Note: when kernel event sockets are used with a classic Linux distribution using udev, libudev injects its own events with their own syntax to perform netlink communication between processes (expected to be replaced with kdbus at some point). Hence we discard these events (they all begin with "libudev" characters) and return Nothing.