Portability | portable |
---|---|
Stability | stable |
Maintainer | pxqr.sta@gmail.com |
Safe Haskell | None |
Lookup devices in the sys filesystem, filter devices by properties, and return a sorted list of devices.
- data Enumerate
- newEnumerate :: UDev -> IO Enumerate
- type Subsystem = BS.ByteString
- addMatchSubsystem :: Enumerate -> Subsystem -> IO ()
- addNoMatchSubsystem :: Enumerate -> Subsystem -> IO ()
- type SysAttr = BS.ByteString
- type SysValue = BS.ByteString
- addMatchSysattr :: Enumerate -> SysAttr -> Maybe SysValue -> IO ()
- addNoMatchSysattr :: Enumerate -> BS.ByteString -> Maybe BS.ByteString -> IO ()
- addMatchProperty :: Enumerate -> BS.ByteString -> BS.ByteString -> IO ()
- addMatchTag :: Enumerate -> BS.ByteString -> IO ()
- addMatchParent :: Enumerate -> Device -> IO ()
- addMatchIsInitialized :: Enumerate -> IO ()
- addMatchSysname :: Enumerate -> BS.ByteString -> IO ()
- addSyspath :: Enumerate -> RawFilePath -> IO ()
- scanDevices :: Enumerate -> IO ()
- scanSubsystems :: Enumerate -> IO ()
- getListEntry :: Enumerate -> IO List
Documentation
newEnumerate :: UDev -> IO EnumerateSource
Create an enumeration context to scan /sys.
Match
type Subsystem = BS.ByteStringSource
Kernel subsystem string.
:: Enumerate | context |
-> Subsystem | filter for a subsystem of the device to include in the list |
-> IO () | can throw exception |
Match only devices belonging to a certain kernel subsystem.
:: Enumerate | context |
-> Subsystem | filter for a subsystem of the device to exclude from the list |
-> IO () | can throw exception |
Match only devices not belonging to a certain kernel subsystem.
type SysAttr = BS.ByteStringSource
/sys attribute string.
type SysValue = BS.ByteStringSource
Attribute specific /sys value string. Can be an int or identifier depending on attribute.
:: Enumerate | context |
-> SysAttr | filter for a sys attribute at the device to include in the list |
-> Maybe SysValue | optional value of the sys attribute |
-> IO () | can throw exception |
Match only devices with a certain /sys device attribute.
:: Enumerate | context |
-> BS.ByteString | filter for a sys attribute at the device to exclude from the list |
-> Maybe BS.ByteString | optional value of the sys attribute |
-> IO () |
Match only devices not having a certain /sys device attribute.
:: Enumerate | context |
-> BS.ByteString | filter for a property of the device to include in the list |
-> BS.ByteString | value of the property |
-> IO () |
Match only devices with a certain property.
:: Enumerate | context |
-> BS.ByteString | filter for a tag of the device to include in the list |
-> IO () |
Match only devices with a certain tag.
Return the devices on the subtree of one given device. The parent itself is included in the list.
A reference for the device is held until the udev_enumerate context is cleaned up.
addMatchIsInitialized :: Enumerate -> IO ()Source
Match only devices which udev has set up already.
:: Enumerate | context |
-> BS.ByteString | filter for the name of the device to include in the list |
-> IO () | can throw exception |
Match only devices with a given /sys device name.
:: Enumerate | context |
-> RawFilePath | path of a device |
-> IO () | can throw exception |
Add a device to the list of devices, to retrieve it back sorted in dependency order.
Scan
scanDevices :: Enumerate -> IO ()Source
Scan /sys for all devices which match the given filters.
scanSubsystems :: Enumerate -> IO ()Source
Scan /sys for all devices which match the given filters.
Query
getListEntry :: Enumerate -> IO ListSource
Get the first entry of the sorted list of device paths.