brightness

package
v0.0.0-...-654f2ec Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	I2C_SLAVE       = 0x0703
	DDCCI_ADDR      = 0x37
	DDCCI_VCP_GET   = 0x01
	DDCCI_VCP_SET   = 0x03
	VCP_BRIGHTNESS  = 0x10
	DDC_SOURCE_ADDR = 0x51
)

Variables

This section is empty.

Functions

func HandleRequest

func HandleRequest(conn net.Conn, req models.Request, m *Manager)

Types

type DBusConn

type DBusConn interface {
	Object(dest string, path dbus.ObjectPath) dbus.BusObject
	Close() error
}

type DDCBackend

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

func NewDDCBackend

func NewDDCBackend() (*DDCBackend, error)

func (*DDCBackend) Close

func (b *DDCBackend) Close()

func (*DDCBackend) ForceRescan

func (b *DDCBackend) ForceRescan() error

func (*DDCBackend) GetDevices

func (b *DDCBackend) GetDevices() ([]Device, error)

func (*DDCBackend) SetBrightness

func (b *DDCBackend) SetBrightness(id string, value int, exponential bool, callback func()) error

func (*DDCBackend) SetBrightnessWithExponent

func (b *DDCBackend) SetBrightnessWithExponent(id string, value int, exponential bool, exponent float64, callback func()) error

type Device

type Device struct {
	Class          DeviceClass `json:"class"`
	ID             string      `json:"id"`
	Name           string      `json:"name"`
	Current        int         `json:"current"`
	Max            int         `json:"max"`
	CurrentPercent int         `json:"currentPercent"`
	Backend        string      `json:"backend"`
}

type DeviceClass

type DeviceClass string
const (
	ClassBacklight DeviceClass = "backlight"
	ClassLED       DeviceClass = "leds"
	ClassDDC       DeviceClass = "ddc"
)

type DeviceUpdate

type DeviceUpdate struct {
	Device Device `json:"device"`
}

type LogindBackend

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

func NewLogindBackend

func NewLogindBackend() (*LogindBackend, error)

func NewLogindBackendWithConn

func NewLogindBackendWithConn(conn DBusConn) *LogindBackend

func (*LogindBackend) Close

func (b *LogindBackend) Close()

func (*LogindBackend) SetBrightness

func (b *LogindBackend) SetBrightness(subsystem, name string, brightness uint32) error

type Manager

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

func NewManager

func NewManager() (*Manager, error)

func NewManagerWithOptions

func NewManagerWithOptions(exponential bool) (*Manager, error)

func (*Manager) Close

func (m *Manager) Close()

func (*Manager) DecrementBrightness

func (m *Manager) DecrementBrightness(deviceID string, step int) error

func (*Manager) GetState

func (m *Manager) GetState() State

func (*Manager) IncrementBrightness

func (m *Manager) IncrementBrightness(deviceID string, step int) error

func (*Manager) IncrementBrightnessWithExponent

func (m *Manager) IncrementBrightnessWithExponent(deviceID string, step int, exponential bool, exponent float64) error

func (*Manager) IncrementBrightnessWithMode

func (m *Manager) IncrementBrightnessWithMode(deviceID string, step int, exponential bool) error

func (*Manager) NotifySubscribers

func (m *Manager) NotifySubscribers()

func (*Manager) Rescan

func (m *Manager) Rescan()

func (*Manager) SetBrightness

func (m *Manager) SetBrightness(deviceID string, percent int) error

func (*Manager) SetBrightnessWithExponent

func (m *Manager) SetBrightnessWithExponent(deviceID string, percent int, exponential bool, exponent float64) error

func (*Manager) SetBrightnessWithMode

func (m *Manager) SetBrightnessWithMode(deviceID string, percent int, exponential bool) error

func (*Manager) Subscribe

func (m *Manager) Subscribe(id string) chan State

func (*Manager) SubscribeUpdates

func (m *Manager) SubscribeUpdates(id string) chan DeviceUpdate

func (*Manager) Unsubscribe

func (m *Manager) Unsubscribe(id string)

func (*Manager) UnsubscribeUpdates

func (m *Manager) UnsubscribeUpdates(id string)

type State

type State struct {
	Devices []Device `json:"devices"`
}

type SysfsBackend

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

func NewSysfsBackend

func NewSysfsBackend() (*SysfsBackend, error)

func (*SysfsBackend) GetDevice

func (b *SysfsBackend) GetDevice(id string) (*sysfsDevice, error)

func (*SysfsBackend) GetDevices

func (b *SysfsBackend) GetDevices() ([]Device, error)

func (*SysfsBackend) PercentToValue

func (b *SysfsBackend) PercentToValue(percent int, dev *sysfsDevice, exponential bool) int

func (*SysfsBackend) PercentToValueWithExponent

func (b *SysfsBackend) PercentToValueWithExponent(percent int, dev *sysfsDevice, exponential bool, exponent float64) int

func (*SysfsBackend) Rescan

func (b *SysfsBackend) Rescan() error

func (*SysfsBackend) SetBrightness

func (b *SysfsBackend) SetBrightness(id string, percent int, exponential bool) error

func (*SysfsBackend) SetBrightnessWithExponent

func (b *SysfsBackend) SetBrightnessWithExponent(id string, percent int, exponential bool, exponent float64) error

func (*SysfsBackend) ValueToPercent

func (b *SysfsBackend) ValueToPercent(value int, dev *sysfsDevice, exponential bool) int

func (*SysfsBackend) ValueToPercentWithExponent

func (b *SysfsBackend) ValueToPercentWithExponent(value int, dev *sysfsDevice, exponential bool, exponent float64) int

type UdevMonitor

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

func NewUdevMonitor

func NewUdevMonitor(manager *Manager) *UdevMonitor

func (*UdevMonitor) Close

func (m *UdevMonitor) Close()

Jump to

Keyboard shortcuts

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