device

package
v0.0.0-...-8ad8c1a Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package device contains functions for dealing with the armored witness hardware device.

Index

Constants

View Source
const (
	// USB vendor ID for all supported devices
	FreescaleVendorID = 0x15a2

	// SDP HID report IDs
	// (p327, 8.9.3.1 SDP commands, IMX6ULLRM).
	H2D_COMMAND       = 1 // Command  - Host to Device
	H2D_DATA          = 2 // Data     - Host to Device
	D2H_RESPONSE      = 3 // Response - Device to Host
	D2H_RESPONSE_LAST = 4 // Response - Device to Host
)

Variables

View Source
var (
	Timeout = 10 * time.Second
)

Functions

func ActivateHAB

func ActivateHAB(dev *u2fhid.Device) error

ActivateHAB issues the HAB command to the armored witness via HID.

func DetectU2F

func DetectU2F() (string, *u2fhid.Device, error)

DetectU2F returns the first U2F device found which matches the armored witness vendor and product IDs.

func WitnessStatus

func WitnessStatus(dev *u2fhid.Device) (*api.Status, error)

WitnessStatus issues the Status command to the armored witness via HID and returns the result.

Types

type Target

type Target struct {
	sync.Mutex

	// DeviceInfo allows callers to inspect details of the device (e.g. to differentiate
	// between multiple units connected at once).
	DeviceInfo hid.DeviceInfo
	// contains filtered or unexported fields
}

Target represents a valid device to be SDP booted

func BootIntoRecovery

func BootIntoRecovery(ctx context.Context, recoveryFirmware []byte, blockDeviceGlob string) (*Target, string, error)

BootIntoRecovery attempts to boot an armored witness device in SDP (Serial Boot) mode with the recovery firmware image, and then watches for a matching new block device to be presented to the host.

If no armored witness device is present, this function will wait until either a device is plugged in/rebooted into SDP mode by the user, or the context becomes done.

Returns the HID device and detected block device path, or an error.

func DetectHID

func DetectHID() ([]*Target, error)

DetectHID returns a list of compatible devices in SDP mode.

func (*Target) BootIMX

func (t *Target) BootIMX(imx []byte) error

BootIMX attempts to use SDP to send an IMX image to the target, and boot it.

Jump to

Keyboard shortcuts

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