harness

package
v0.0.0-...-d16b440 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCannotOpenDevice = errors.New("unable to open device tty")
View Source
var ErrCannotSetBaudRate = errors.New("unable to set baud rate")
View Source
var ErrCannotSetDiskImage = errors.New("unable to set disk image")
View Source
var ErrDeviceInUse = errors.New("device is in use")

basic errors

View Source
var ErrDeviceNotResponding = errors.New("device not responding")
View Source
var ErrNotImplemented = errors.New("not implemented")

Functions

func RegisterDriver

func RegisterDriver(driver HarnessDriver)

Types

type ConsoleInterface

type ConsoleInterface interface {
	io.ReadWriteCloser
	SetReadTimeout(t time.Duration) error
}

type Device

type Device interface {
	Driver() HarnessDriver
	Power(action string) error
	Console() (ConsoleInterface, error)
	SetConsoleSpeed(bps int) error
	Version() (string, error)
	Name() string                    // name of the device, can be assigned by the user
	Tags() []string                  // tags assigned to the device, can be assigned by the user
	SetName(name string) error       // set the name of the device, should be stored in config or flashed to device
	SetUsbConsole(name string) error // set the substring of an out of band console name for this device
	SetTags(tags []string) error
	SetConfig(k, v string) error
	GetConfig() (map[string]string, error)
	Serial() (string, error)
	SetDiskImage(path string, offset uint64) error
	AttachStorage(connect bool) error
	SetControl(key string, value string) error
	Device() (string, error)
	IsBusy() (bool, error)
	Lock() error   // open/lock the device so other instances cannot use it
	Unlock() error // close the locked device so other instances can use it
}

func FindDevice

func FindDevice(driverName string, deviceId string) (Device, error)

FindDevice iterates over the available drivers and return a specific Device. If a driver is specified, only devices for that driver are returned.

func FindDevices

func FindDevices(driverName string, tags []string) ([]Device, int, error)

type HarnessDriver

type HarnessDriver interface {
	Name() string
	Description() string
	FindDevices() ([]Device, error)
}

func GetDrivers

func GetDrivers() []HarnessDriver

Jump to

Keyboard shortcuts

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