linux

package
v3.0.33 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2021 License: BSD-2-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	I2C_DEV             = "/dev/i2c"
	I2C_SMBUS_BLOCK_MAX = 32 /* As specified in SMBus standard */
)
View Source
const (
	// i2c ioctl commands
	I2C_RETRIES     = 0x0701 /* number of times a device address should be polled when not acknowledging */
	I2C_TIMEOUT     = 0x0702 /* set timeout in units of 10 ms */
	I2C_SLAVE       = 0x0703 /* Use this slave address */
	I2C_SLAVE_FORCE = 0x0706 /* Use this slave address, even if it is already in use by a driver! */
	I2C_TENBIT      = 0x0704 /* 0 for 7 bit addrs, != 0 for 10 bit */
	I2C_FUNCS       = 0x0705 /* Get the adapter functionality mask */
	I2C_RDWR        = 0x0707 /* Combined R/W transfer (one STOP only) */
	I2C_PEC         = 0x0708 /* != 0 to use PEC with SMBus */
	I2C_SMBUS       = 0x0720 /* SMBus transfer */
)
View Source
const (
	// i2c_smbus_xfer read or write markers
	I2C_SMBUS_READ  uint8 = 0x01
	I2C_SMBUS_WRITE uint8 = 0x00
)
View Source
const (
	// SMBus transaction types
	I2C_SMBUS_QUICK            uint32 = 0
	I2C_SMBUS_BYTE             uint32 = 1
	I2C_SMBUS_BYTE_DATA        uint32 = 2
	I2C_SMBUS_WORD_DATA        uint32 = 3
	I2C_SMBUS_PROC_CALL        uint32 = 4
	I2C_SMBUS_BLOCK_DATA       uint32 = 5
	I2C_SMBUS_I2C_BLOCK_BROKEN uint32 = 6
	I2C_SMBUS_BLOCK_PROC_CALL  uint32 = 7
	I2C_SMBUS_I2C_BLOCK_DATA   uint32 = 8
)
View Source
const (
	LIRC_DEV              = "/dev/lirc"
	LIRC_MODE2SEND uint32 = 0
	LIRC_MODE2REC  uint32 = 16
)
View Source
const (
	SPI_DEV       = "/dev/spidev"
	SPI_IOC_MAGIC = 107
)
View Source
const (
	TEMPERATURE_PATH = "/sys/class/thermal"
)

Variables

View Source
var (
	LIRC_GET_FEATURES             = uintptr(C._LIRC_GET_FEATURES())
	LIRC_GET_SEND_MODE            = uintptr(C._LIRC_GET_SEND_MODE())
	LIRC_GET_REC_MODE             = uintptr(C._LIRC_GET_REC_MODE())
	LIRC_GET_REC_RESOLUTION       = uintptr(C._LIRC_GET_REC_RESOLUTION())
	LIRC_GET_MIN_TIMEOUT          = uintptr(C._LIRC_GET_MIN_TIMEOUT())
	LIRC_GET_MAX_TIMEOUT          = uintptr(C._LIRC_GET_MAX_TIMEOUT())
	LIRC_GET_LENGTH               = uintptr(C._LIRC_GET_LENGTH())
	LIRC_SET_SEND_MODE            = uintptr(C._LIRC_SET_SEND_MODE())
	LIRC_SET_REC_MODE             = uintptr(C._LIRC_SET_REC_MODE())
	LIRC_SET_SEND_CARRIER         = uintptr(C._LIRC_SET_SEND_CARRIER())
	LIRC_SET_REC_CARRIER          = uintptr(C._LIRC_SET_REC_CARRIER())
	LIRC_SET_SEND_DUTY_CYCLE      = uintptr(C._LIRC_SET_SEND_DUTY_CYCLE())
	LIRC_SET_REC_DUTY_CYCLE       = uintptr(C._LIRC_SET_REC_DUTY_CYCLE())
	LIRC_SET_TRANSMITTER_MASK     = uintptr(C._LIRC_SET_TRANSMITTER_MASK())
	LIRC_SET_REC_TIMEOUT          = uintptr(C._LIRC_SET_REC_TIMEOUT())
	LIRC_SET_REC_TIMEOUT_REPORTS  = uintptr(C._LIRC_SET_REC_TIMEOUT_REPORTS())
	LIRC_SET_MEASURE_CARRIER_MODE = uintptr(C._LIRC_SET_MEASURE_CARRIER_MODE())
	LIRC_SET_REC_CARRIER_RANGE    = uintptr(C._LIRC_SET_REC_CARRIER_RANGE())
	LIRC_SET_WIDEBAND_RECEIVER    = uintptr(C._LIRC_SET_WIDEBAND_RECEIVER())
)
View Source
var (
	SPI_IOC_RD_MODE          = uintptr(C._SPI_IOC_RD_MODE())
	SPI_IOC_WR_MODE          = uintptr(C._SPI_IOC_WR_MODE())
	SPI_IOC_RD_LSB_FIRST     = uintptr(C._SPI_IOC_RD_LSB_FIRST())
	SPI_IOC_WR_LSB_FIRST     = uintptr(C._SPI_IOC_WR_LSB_FIRST())
	SPI_IOC_RD_BITS_PER_WORD = uintptr(C._SPI_IOC_RD_BITS_PER_WORD())
	SPI_IOC_WR_BITS_PER_WORD = uintptr(C._SPI_IOC_WR_BITS_PER_WORD())
	SPI_IOC_RD_MAX_SPEED_HZ  = uintptr(C._SPI_IOC_RD_MAX_SPEED_HZ())
	SPI_IOC_WR_MAX_SPEED_HZ  = uintptr(C._SPI_IOC_WR_MAX_SPEED_HZ())
	SPI_IOC_RD_MODE32        = uintptr(C._SPI_IOC_RD_MODE32())
	SPI_IOC_WR_MODE32        = uintptr(C._SPI_IOC_WR_MODE32())
)

