udev-0.1.0.0: libudev bindings

Portabilityportable
Stabilitystable
Maintainerpxqr.sta@gmail.com
Safe HaskellNone

System.UDev.Enumerate

Contents

Description

Lookup devices in the sys filesystem, filter devices by properties, and return a sorted list of devices.

Synopsis

Documentation

data Enumerate Source

Opaque object representing one device lookup/sort context.

Instances

newEnumerate :: UDev -> IO EnumerateSource

Create an enumeration context to scan /sys.

Match

type Subsystem = BS.ByteStringSource

Kernel subsystem string.

addMatchSubsystemSource

Arguments

:: 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.

addNoMatchSubsystemSource

Arguments

:: 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.

addMatchSysattrSource

Arguments

:: 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.

addNoMatchSysattrSource

Arguments

:: 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.

addMatchPropertySource

Arguments

:: 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.

addMatchTagSource

Arguments

:: Enumerate

context

-> BS.ByteString

filter for a tag of the device to include in the list

-> IO () 

Match only devices with a certain tag.

addMatchParentSource

Arguments

:: Enumerate

context

-> Device

parent device where to start searching

-> IO ()

can throw exception

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.

addMatchSysnameSource

Arguments

:: 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.

addSyspathSource

Arguments

:: 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.