udev

package module
v0.0.0-...-a12666f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 18, 2017 License: MIT Imports: 4 Imported by: 38

README

udev

Aims to provide a standalone udev replacement

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ModAlias

type ModAlias struct {
	Type  string
	Value string
}

ModAlias abstracts a MODALIAS identifier string

func ParseModAlias

func ParseModAlias(input string) (*ModAlias, error)

ParseModAlias parses a MODALIAS identifier

type UDevMonitor

type UDevMonitor struct {
	Fd      int
	Address syscall.SockaddrNetlink
}

UDevMonitor is a UDev netlink socket

func NewMonitor

func NewMonitor() (mon *UDevMonitor, err error)

NewMonitor creates and connects a new monitor

func (*UDevMonitor) Close

func (mon *UDevMonitor) Close() error

Close closes the monitor socket

func (*UDevMonitor) Connect

func (mon *UDevMonitor) Connect() (err error)

Connect connects the monitoring socket

func (*UDevMonitor) Monitor

func (mon *UDevMonitor) Monitor(notify chan *UEvent) (shutdown chan bool)

Monitor starts udev event monitoring. Events are sent on the notify channel, and the watch can be terminated by sending true on the returned shutdown channel

func (*UDevMonitor) Process

func (mon *UDevMonitor) Process(notify chan *UEvent)

Process processes one packet from the socket, and sends the event on the notify channel

func (*UDevMonitor) Read

func (mon *UDevMonitor) Read(b []byte) (n int, err error)

type UEvent

type UEvent struct {
	Action  string
	Devpath string
	Env     map[string]string
}

UEvent is a kernel UDev event

func ParseUEvent

func ParseUEvent(packet []byte) (event *UEvent, err error)

ParseUEvent parses a byte sequence into a UEvent object

func (*UEvent) GetEnv

func (event *UEvent) GetEnv(Key string) string

GetEnv returns the variable for Key

func (*UEvent) Modalias

func (event *UEvent) Modalias() (*ModAlias, error)

Modalias returns the module alias information, if present

func (*UEvent) String

func (event *UEvent) String() (str string)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL