Help us shape the future of Go! Take the 2026 Go Developer Survey

gosmc

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2020 License: MIT Imports: 0 Imported by: 1

README

Introduction

The gosmc package is an attempt at wrapping the smc library into a Go-like binding.

References

Documentation

Index

Constants

View Source
const (
	IOReturnSuccess         = 0x0   // OK
	IOReturnError           = 0x2bc // general error
	IOReturnNoMemory        = 0x2bd // can't allocate memory
	IOReturnNoResources     = 0x2be // resource shortage
	IOReturnIPCError        = 0x2bf // error during IPC
	IOReturnNoDevice        = 0x2c0 // no such device
	IOReturnNotPrivileged   = 0x2c1 // privilege violation
	IOReturnBadArgument     = 0x2c2 // invalid argument
	IOReturnLockedRead      = 0x2c3 // device read locked
	IOReturnLockedWrite     = 0x2c4 // device write locked
	IOReturnExclusiveAccess = 0x2c5 // exclusive access and
	//   device already open
	IOReturnBadMessageID = 0x2c6 // sent/received messages
	//   had different msg_id
	IOReturnUnsupported   = 0x2c7 // unsupported function
	IOReturnVMError       = 0x2c8 // misc. VM failure
	IOReturnInternalError = 0x2c9 // internal error
	IOReturnIOError       = 0x2ca // General I/O error

	IOReturnCannotLock  = 0x2cc // can't acquire lock
	IOReturnNotOpen     = 0x2cd // device not open
	IOReturnNotReadable = 0x2ce // read not supported
	IOReturnNotWritable = 0x2cf // write not supported
	IOReturnNotAligned  = 0x2d0 // alignment error
	IOReturnBadMedia    = 0x2d1 // Media Error
	IOReturnStillOpen   = 0x2d2 // device(s) still open
	IOReturnRLDError    = 0x2d3 // rld failure
	IOReturnDMAError    = 0x2d4 // DMA failure
	IOReturnBusy        = 0x2d5 // Device Busy
	IOReturnTimeout     = 0x2d6 // I/O Timeout
	IOReturnOffline     = 0x2d7 // device offline
	IOReturnNotReady    = 0x2d8 // not ready
	IOReturnNotAttached = 0x2d9 // device not attached
	IOReturnNoChannels  = 0x2da // no DMA channels left
	IOReturnNoSpace     = 0x2db // no space for data

	IOReturnPortExists = 0x2dd // port already exists
	IOReturnCannotWire = 0x2de // can't wire down
	//   physical memory
	IOReturnNoInterrupt     = 0x2df // no interrupt attached
	IOReturnNoFrames        = 0x2e0 // no DMA frames enqueued
	IOReturnMessageTooLarge = 0x2e1 // oversized msg received
	//   on interrupt port
	IOReturnNotPermitted     = 0x2e2 // not permitted
	IOReturnNoPower          = 0x2e3 // no power to device
	IOReturnNoMedia          = 0x2e4 // media not present
	IOReturnUnformattedMedia = 0x2e5 // media not formatted
	IOReturnUnsupportedMode  = 0x2e6 // no such mode
	IOReturnUnderrun         = 0x2e7 // data underrun
	IOReturnOverrun          = 0x2e8 // data overrun
	IOReturnDeviceError      = 0x2e9 // the device is not working properly!
	IOReturnNoCompletion     = 0x2ea // a completion routine is required
	IOReturnAborted          = 0x2eb // operation aborted
	IOReturnNoBandwidth      = 0x2ec // bus bandwidth would be exceeded
	IOReturnNotResponding    = 0x2ed // device not responding
	IOReturnIsoTooOld        = 0x2ee // isochronous I/O request for distant past!
	IOReturnIsoTooNew        = 0x2ef // isochronous I/O request for distant future
	IOReturnNotFound         = 0x2f0 // data was not found
	IOReturnInvalid          = 0x1   // should never be seen
)

IOReturn values

