bitbox02bootloader

package
Version: v4.14.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2019 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package bitbox02bootloader contains the API to the physical device.

Index

Constants

View Source
const EventStatusChanged event.Event = "statusChanged"

EventStatusChanged is fired when the status changes. Check the status using Status().

View Source
const ProductName = "bitbox02-bootloader"

ProductName is the name of the BitBox02 bootloader product.

Variables

This section is empty.

Functions

func Asset

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDir

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.

func AssetInfo

func AssetInfo(name string) (os.FileInfo, error)

AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

func BundledFirmwareVersion

func BundledFirmwareVersion(edition bitbox02common.Edition) *semver.SemVer

BundledFirmwareVersion returns the version of the bundled firmware.

func MustAsset

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.

func RestoreAsset

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory

func RestoreAssets

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively

Types

type Communication

type Communication interface {
	SendFrame(string) error
	Query([]byte) ([]byte, error)
	Close()
}

Communication contains functions needed to communicate with the device.

type Device

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

Device provides the API to communicate with the BitBox02 bootloader.

func NewDevice

func NewDevice(
	deviceID string,
	version *semver.SemVer,
	edition bitbox02common.Edition,
	communication Communication,
) *Device

NewDevice creates a new instance of Device.

func (*Device) Close

func (device *Device) Close()

Close implements device.Device.

func (*Device) Erased

func (device *Device) Erased() (bool, error)

Erased returns true if the the device contains no firmware.

func (*Device) GetHashes

func (device *Device) GetHashes(displayFirmwareHash, displaySigningKeydataHash bool) (
	[]byte, []byte, error)

GetHashes queries the device for the firmware and signing keydata hashes. If the display flags are true, the hashes are also shown on the device screen.

func (*Device) Identifier

func (device *Device) Identifier() string

Identifier implements device.Device.

func (*Device) Init

func (device *Device) Init(testing bool) error

Init implements device.Device.

func (*Device) KeystoreForConfiguration

func (device *Device) KeystoreForConfiguration(configuration *signing.Configuration, cosignerIndex int) keystoreInterface.Keystore

KeystoreForConfiguration implements device.Device.

func (*Device) ProductName

func (device *Device) ProductName() string

ProductName implements device.Device.

func (*Device) Reboot

func (device *Device) Reboot() error

Reboot reboots the device.

func (*Device) ScreenRotate

func (device *Device) ScreenRotate() error

ScreenRotate rotates the device screen.

func (*Device) SetOnEvent

func (device *Device) SetOnEvent(onEvent func(event.Event, interface{}))

SetOnEvent implements device.Device.

func (*Device) SetShowFirmwareHashEnabled

func (device *Device) SetShowFirmwareHashEnabled(enabled bool) error

SetShowFirmwareHashEnabled returns whether the bootloader will automatically show the firmware hash on boot.

func (*Device) ShowFirmwareHashEnabled

func (device *Device) ShowFirmwareHashEnabled() (bool, error)

ShowFirmwareHashEnabled returns whether the bootloader will automatically show the firmware hash on boot.

func (*Device) Status

func (device *Device) Status() *Status

Status returns the progress of a firmware upgrade.

func (*Device) UpgradeFirmware

func (device *Device) UpgradeFirmware() error

UpgradeFirmware uploads a signed bitbox02 firmware release to the device.

func (*Device) Versions

func (device *Device) Versions() (uint32, uint32, error)

Versions queries the device for the firmware and signing pubkeys version.

type Status

type Status struct {
	Upgrading         bool    `json:"upgrading"`
	Progress          float64 `json:"progress"`
	UpgradeSuccessful bool    `json:"upgradeSuccessful"`
	ErrMsg            string  `json:"errMsg"`
	RebootSeconds     int     `json:"rebootSeconds"`
}

Status has all the info to handle the bootloader mode.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL