brightness

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2025 License: MIT Imports: 17 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 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) 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 added in v0.4.1

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 added in v0.4.0

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 added in v0.4.1

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

func (*Manager) IncrementBrightnessWithMode added in v0.4.0

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 added in v0.4.1

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

func (*Manager) SetBrightnessWithMode added in v0.4.0

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 Request

type Request struct {
	ID     interface{}            `json:"id"`
	Method string                 `json:"method"`
	Params map[string]interface{} `json:"params"`
}

type SetBrightnessParams

type SetBrightnessParams struct {
	Device      string  `json:"device"`
	Percent     int     `json:"percent"`
	Exponential bool    `json:"exponential,omitempty"`
	Exponent    float64 `json:"exponent,omitempty"`
}

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 added in v0.4.0

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

func (*SysfsBackend) GetDevices

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

func (*SysfsBackend) PercentToValue added in v0.4.0

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

func (*SysfsBackend) PercentToValueWithExponent added in v0.4.1

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

func (*SysfsBackend) SetBrightness

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

func (*SysfsBackend) SetBrightnessWithExponent added in v0.4.1

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

func (*SysfsBackend) ValueToPercent added in v0.4.0

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

func (*SysfsBackend) ValueToPercentWithExponent added in v0.4.1

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

Jump to

Keyboard shortcuts

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