View Source
const (
	OPNone = iota
	OPList
	OPRead
	OPReadFan
	OPWrite
	OPBruteForce
)

OP Values

View Source
const (
	CMDReadBytes   = 5
	CMDWriteBytes  = 6
	CMDReadIndex   = 8
	CMDReadKeyinfo = 9
	CMDReadPlimit  = 11
	CMDReadVers    = 12
)

SMC CMD values

View Source
const (
	TypeFPE2 = "fpe2"
	TypeFP2E = "fp2e"
	TypeFP4C = "fp4c"
	TypeCH8  = "ch8*"
	TypeSP78 = "sp78"
	TypeSP4B = "sp4b"
	TypeFP5B = "fp5b"
	TypeFP88 = "fp88"
	TypeUI8  = "ui8"
	TypeUI16 = "ui16"
	TypeUI32 = "ui32"
	TypeSI8  = "si8"
	TypeSI16 = "si16"
	TypeSI32 = "si32"
	TypeFLAG = "flag"
	TypeFDS  = "{fds"
	TypeFLT  = "flt"
)

SMC Type values

View Source
const (
	TypeFPXXSize = 2
	TypeSPXXSize = 2
	TypeUI8Size  = 1
	TypeUI16Size = 2
	TypeUI32Size = 4
	TypeSI8Size  = 1
	TypeSI16Size = 2
	TypeSI32Size = 4
	TypeFLAGSize = 1
)

SMC Size values

View Source
const (
	KernelIndexSMC = 2
)

Kernel values

Variables

This section is empty.

Functions

func SMCClose

func SMCClose(connection uint) int

SMCClose wrapper for Apple IOKit SMCClose

func SMCOpen

func SMCOpen(service string) (connection uint, result int)

SMCOpen wrapper for Apple IOKit SMCOpen

func SMCWriteKey

func SMCWriteKey(connection uint, val *SMCVal) int

SMCWriteKey wrapper for Apple IOKit SMCWriteKey

func SMCWriteKeyUnsafe

func SMCWriteKeyUnsafe(connection uint, val *SMCVal) int

SMCWriteKeyUnsafe wrapper for Apple IOKit SMCWriteKeyUnsafe

Types

type DataVers

type DataVers struct {
	Major    uint8
	Minor    uint8
	Build    uint8
	Reserved [1]uint8
	Release  uint16
}

DataVers is IOKit DataVers struct

type KeyInfo

type KeyInfo struct {
	DataSize       uint32
	DataType       uint32
	DataAttributes uint8
}

KeyInfo is IOKit KeyInfo struct

type PLimitData

type PLimitData struct {
	Version   uint16
	Length    uint16
	CPUPLimit uint32
	GPUPLimit uint32
	MemPLimit uint32
}

PLimitData is IOKit PLimitData struct

type SMCBytes

type SMCBytes [32]byte

SMCBytes is IOKit UInt32Char SMCBytes

type SMCKeyData

type SMCKeyData struct {
	Key        uint32
	Vers       DataVers
	PLimitData PLimitData
	KeyInfo    KeyInfo
	Result     uint8
	Status     uint8
	Data8      uint8
	Data32     uint32
	Bytes      SMCBytes
}

SMCKeyData is IOKit SMCKeyData struct

func SMCCall

func SMCCall(connection uint, index int, inputStruct *SMCKeyData) (*SMCKeyData, int)

SMCCall wrapper for Apple IOKit SMCCall

type SMCVal

type SMCVal struct {
	Key      UInt32Char
	DataSize uint32
	DataType UInt32Char
	Bytes    SMCBytes
}

SMCVal is IOKit SMCVal struct

func SMCReadKey

func SMCReadKey(connection uint, key string) (*SMCVal, int)

SMCReadKey wrapper for Apple IOKit SMCReadKey

type UInt32Char

type UInt32Char [5]byte

UInt32Char is IOKit UInt32Char type

func (UInt32Char) ToString

func (bs UInt32Char) ToString() string

ToString return as string

Jump to

Keyboard shortcuts

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