Copyright | (c) Sam Truzjan 2013 |
---|---|
License | BSD3 |
Maintainer | pxqr.sta@gmail.com |
Stability | stable |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Lookup devices in the sys filesystem, filter devices by properties, and return a sorted list of devices.
Synopsis
- data Enumerate
- newEnumerate :: UDev -> IO Enumerate
- type Subsystem = ByteString
- addMatchSubsystem :: Enumerate -> Subsystem -> IO ()
- addNoMatchSubsystem :: Enumerate -> Subsystem -> IO ()
- type SysAttr = ByteString
- type SysValue = ByteString
- addMatchSysattr :: Enumerate -> SysAttr -> Maybe SysValue -> IO ()
- addNoMatchSysattr :: Enumerate -> ByteString -> Maybe ByteString -> IO ()
- addMatchProperty :: Enumerate -> ByteString -> ByteString -> IO ()
- addMatchTag :: Enumerate -> ByteString -> IO ()
- addMatchParent :: Enumerate -> Device -> IO ()
- addMatchIsInitialized :: Enumerate -> IO ()
- addMatchSysname :: Enumerate -> ByteString -> IO ()
- addSyspath :: Enumerate -> RawFilePath -> IO ()
- scanDevices :: Enumerate -> IO ()
- scanSubsystems :: Enumerate -> IO ()
- getListEntry :: Enumerate -> IO (Maybe List)
Documentation
Opaque object representing one device lookup/sort context.
Match
type Subsystem = ByteString Source #
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 = ByteString Source #
/sys attribute string.
type SysValue = ByteString Source #
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 |
-> ByteString | filter for a sys attribute at the device to exclude from the list |
-> Maybe ByteString | optional value of the sys attribute |
-> IO () |
Match only devices not having a certain /sys device attribute.
:: Enumerate | context |
-> ByteString | filter for a property of the device to include in the list |
-> ByteString | value of the property |
-> IO () |
Match only devices with a certain property.
:: Enumerate | context |
-> 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 |
-> 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.