uevent

package
v0.0.0-...-ba0b20d Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2026 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServiceName = "dev.avyos.uevent"

	RequestListDevices uint16 = 0x0201
	RequestGetDevice   uint16 = 0x0202
	RequestTrigger     uint16 = 0x0203

	EventDeviceAdded   uint16 = 0x0301
	EventDeviceRemoved uint16 = 0x0302
	EventDeviceChanged uint16 = 0x0303
)

Variables

This section is empty.

Functions

func EncodeDeviceList

func EncodeDeviceList(devices []DeviceInfo) []byte

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client provides a typed API to the uevent service.

func Connect

func Connect() (*Client, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) GetDevice

func (c *Client) GetDevice(devPath string) (DeviceInfo, error)

func (*Client) ListDevices

func (c *Client) ListDevices() ([]DeviceInfo, error)

func (*Client) OnDeviceAdded

func (c *Client) OnDeviceAdded(fn func(DeviceEvent))

func (*Client) OnDeviceChanged

func (c *Client) OnDeviceChanged(fn func(DeviceEvent))

func (*Client) OnDeviceRemoved

func (c *Client) OnDeviceRemoved(fn func(DeviceEvent))

func (*Client) Raw

func (c *Client) Raw() *sutra.Client

func (*Client) Trigger

func (c *Client) Trigger(subsystem string) error

type DeviceEvent

type DeviceEvent struct {
	Action    string
	Subsystem string
	DevPath   string
	DevName   string
	DevType   string
	Major     int
	Minor     int
}

func DecodeDeviceEvent

func DecodeDeviceEvent(data []byte) DeviceEvent

func (*DeviceEvent) Encode

func (e *DeviceEvent) Encode() []byte

type DeviceInfo

type DeviceInfo struct {
	DevPath   string
	DevName   string
	Subsystem string
	DevType   string
	Driver    string
	Major     int
	Minor     int
}

func DecodeDeviceInfo

func DecodeDeviceInfo(data []byte) DeviceInfo

func DecodeDeviceList

func DecodeDeviceList(data []byte) []DeviceInfo

func (*DeviceInfo) Encode

func (i *DeviceInfo) Encode() []byte

Jump to

Keyboard shortcuts

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