udev-0.1.1.0: libudev bindings
Copyright(c) Sam Truzjan 2013
LicenseBSD3
Maintainerpxqr.sta@gmail.com
Stabilitystable
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

System.UDev.Enumerate

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

Instances details
UDevChild Enumerate Source # 
Instance details

Defined in System.UDev.Types

newEnumerate :: UDev -> IO Enumerate Source #

Create an enumeration context to scan /sys.

Match

type Subsystem = ByteString Source #

Kernel subsystem string.

addMatchSubsystem Source #

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.

addNoMatchSubsystem Source #

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 = ByteString Source #

/sys attribute string.

type SysValue = ByteString Source #

Attribute specific /sys value string. Can be an int or identifier depending on attribute.

addMatchSysattr Source #

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.

addNoMatchSysattr Source #

Arguments

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

addMatchProperty Source #

Arguments

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

addMatchTag Source #

Arguments

:: Enumerate

context

-> ByteString

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

-> IO () 

Match only devices with a certain tag.

addMatchParent Source #

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.

addMatchSysname Source #

Arguments

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

addSyspath Source #

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 (Maybe List) Source #

Get the first entry of the sorted list of device paths.