device

package
v0.0.0-...-2208570 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2021 License: BSD-2-Clause Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client manages the connection to the device.

func NewClient

func NewClient(ctx context.Context, deviceResolver DeviceResolver, privateKey ssh.Signer) (*Client, error)

NewClient creates a new Client.

func (*Client) Close

func (c *Client) Close()

Close the Client connection

func (*Client) DeleteRemotePath

func (c *Client) DeleteRemotePath(ctx context.Context, path string) error

DeleteRemotePath deletes a file off the remote device.

func (*Client) ExpectDisconnect

func (c *Client) ExpectDisconnect(ctx context.Context, f func() error) error

func (*Client) ExpectReboot

func (c *Client) ExpectReboot(ctx context.Context, f func() error) error

ExpectReboot prepares a device for a reboot, runs a closure `f` that should reboot the device, then finally verifies whether a reboot actually took place. It does this by writing a unique value to `/tmp/ota_test_should_reboot`, then executing the closure. After we reconnect, we check if `/tmp/ota_test_should_reboot` exists. If not, exit with `nil`. Otherwise, we failed to reboot, or some competing test is also trying to reboot the device. Either way, err out.

func (*Client) GetSSHConnection

func (c *Client) GetSSHConnection(ctx context.Context) (string, error)

func (*Client) GetSystemImageMerkle

func (c *Client) GetSystemImageMerkle(ctx context.Context) (string, error)

func (*Client) Name

func (c *Client) Name() string

func (*Client) Pave

func (c *Client) Pave(ctx context.Context, build artifacts.Build) error

Pave paves the device to the specified build. It assumes the device is already in recovery, since there are multiple ways to get a device into recovery.

func (*Client) ReadRemotePath

func (c *Client) ReadRemotePath(ctx context.Context, path string) ([]byte, error)

ReadRemotePath read a file off the remote device.

func (*Client) Reboot

func (c *Client) Reboot(ctx context.Context) error

Reboot asks the device to reboot. It waits until the device reconnects before returning.

func (*Client) RebootToRecovery

func (c *Client) RebootToRecovery(ctx context.Context) error

RebootToRecovery asks the device to reboot into the recovery partition. It waits until the device disconnects before returning.

func (*Client) Reconnect

func (c *Client) Reconnect(ctx context.Context) error

func (*Client) RegisterDisconnectListener

func (c *Client) RegisterDisconnectListener(ch chan struct{})

RegisterDisconnectListener adds a waiter that gets notified when the ssh and shell is disconnected.

func (*Client) RegisterPackageRepository

func (c *Client) RegisterPackageRepository(ctx context.Context, repo *packages.Server, createRewriteRule bool) error

RegisterPackageRepository adds the repository as a repository inside the device.

func (*Client) RemoteFileExists

func (c *Client) RemoteFileExists(ctx context.Context, path string) (bool, error)

RemoteFileExists checks if a file exists on the remote device.

func (*Client) Run

func (c *Client) Run(ctx context.Context, command []string, stdout io.Writer, stderr io.Writer) error

Run a command to completion on the remote device and write STDOUT and STDERR to the passed in io.Writers.

func (*Client) ServePackageRepository

func (c *Client) ServePackageRepository(
	ctx context.Context,
	repo *packages.Repository,
	name string,
	createRewriteRule bool,
) (*packages.Server, error)

func (*Client) StartRpcSession

func (c *Client) StartRpcSession(ctx context.Context, repo *packages.Repository) (*sl4f.Client, error)

func (*Client) ValidateStaticPackages

func (c *Client) ValidateStaticPackages(ctx context.Context) error

ValidateStaticPackages checks that all static packages have no missing blobs.

type ConstantHostResolver

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

func NewConstantHostResolver

func NewConstantHostResolver(name string, host string) ConstantHostResolver

func (ConstantHostResolver) Name

func (r ConstantHostResolver) Name() string

func (ConstantHostResolver) ResolveName

func (r ConstantHostResolver) ResolveName(ctx context.Context) (string, error)

type DeviceFinderResolver

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

The logic here should match get-fuchsia-device-addr (//tools/devshell/lib/vars.sh).

func NewDeviceFinderResolver

func NewDeviceFinderResolver(ctx context.Context, deviceFinderPath string, deviceName string) (*DeviceFinderResolver, error)

func (*DeviceFinderResolver) Name

func (r *DeviceFinderResolver) Name() string

func (*DeviceFinderResolver) ResolveName

func (r *DeviceFinderResolver) ResolveName(ctx context.Context) (string, error)

type DeviceResolver

type DeviceResolver interface {
	Name() string
	ResolveName(ctx context.Context) (string, error)
}

type EstimatedMonotonicTime

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

EstimatedMonotonicTime is a structure that will return a string estimate of a device's current monotonic time.

func NewEstimatedMonotonicTime

func NewEstimatedMonotonicTime(client *Client, suffix string) *EstimatedMonotonicTime

NewEstimatedMonotonicTime constructs a new EstimatedMonotonicTime.

func (*EstimatedMonotonicTime) String

func (p *EstimatedMonotonicTime) String() string

String() will return a string prefixed by the device's monotonic time.

Jump to

Keyboard shortcuts

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