Functions

func EpollAdd

func EpollAdd(handle, fd uintptr, mode EpollMode) error

func EpollClose

func EpollClose(handle uintptr) error

func EpollCreate

func EpollCreate() (uintptr, error)

func EpollDelete

func EpollDelete(handle, fd uintptr) error

func I2CDetectSlave

func I2CDetectSlave(fd uintptr, slave uint8, funcs I2CFunction) (bool, error)

func I2CDevice

func I2CDevice(bus uint) string

func I2COpenDevice

func I2COpenDevice(bus uint) (*os.File, error)

func I2CReadBlock

func I2CReadBlock(fd uintptr, reg, length uint8, funcs I2CFunction) ([]byte, error)

func I2CReadInt16

func I2CReadInt16(fd uintptr, reg uint8, funcs I2CFunction) (int16, error)

func I2CReadInt8

func I2CReadInt8(fd uintptr, reg uint8, funcs I2CFunction) (int8, error)

func I2CReadUint16

func I2CReadUint16(fd uintptr, reg uint8, funcs I2CFunction) (uint16, error)

func I2CReadUint8

func I2CReadUint8(fd uintptr, reg uint8, funcs I2CFunction) (uint8, error)

func I2CSetSlave

func I2CSetSlave(fd uintptr, slave uint8) error

func I2CWriteInt16

func I2CWriteInt16(fd uintptr, reg uint8, value int16, funcs I2CFunction) error

func I2CWriteInt8

func I2CWriteInt8(fd uintptr, reg uint8, value int8, funcs I2CFunction) error

func I2CWriteQuick

func I2CWriteQuick(fd uintptr, value uint8, funcs I2CFunction) error

func I2CWriteUint16

func I2CWriteUint16(fd uintptr, reg uint8, value uint16, funcs I2CFunction) error

func I2CWriteUint8

func I2CWriteUint8(fd uintptr, reg, value uint8, funcs I2CFunction) error

func LIRCDevice

func LIRCDevice(bus uint) string

func LIRCLength

func LIRCLength(fd uintptr) (uint32, error)

func LIRCMinMaxTimeoutMicros

func LIRCMinMaxTimeoutMicros(fd uintptr) (uint32, uint32, error)

func LIRCOpenDevice

func LIRCOpenDevice(path string, mode LIRCMode) (*os.File, error)

func LIRCRcvMode

func LIRCRcvMode(fd uintptr) (gopi.LIRCMode, error)

func LIRCRcvResolutionMicros

func LIRCRcvResolutionMicros(fd uintptr) (uint32, error)

func LIRCSendMode

func LIRCSendMode(fd uintptr) (gopi.LIRCMode, error)

func LIRCSetMeasureCarrierMode

func LIRCSetMeasureCarrierMode(fd uintptr, value bool) error

func LIRCSetRcvCarrierHz

func LIRCSetRcvCarrierHz(fd uintptr, value uint32) error

func LIRCSetRcvCarrierRangeHz

func LIRCSetRcvCarrierRangeHz(fd uintptr, value uint32) error

func LIRCSetRcvDutyCycle

func LIRCSetRcvDutyCycle(fd uintptr, value uint32) error

func LIRCSetRcvMode

func LIRCSetRcvMode(fd uintptr, value gopi.LIRCMode) error

