smc

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: GPL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MagSafeLedKey    = "ACLC" // Not verified yet.
	ACPowerKey       = "AC-W" // Not verified yet.
	ChargingKey1     = "CH0B" // Not verified yet.
	ChargingKey2     = "CH0C" // Not verified yet.
	AdapterKey       = "CH0K"
	BatteryChargeKey = "BBIF"
)

Various SMC keys for amd64 (Intel 64). This file is not used currently because we have no plan to support Classic Intel MacBooks. However, if we want to, we have something to work on.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection struct {
	*gosmc.Connection
}

Connection is a wrapper of gosmc.Connection.

func New

func New() *Connection

New returns a new Connection.

func (*Connection) CheckMagSafeExistence added in v0.2.0

func (c *Connection) CheckMagSafeExistence() bool

CheckMagSafeExistence .

func (*Connection) Close

func (c *Connection) Close() error

Close closes the connection.

func (*Connection) DisableAdapter

func (c *Connection) DisableAdapter() error

DisableAdapter disables the adapter.

func (*Connection) DisableCharging

func (c *Connection) DisableCharging() error

DisableCharging disables charging.

func (*Connection) EnableAdapter

func (c *Connection) EnableAdapter() error

EnableAdapter enables the adapter.

func (*Connection) EnableCharging

func (c *Connection) EnableCharging() error

EnableCharging enables charging.

func (*Connection) GetBatteryCharge

func (c *Connection) GetBatteryCharge() (int, error)

GetBatteryCharge returns the battery charge.

func (*Connection) GetMagSafeLedState added in v0.2.0

func (c *Connection) GetMagSafeLedState() (MagSafeLedState, error)

GetMagSafeLedState .

func (*Connection) IsAdapterEnabled

func (c *Connection) IsAdapterEnabled() (bool, error)

IsAdapterEnabled returns whether the adapter is enabled.

func (*Connection) IsChargingEnabled

func (c *Connection) IsChargingEnabled() (bool, error)

IsChargingEnabled returns whether charging is enabled.

func (*Connection) IsMagSafeCharging added in v0.2.0

func (c *Connection) IsMagSafeCharging() (bool, error)

IsMagSafeCharging .

func (*Connection) IsPluggedIn

func (c *Connection) IsPluggedIn() (bool, error)

IsPluggedIn returns whether the device is plugged in.

func (*Connection) Open

func (c *Connection) Open() error

Open opens the connection.

func (*Connection) Read

func (c *Connection) Read(key string) (gosmc.SMCVal, error)

Read reads a value from SMC.

func (*Connection) SetMagSafeCharging added in v0.2.0

func (c *Connection) SetMagSafeCharging(charging bool) error

SetMagSafeCharging .

func (*Connection) SetMagSafeLedState added in v0.2.0

func (c *Connection) SetMagSafeLedState(state MagSafeLedState) error

SetMagSafeLedState .

func (*Connection) Write

func (c *Connection) Write(key string, value []byte) error

Write writes a value to SMC.

type MagSafeLedState added in v0.2.0

type MagSafeLedState uint8

MagSafeLedState is the state of the MagSafe LED.

const (
	LEDSystem        MagSafeLedState = 0x00
	LEDOff           MagSafeLedState = 0x01
	LEDGreen         MagSafeLedState = 0x03
	LEDOrange        MagSafeLedState = 0x04
	LEDErrorOnce     MagSafeLedState = 0x05
	LEDErrorPermSlow MagSafeLedState = 0x06
	LEDErrorPermFast MagSafeLedState = 0x07
	LEDErrorPermOff  MagSafeLedState = 0x19
)

Representation of MagSafeLedState.

Jump to

Keyboard shortcuts

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