Portability | portable |
---|---|
Stability | experimental |
Maintainer | pxqr.sta@gmail.com |
Safe Haskell | None |
Connects to a device event source.
- data Monitor
- data SourceId
- = KernelId
- | UDevId
- | OtherId BS.ByteString
- 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 -> BS.ByteString -> BS.ByteString -> IO ()
- filterAddMatchTag :: Monitor -> BS.ByteString -> IO ()
- filterUpdate :: Monitor -> IO ()
- filterRemove :: Monitor -> IO ()
Documentation
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 BS.ByteString | For extensibility. |
newFromNetlink :: UDev -> SourceId -> IO MonitorSource
Create new udev monitor and connect to a specified event source.
Receiving
enableReceiving :: Monitor -> IO ()Source
Binds the Monitor
socket to the event source.
setReceiveBufferSize :: Monitor -> Int -> IO ()Source
Set the size of the kernel socket buffer.
getHandle :: Monitor -> IO HandleSource
Similar to getFd
but retrieves the socket handle associated
with the monitor.
receiveDevice :: Monitor -> IO DeviceSource
Receive data from the udev monitor socket, allocate a new udev device, fill in the received data, and return the device.
Filter
filterAddMatchSubsystemDevtype :: Monitor -> BS.ByteString -> BS.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 -> BS.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.