func LIRCSetRcvTimeoutMicros

func LIRCSetRcvTimeoutMicros(fd uintptr, value uint32) error

func LIRCSetRcvTimeoutReports

func LIRCSetRcvTimeoutReports(fd uintptr, value bool) error

func LIRCSetSendCarrierHz

func LIRCSetSendCarrierHz(fd uintptr, value uint32) error

func LIRCSetSendDutyCycle

func LIRCSetSendDutyCycle(fd uintptr, value uint32) error

func LIRCSetSendMode

func LIRCSetSendMode(fd uintptr, value gopi.LIRCMode) error

func LIRCSetTransmitterMask

func LIRCSetTransmitterMask(fd uintptr, value uint32) error

func LIRCSetWidebandReceiver

func LIRCSetWidebandReceiver(fd uintptr, value bool) error

func LoadAverage

func LoadAverage() (float64, float64, float64)

Return load averages

func SPIBitsPerWord

func SPIBitsPerWord(fd uintptr) (uint8, error)

func SPIDevice

func SPIDevice(bus, slave uint) string

func SPIMode

func SPIMode(fd uintptr) (gopi.SPIMode, error)

func SPIOpenDevice

func SPIOpenDevice(bus, slave uint) (*os.File, error)

func SPIRead

func SPIRead(fd uintptr, recv []byte, speed uint32, delay uint16, bits uint8) error

func SPISetBitsPerWord

func SPISetBitsPerWord(fd uintptr, bits uint8) error

func SPISetMode

func SPISetMode(fd uintptr, mode gopi.SPIMode) error

func SPISetSpeedHz

func SPISetSpeedHz(fd uintptr, speed uint32) error

func SPISpeedHz

func SPISpeedHz(fd uintptr) (uint32, error)

func SPITransfer

func SPITransfer(fd uintptr, send []byte, speed uint32, delay uint16, bits uint8) ([]byte, error)

func SPIWrite

func SPIWrite(fd uintptr, send []byte, speed uint32, delay uint16, bits uint8) error

func SerialNumber

func SerialNumber() string

SerialNumber returns the mac address of the hardware, if available

func TemperatureZones

func TemperatureZones() map[string]float32

func Uptime

func Uptime() time.Duration

Uptime returns the duration the machine has been switched on for

Types

type EpollEvt

type EpollEvt syscall.EpollEvent

func EpollWait

func EpollWait(handle uintptr, timeout time.Duration, cap uint) ([]EpollEvt, error)

func (EpollEvt) Flags

func (evt EpollEvt) Flags() EpollMode

func (EpollEvt) String

func (evt EpollEvt) String() string

type EpollMode

type EpollMode uint32
const (
	EPOLL_MODE_EDGE   EpollMode = syscall.EPOLLPRI
	EPOLL_MODE_READ   EpollMode = syscall.EPOLLIN
	EPOLL_MODE_WRITE  EpollMode = syscall.EPOLLOUT
	EPOLL_MODE_HANGUP EpollMode = syscall.EPOLLHUP
	EPOLL_MODE_ERROR  EpollMode = syscall.EPOLLERR
)

func (EpollMode) String

func (v EpollMode) String() string

type EpollOp

type EpollOp int
const (
	EPOLL_OP_MOD EpollOp = syscall.EPOLL_CTL_MOD
	EPOLL_OP_ADD EpollOp = syscall.EPOLL_CTL_ADD
	EPOLL_OP_DEL EpollOp = syscall.EPOLL_CTL_DEL
)

type I2CFunction

type I2CFunction uint32
const (
	// i2c functions
	I2C_FUNC_NONE                   I2CFunction = 0x00000000
	I2C_FUNC_I2C                    I2CFunction = 0x00000001
	I2C_FUNC_10BIT_ADDR             I2CFunction = 0x00000002
	I2C_FUNC_PROTOCOL_MANGLING      I2CFunction = 0x00000004 /* I2C_M_IGNORE_NAK etc. */
	I2C_FUNC_SMBUS_PEC              I2CFunction = 0x00000008
	I2C_FUNC_NOSTART                I2CFunction = 0x00000010 /* I2C_M_NOSTART */
	I2C_FUNC_SMBUS_BLOCK_PROC_CALL  I2CFunction = 0x00008000 /* SMBus 2.0 */
	I2C_FUNC_SMBUS_QUICK            I2CFunction = 0x00010000
	I2C_FUNC_SMBUS_READ_BYTE        I2CFunction = 0x00020000
	I2C_FUNC_SMBUS_WRITE_BYTE       I2CFunction = 0x00040000
	I2C_FUNC_SMBUS_READ_BYTE_DATA   I2CFunction = 0x00080000
	I2C_FUNC_SMBUS_WRITE_BYTE_DATA  I2CFunction = 0x00100000
	I2C_FUNC_SMBUS_READ_WORD_DATA   I2CFunction = 0x00200000
	I2C_FUNC_SMBUS_WRITE_WORD_DATA  I2CFunction = 0x00400000
	I2C_FUNC_SMBUS_PROC_CALL        I2CFunction = 0x00800000
	I2C_FUNC_SMBUS_READ_BLOCK_DATA  I2CFunction = 0x01000000
	I2C_FUNC_SMBUS_WRITE_BLOCK_DATA I2CFunction = 0x02000000
	I2C_FUNC_SMBUS_READ_I2C_BLOCK   I2CFunction = 0x04000000 /* I2C-like block xfer  */
	I2C_FUNC_SMBUS_WRITE_I2C_BLOCK  I2CFunction = 0x08000000 /* w/ 1-byte reg. addr. */
)

