haskus-system-0.7.0.0: Haskus system programming framework

Safe HaskellNone
LanguageHaskell2010

Haskus.System.Linux.Devices

Description

Linux device handling

Devices in the kernel are identified with two numbers (major and minor) and their type (character or block).

For each device, there is a 1-1 correspondance with some paths in sysfs's /devices directory:

  • typemajorminor -> sysfs path Look at target of symbolic link dev{block,char}/MAJOR:MINOR
  • sysfs path -> typemajorminor In the sysfs's device directory (devices**):
  • type: if basename of "subsystem" link is "block" then block else character
  • major/minor: read contents of "dev" file

Synopsis

Documentation

data Device Source #

Device

Constructors

Device 

Fields

showDevice :: Device -> String Source #

Show a device as a path in sysfs /dev

makeDevice :: DeviceType -> Word32 -> Word32 -> Device Source #

Create a device identigier

createDeviceFile :: MonadIO m => Maybe Handle -> FilePath -> Device -> FilePermissions -> Flow m '[(), ErrorCode] Source #

Create a device special file

sysfsReadDevFile :: MonadInIO m => Handle -> FilePath -> m (Maybe DeviceID) Source #

Read device major and minor from device path

sysfsReadDev :: MonadInIO m => Handle -> FilePath -> m (Maybe Text, Maybe Device) Source #

Read device and subsystem

sysfsMakeDev :: Text -> DeviceID -> Device Source #

Make a Device from a subsystem and a DeviceID

sysfsReadSubsystem :: MonadInIO m => Handle -> FilePath -> m (Maybe Text) Source #

Read subsystem link