Copyright | (c) Sam Truzjan 2013 |
---|---|
License | BSD3 |
Maintainer | pxqr.sta@gmail.com |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Connects to a device event source.
Synopsis
- data Monitor
- data SourceId
- newFromNetlink :: UDev -> SourceId -> IO Monitor
- enableReceiving :: Monitor -> IO ()
- setReceiveBufferSize :: Monitor -> Int -> IO ()
- getFd :: Monitor -> IO Fd
- getHandle :: Monitor -> IO Handle
- receiveDevice :: Monitor -> IO Device
- filterAddMatchSubsystemDevtype :: Monitor -> ByteString -> Maybe ByteString -> IO ()
- filterAddMatchTag :: Monitor -> ByteString -> IO ()
- filterUpdate :: Monitor -> IO ()
- filterRemove :: Monitor -> IO ()
Documentation
Opaque object handling an event source.
Creation
Event source identifier.
KernelId | Events are sent out just after kernel processes them. Applications should usually not connect directly to the
"kernel" events, because the devices might not be useable at
that time, before udev has configured them, and created device
nodes. Use |
UDevId | Events are sent out after udev has finished its event processing, all rules have been processed, and needed device nodes are created. |
OtherId ByteString | For extensibility. |
newFromNetlink :: UDev -> SourceId -> IO Monitor Source #
Create new udev monitor and connect to a specified event source.
Receiving
getHandle :: Monitor -> IO Handle Source #
Similar to getFd
but retrieves the socket handle associated
with the monitor.
receiveDevice :: Monitor -> IO Device Source #
Receive data from the udev monitor socket, allocate a new udev device, fill in the received data, and return the device.
Filter
filterAddMatchSubsystemDevtype :: Monitor -> ByteString -> Maybe ByteString -> IO () Source #
Filter events by subsystem and device type.
The filter must be installed before the monitor is switched to listening mode.
filterAddMatchTag :: Monitor -> ByteString -> IO () Source #
The filter must be installed before the monitor is switched to listening mode.
filterUpdate :: Monitor -> IO () Source #
Update the installed socket filter. This is only needed, if the filter was removed or changed.
filterRemove :: Monitor -> IO () Source #
Remove all filters from monitor.