func I2CFunctions

func I2CFunctions(fd uintptr) (I2CFunction, error)

func (I2CFunction) FlagString

func (f I2CFunction) FlagString() string

func (I2CFunction) String

func (f I2CFunction) String() string

type LIRCFeature

type LIRCFeature uint32
const (
	LIRC_CAN_SEND_RAW                 LIRCFeature = LIRCFeature(gopi.LIRC_MODE_RAW) << LIRC_MODE2SEND
	LIRC_CAN_SEND_PULSE               LIRCFeature = LIRCFeature(gopi.LIRC_MODE_PULSE) << LIRC_MODE2SEND
	LIRC_CAN_SEND_MODE2               LIRCFeature = LIRCFeature(gopi.LIRC_MODE_MODE2) << LIRC_MODE2SEND
	LIRC_CAN_SEND_LIRCCODE            LIRCFeature = LIRCFeature(gopi.LIRC_MODE_LIRCCODE) << LIRC_MODE2SEND
	LIRC_CAN_SEND_MASK                LIRCFeature = 0x0000003F
	LIRC_CAN_SET_SEND_CARRIER         LIRCFeature = 0x00000100
	LIRC_CAN_SET_SEND_DUTY_CYCLE      LIRCFeature = 0x00000200
	LIRC_CAN_SET_TRANSMITTER_MASK     LIRCFeature = 0x00000400
	LIRC_CAN_REC_RAW                  LIRCFeature = LIRCFeature(gopi.LIRC_MODE_RAW) << LIRC_MODE2REC
	LIRC_CAN_REC_PULSE                LIRCFeature = LIRCFeature(gopi.LIRC_MODE_PULSE) << LIRC_MODE2REC
	LIRC_CAN_REC_MODE2                LIRCFeature = LIRCFeature(gopi.LIRC_MODE_MODE2) << LIRC_MODE2REC
	LIRC_CAN_REC_LIRCCODE             LIRCFeature = LIRCFeature(gopi.LIRC_MODE_LIRCCODE) << LIRC_MODE2REC
	LIRC_CAN_REC_MASK                 LIRCFeature = LIRC_CAN_SEND_MASK << LIRC_MODE2REC
	LIRC_CAN_SET_REC_CARRIER          LIRCFeature = LIRC_CAN_SET_SEND_CARRIER << LIRC_MODE2REC
	LIRC_CAN_SET_REC_DUTY_CYCLE       LIRCFeature = LIRC_CAN_SET_SEND_DUTY_CYCLE << LIRC_MODE2REC
	LIRC_CAN_SET_REC_DUTY_CYCLE_RANGE LIRCFeature = 0x40000000
	LIRC_CAN_SET_REC_CARRIER_RANGE    LIRCFeature = 0x80000000
	LIRC_CAN_GET_REC_RESOLUTION       LIRCFeature = 0x20000000
	LIRC_CAN_SET_REC_TIMEOUT          LIRCFeature = 0x10000000
	LIRC_CAN_SET_REC_FILTER           LIRCFeature = 0x08000000
	LIRC_FEATURE_MIN                  LIRCFeature = 0x00000001
	LIRC_FEATURE_MAX                  LIRCFeature = 0x80000000
)

func LIRCFeatures

func LIRCFeatures(fd uintptr) (LIRCFeature, error)

func (LIRCFeature) FlagString

func (f LIRCFeature) FlagString() string

func (LIRCFeature) String

func (f LIRCFeature) String() string

type LIRCMode

type LIRCMode uint
const (
	LIRC_MODE_SEND LIRCMode = (1 << iota)
	LIRC_MODE_RCV
)

Jump to

Keyboard shortcuts

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