qmkenc

package module
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2022 License: GPL-2.0 Imports: 6 Imported by: 0

README

qmkenc

golang library to communicate with encryption enabled qmk devices

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func QCmdDecrypt

func QCmdDecrypt(dev *QEncDevice, data []byte) (ret []byte, err error)

func QCmdEncrypt

func QCmdEncrypt(dev *QEncDevice, data []byte) (ret []byte, err error)

func QCmdGetKeys

func QCmdGetKeys(dev *QEncDevice) (ret []byte, err error)

func QCmdGetMode

func QCmdGetMode(dev *QEncDevice) (retm QEncMode, retsm QEncSubMode, err error)

func QCmdInitialize

func QCmdInitialize(dev *QEncDevice) (err error)

func QCmdLock

func QCmdLock(dev *QEncDevice) (err error)

func QCmdReset

func QCmdReset(dev *QEncDevice) (err error)

func QCmdSetCfgMaxError

func QCmdSetCfgMaxError(dev *QEncDevice, val uint8) (err error)

func QCmdSetCfgParanoia

func QCmdSetCfgParanoia(dev *QEncDevice) (err error)

func QCmdSetCfgSecure

func QCmdSetCfgSecure(dev *QEncDevice, val bool) (err error)

func QCmdSetCfgTimeout

func QCmdSetCfgTimeout(dev *QEncDevice, val uint8) (err error)

func QCmdSetKeys

func QCmdSetKeys(dev *QEncDevice, data []byte) (err error)

func QCmdUnlock

func QCmdUnlock(dev *QEncDevice) (err error)

func QEncCheckResponse

func QEncCheckResponse(data []byte) (ret []byte, err error)

func QEncExit

func QEncExit() (err error)

Types

type QCfg

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

func QCmdGetCfg

func QCmdGetCfg(dev *QEncDevice) (ret *QCfg, err error)

func (*QCfg) ErrorCount

func (q *QCfg) ErrorCount() int

func (*QCfg) Initialized

func (q *QCfg) Initialized() bool

func (*QCfg) MaxError

func (q *QCfg) MaxError() int

func (*QCfg) ParanoiaMode

func (q *QCfg) ParanoiaMode() bool

func (*QCfg) SecureMode

func (q *QCfg) SecureMode() bool

func (*QCfg) Timeout

func (q *QCfg) Timeout() int

type QEncCfg

type QEncCfg byte
const (
	QENC_CFG_PARANOIA  QEncCfg = 0x00
	QENC_CFG_SECURE    QEncCfg = 0x01
	QENC_CFG_MAX_ERROR QEncCfg = 0x02
	QENC_CFG_TIMEOUT   QEncCfg = 0x03
)

type QEncCmd

type QEncCmd byte
const (
	QENC_CMD_RESET        QEncCmd = 0x00
	QENC_CMD_ENCRYPT      QEncCmd = 0x01
	QENC_CMD_DECRYPT      QEncCmd = 0x02
	QENC_CMD_MORE_DATA    QEncCmd = 0x03
	QENC_CMD_UNLOCK       QEncCmd = 0x04
	QENC_CMD_LOCK         QEncCmd = 0x05
	QENC_CMD_SET_CFG      QEncCmd = 0x06
	QENC_CMD_GET_MODE     QEncCmd = 0x07
	QENC_CMD_GET_BUFFER   QEncCmd = 0x08
	QENC_CMD_GET_KEYS     QEncCmd = 0x09
	QENC_CMD_GET_BUFFSIZE QEncCmd = 0x0A
	QENC_CMD_SET_KEYS     QEncCmd = 0x0B
	QENC_CMD_GET_CFG      QEncCmd = 0x0C
	QENC_CMD_INITIALIZE   QEncCmd = 0x0D
	QENC_CMD_NONE         QEncCmd = 0x0E
	QENC_CMD_SET_BUFFER   QEncCmd = 0x0F
)

func (QEncCmd) String

func (e QEncCmd) String() string

type QEncDevice

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

func QEncNewDevice

func QEncNewDevice(path string, bufSize uint8, timeout, retryTimeout, retryWait int, lockfile string) *QEncDevice

func QEncScanDevices

func QEncScanDevices(ids ...uint16) (ret []*QEncDevice, err error)

func (*QEncDevice) Close

func (d *QEncDevice) Close() (err error)

func (*QEncDevice) GetBufSize

func (d *QEncDevice) GetBufSize() uint8

func (*QEncDevice) GetManufacturer

func (d *QEncDevice) GetManufacturer() string

func (*QEncDevice) GetPath

func (d *QEncDevice) GetPath() string

func (*QEncDevice) GetProduct

func (d *QEncDevice) GetProduct() string

func (*QEncDevice) GetProductId added in v0.9.4

func (d *QEncDevice) GetProductId() uint16

func (*QEncDevice) GetSerial

func (d *QEncDevice) GetSerial() string

func (*QEncDevice) GetVendorId added in v0.9.4

func (d *QEncDevice) GetVendorId() uint16

func (*QEncDevice) Lock added in v0.9.1

func (d *QEncDevice) Lock() (err error)

func (*QEncDevice) Open

func (d *QEncDevice) Open() (err error)

func (*QEncDevice) SendBuffer

func (d *QEncDevice) SendBuffer(data []byte, msg chan string) (ret []byte, err error)

func (*QEncDevice) SetLockfile added in v0.9.1

func (d *QEncDevice) SetLockfile(lockfile string)

func (*QEncDevice) UnLock added in v0.9.1

func (d *QEncDevice) UnLock()

type QEncEndFct

type QEncEndFct func()
var QEncEndHandler QEncEndFct

type QEncErr

type QEncErr byte
const (
	QENC_ERR_OK          QEncErr = 0x00
	QENC_ERR_EMPTY_BUF   QEncErr = 0x01
	QENC_ERR_NO_CTX      QEncErr = 0x02
	QENC_ERR_NOT_ALLOWED QEncErr = 0x03
	QENC_ERR_INVALID     QEncErr = 0x04
	QENC_ERR_RETRY       QEncErr = 0x05
	QENC_ERR_HW_SUPPORT  QEncErr = 0x06
	QENC_ERR_MORE_DATA   QEncErr = 0x07
	// device retry timeout
	QENC_ERR_TIMEOUT QEncErr = 0xFF
)

type QEncErrFct

type QEncErrFct func(error)
var QEncErrHandler QEncErrFct

type QEncError

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

func ToQEncError

func ToQEncError(err error) *QEncError

func (*QEncError) Error

func (e *QEncError) Error() string

type QEncInfoFct

type QEncInfoFct func(string)
var QEncInfoHandler QEncInfoFct

type QEncMode

type QEncMode byte
const (
	QENC_MODE_CLOSED QEncMode = 0x00
	QENC_MODE_OPEN   QEncMode = 0x01
	QENC_MODE_LOAD   QEncMode = 0x02
	QENC_MODE_INIT   QEncMode = 0x03
)

func (QEncMode) String

func (e QEncMode) String() string

type QEncSubMode

type QEncSubMode byte
const (
	QENC_SUB_MODE_NONE            QEncSubMode = 0x00
	QENC_SUB_MODE_SEED            QEncSubMode = 0x01
	QENC_SUB_MODE_PASSWORD        QEncSubMode = 0x02
	QENC_SUB_MODE_VERIFY_PASSWORD QEncSubMode = 0x03
)

func (QEncSubMode) String

func (e QEncSubMode) String() string

Jump to

Keyboard shortcuts

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